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
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)
making sudo_prompt interpolation with sudo_prefix optional.
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)
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".
Great! I'm fine with just being credited as "Vasili (3point2)".. If you require a surname, there's no need to credit me :)
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! :)
Clean up & document env.sudo_prefix.
Fixes #609, fixes #564