ronnix/fabtools — pull request #106 by iiie (2013-05-02 01:34:42+00:00)
Title: Fix run as postgres

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.