Created
July 12, 2012 21:07
-
-
Save bracki/3101015 to your computer and use it in GitHub Desktop.
Run a task once, on the localhost only.
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
env.roledefs = { | |
'hosts' : ['foo', 'bar'], | |
'local' : [] | |
} | |
@task | |
@roles('hosts') | |
def export_dummies(): | |
run("rm -rf /tmp/exports") | |
run("mkdir -p /tmp/exports") | |
with cd("/tmp/exports"): | |
for dummy in env.dummy_group[env.host_string]: | |
""" | |
Unfortunately `sudo` does not work | |
with the `cd` context manager | |
so we use `run` instead | |
""" | |
run("sudo /root/server_scripts/misc/export_pages_data.sh %s" % dummy) | |
local("mkdir -p /tmp/incoming_exports") | |
get("/tmp/exports/*", "/tmp/incoming_exports") | |
@task | |
@roles('hosts') | |
def import_dummies(): | |
with lcd('/tmp/incoming_exports'): | |
for dummy in env.dummy_group[env.host_string]: | |
local("sudo /root/server_scripts/misc/import_pages_data.sh -s %s" % dummy) | |
@task | |
@roles('local') | |
def setup_subtypes(): | |
transport.merge_subtype_from_source_to_destination( | |
env.get('subtype_id'), | |
env.get('region_id', 1) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment