-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switching user and invoking other task #268
Comments
I'm sorry the |
I hasten to add that this behaviour is arguably correct, as For the case that you need to do something like this, you should write a class which encapsulates the logic, and perhaps takes a |
@leehambley Thanks for clarifying, however implementing a binding class is not an option. I might have a chat with the maintainer of the projects that we use if there is something we can do about it, though it is sad we cannot support it right out of capistrano / sshkit itself. |
@mcb I have an idea for a feature which would allow you to set up default options in the command map. This would allow you to hook certain commands and provide your own option for them which I discussed in #234 (comment). This doesn't allow persisting of context across roles, but it would let you set up options based on the command: SSHKit.config.command_map.default_options[:your_command] = {
user: 'runner'
} Would this be helpful? |
@robd Actually this would be very helpful, as I just need to switch user for different tasks. One question though: Would this require the |
No, ssh login wouldn't be required. The This enhancement is probably quite a way off. I don't have any time right now to work on SSHKit, but it's useful to know whether it would solve problems people are having. |
That's true, however remember that there's value in projects that have a smaller, more predictable, more reliable API, sometimes this comes at the expense of interoperability and convenience, but I hope we manage to get the balance right, more often than not :) |
This problem occurs when invoking one task from another, it seems like the user context is switched once again and replaced with the default user defined in the server role.
If I call the
cap test:sudo
task, I would expect the whoami_task to outputrunner
however it returns the user defined in the server role. Is there any way of persisting the user context across tasks?Background: I am trying to call a task inside another gem and would like to not have the author modify his gem, but need to switch user due to a dual user concept, where one user deploys and another user runs the deployed code.
The text was updated successfully, but these errors were encountered: