Since the command is sudo, don't run with sudo. Changing to sudo(command, user='postgres') does not work as the directory change is run in the sudo which fails. run('sudo -u postgres %s' % command) results in cd /var/lib/postgresql && sudo -u postgres COMMAND sudo(command, user='postgres') results in sudo -u postgres cd /var/lib/postgresql && COMMAND The use case is a sudoer given NOPASSWD for postgres running psql.
Since the command is sudo, don't run with sudo.
Changing to sudo(command, user='postgres') does not work as the directory change is run in the sudo which fails.
run('sudo -u postgres %s' % command) results in cd /var/lib/postgresql && sudo -u postgres COMMAND
sudo(command, user='postgres') results in sudo -u postgres cd /var/lib/postgresql && COMMAND
The use case is a sudoer given NOPASSWD for postgres running psql.

badele/fabtools,pombredanne/fabtools,ahnjungho/fabtools,sociateru/fabtools,hagai26/fabtools,AMOSoft/fabtools,n0n0x/fabtools-python,bitmonk/fabtools,wagigi/fabtools-python,prologic/fabtools,davidcaste/fabtools,fabtools/fabtools,ronnix/fabtools