|
From: | Hajducko, Steven |
Subject: | Re: [Fab-user] sudo fails every now and again |
Date: | Fri, 2 Dec 2011 09:27:48 -0800 |
>First time it prompts me for a password - why? As far as I understand Fabric should be able to handle this? I’m not sure what you mean by ‘Fabric should be able to handle this’. Sudo is prompting you for a password because that’s how sudo works. If your credentials are not cached, you get a password prompt, then a timer starts. When that timer expires, you have to enter your password again for sudo. Sorry if you know all that – not trying to be patronizing. Fabric handles interactive prompts by by passing the prompt back to you. It doesn’t have an expect like behavior where it sees a password prompt and passes in the password ( from what I know and someone correct me if I’m wrong ). If you don’t want a password prompt, you’ll have to change your sudoers to NOPASSWD. -- sh From: address@hidden [mailto:address@hidden On Behalf Of address@hidden Seems your right, quick test : fab -H dns1 dns_restart [dns1] Executing task 'dns_restart' [dns1] sudo: service bind9 restart [dns1] out: sudo password: * Stopping domain name service... bind9 [dns1] out: ...done. [dns1] out: * Starting domain name service... bind9 [dns1] out: ...done. Done. Disconnecting from dns1... done. address@hidden:/opt/git/bin$ fab -H dns1 dns_restart [dns1] Executing task 'dns_restart' [dns1] sudo: service bind9 restart [dns1] out: * Stopping domain name service... bind9 [dns1] out: ...done. [dns1] out: * Starting domain name service... bind9 [dns1] out: ...done. First time it prompts me for a password - why? As far as I understand Fabric should be able to handle this? Give the password and then the script runs without a hitch on re-runs afterwards. On Thu, Dec 1, 2011 at 6:59 PM, Paul Hoffman <address@hidden> wrote: I suspect that most of the time, sudo is being run when a password is |
[Prev in Thread] | Current Thread | [Next in Thread] |