def upload(filepath): from backupator.conf import settings local_path = "%s/%s" % (getattr(settings, "PROJECT_PATH"), filepath) remote_path = "%s/%s/%s" % (get_backupator_root(), "src", filepath) put(local_path, remote_path)
def setup(): backupator_root = get_backupator_root() backup_dir = get_backup_dir() if backup_dir is not None: run("mkdir -p %s" % (backup_dir,)) else: abort(red("The backup_dir is not set in %s hostdef" % (hostdef.get("hostname")))) if backupator_root is not None: run("mkdir -p %s" % (backupator_root, )) with cd(backupator_root): run("rm -rf src env") run("virtualenv --no-site-package env") run("git clone [email protected]:Quelquechose/backupator.git src") with prefix("source env/bin/activate"): run("pip install -r src/requirements.txt") else: abort(red("The backupator_root is not set in %s hostdef" % (hostdef.get("hostname"))))
def launch(command): with cd(get_backupator_root()): with cd("src"): with prefix("source ../env/bin/activate"): run(command)
def cleanup(): with cd(get_backupator_root()): run("find . -name \"*.pyc\" -exec rm -f '{}' ';'")
def update_code(): with cd(get_backupator_root()): with cd("src"): run("git pull")
def update_env(): with cd(get_backupator_root()): with prefix("source env/bin/activate"): run("pip install -U -r src/requirements.txt")