Last active
December 26, 2015 11:19
-
-
Save marcuswestin/7143067 to your computer and use it in GitHub Desktop.
Base fabfile.py constructs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import local, run, put, env, sudo, cd, lcd, settings | |
env.user = 'ubuntu' | |
env.key_filename = './private-key.pem' | |
isLocal = False | |
go = lcd if isLocal else cd | |
do = local if isLocal else run | |
sudo_do = local if isLocal else sudo | |
def do_something(): | |
with go('foo/bar'): | |
do('pwd') | |
sudo_do('pwd') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment