Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
allow a sudo_prefix that doesn't include sudo_prompt #609
I added a NOPASSWD entry in my sudoers file to allow a particular command to be run as root. as per http://stackoverflow.com/questions/3737003/can-i-prevent-fabric-from-prompting-me-for-a-sudo-password , 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 operations.py does
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)
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".