Skip to content
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

use_sudo should support :as => user syntax #103

Open
koenpunt opened this issue May 14, 2013 · 4 comments
Open

use_sudo should support :as => user syntax #103

koenpunt opened this issue May 14, 2013 · 4 comments

Comments

@koenpunt
Copy link
Contributor

To continue discussion at #85

An option in general or only for runner to run commands as a specific user.

@joshgoebel
Copy link
Contributor

Were there installers other than runner you were using it with?

I like it as an option for runner, but I'm not sure I like wrapping all the commands in a sub-shell... I'd like to see commands.map instead of commands.join... I spent a lot of effort on really nice error handling and it works best when commands can be executed one at a time by the actor - so if one raises an error we know where the error was raised - unless you know another solution to that problem.

@ghost
Copy link

ghost commented May 14, 2013

I second Josh's opinion on having :as_user as an option for runner.

However, it's not the only case. Now, I find myself in a case where I need to build applications using customised installers as a different user (let's say: prey). Also, I need to transfer some files (let's say: redis.conf) as root and then chmod/chown to redis:redis on Ubuntu and install rbenv (ok, that is a runner) under the deploy account. Those all in a single installation script. Would be much simpler if we could just tell the line to do it for me. That's only an idea, BTW.

Regards!

@joshgoebel
Copy link
Contributor

Doesn't su require a password from STDIN if you aren't root already? Or is that configurable? Tell the line how? Some pseudo-code or a pseudo-package might be helpful to see.

@joshgoebel
Copy link
Contributor

Honestly I think we'd want to hook this into our sudo framework, so it works everywhere sudo works now (actor, package, installer).

package "apache" do
use_sudo true, :as => "apache"
# or
runner "blah", :sudo => "apache"

Then sudo_cmd in coordination with the actors sudo_command would have to build out the proper command... one last caveat is that right now even if sudo is true installers can decide they don't need to do anything special, so they just don't call sudo_cmd... :as though seems like we'd want it to always force a sudo... so some additional logic is needed to make that happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants