def _upload(self): # TODO Warn if there are local changes tmp_tar = git.create_archive(self.revision) try: core.put(tmp_tar, "deploy.tar.gz") core.run("tar -xzf deploy.tar.gz") file.remove("deploy.tar.gz") with ctx.unpatched_state(): file.write("VERSION", git.revparse(self.revision)) finally: core.local("rm -rf %s" % tmp_tar)
def _upload(owner, upload_dir, revision): tmp_tar = git.create_archive(revision) try: with ctx.cd(upload_dir): with ctx.sudo(): put(tmp_tar, 'deploy.tar.gz') file.attributes('deploy.tar.gz', owner=owner) with ctx.sudo(owner): run('tar -xzf deploy.tar.gz') file.remove('deploy.tar.gz') file.write('VERSION', git.revparse(revision)) finally: local('rm -rf %s' % tmp_tar)
def test_put_passes_any_given_args(_put): _put.expects_call().with_args("foo", baz="bar") core.put("foo", baz="bar")
def test_put_does_not_pass_any_default_args(_put): _put.expects_call().with_args() core.put()