def update_func(): if len(env.hosts) != 1: abort("Requires one and *only* one remote host.") if not env._is_production: cont = prompt("Update fixtures from non-production environment? (Y/n)", default="n", validate=r"[Y|n]") cont = (cont == "Y" and True) or (cont == "n" and False) else: cont = True if not cont: abort("Updating of fixtures aborted.") dumpdata_func() remote_dir = _ve_run("projectfab echo_fixturedir").split(os.linesep)[0].strip() for f in env._fixtures: remote_sample = os.path.join(remote_dir, f) run("bzip2 -f %(remote_sample)s" % vars()) get("%(remote_sample)s.bz2" % vars(), env._fixture_dir) run("bunzip2 -f %(remote_sample)s.bz2" % vars()) local_sample = os.path.join(env._fixture_dir, f) local("bunzip2 -f %(local_sample)s.bz2" % vars())
def manage(cmd): _ve_run("manage %(cmd)s" % vars())
def _local_or_run(cmd, capture=False): if env.host: caller = inspect.stack()[1][3] _ve_run("projectfab %(caller)s" % vars()) else: local(cmd, capture)