Hi,
I'm a new Fabric user, and a fan. Good stuff. :)
I noticed in the user guide, this paragraph:
"If you have a private key that the servers will acknowledge, then Fabric will
automatically pick it up, and if a password is required for unlocking that key,
then Fabric will ask that password. This default behavior should work for most
people, but if you use password-less keys, then note the caveat that Fabric
won't ask for a password and this in turn means that the
sudo()
operation
won't be able to parse a password to the sudo command on the remote hosts.
To counter this, you need to specify, on the remote hosts, the commands you
need for deployment as sudo'able without a password."
I thought it might be worthwhile to point out that there's an alternative to making those commands sudo'able without a password:
import getpass
def sudo_cmd():
"Run a command with sudo. Prompts for your password first."
set (fab_password=getpass.getpass())
prompt('command', 'Command')
sudo(get('command'))
The above snippet will work with ssh-key authentication, and has
the added bonus of not echoing your sudo password on the screen.