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

allow a sudo_prefix that doesn't include sudo_prompt #609

wants to merge 1 commit into from


Copy link

@3point2 3point2 commented Apr 5, 2012

I added a NOPASSWD entry in my sudoers file to allow a particular command to be run as root. as per , I had to add shell=False to run the command 'as-is'.

However, with the latest version of Fabric (1.4.0), it's not possible to prevent Fabric from passing the "-p" option to sudo, which makes it ask for a password even if none is needed.

I tried setting env.sudo_prefix, but this doesn't work because _sudo_prefix() in does

prefix = env.sudo_prefix % env.sudo_prompt

In other words, the sudo_prefix string has to contain a '%s' for interpolation.

Using the approach in this pull request will also make it easier to document sudo_prefix and I think making all env vars available to sudo_prefix is cool, especially since you're planning to document it (#564)

this makes it possible to use a sudo prefix that doesn't
include the sudo_prompt text (for example, if a password
prompt isn't needed)
Copy link

@bitprophet bitprophet commented Apr 5, 2012

I like this change, it's subtle but shouldn't break anything and does make it a lot more flexible for your sort of edge case. Thanks!

EDIT: Do you have a surname you'd like to specify so I can credit you in the changelog? :) your GH account just says "Vasili".

Copy link

@3point2 3point2 commented Apr 6, 2012

Great! I'm fine with just being credited as "Vasili (3point2)".. If you require a surname, there's no need to credit me :)

Copy link

@bitprophet bitprophet commented Apr 6, 2012

Nah, not required, but "full name" is the default format and most people who didn't put it in their GH profile are usually OK handing it out. No worries though! :)

@bitprophet bitprophet closed this in 6bf1d90 Apr 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants