def deploy(owner, upload_hook=None, revision='HEAD', keep_versions=10): if not user.exists(owner): log.abort('Specified owner does not exists! Deploy aborted') # Ensure some directories paths = _ensure_layout(owner) new_release_dir = _create_new_release_dir(owner, paths['releases']) paths['new_release'] = new_release_dir # Upload the new version and call the after upload hook _upload(owner, new_release_dir, revision) if upload_hook: with ctx.sudo(owner), ctx.cd(new_release_dir): upload_hook(owner, paths) # Activate the new release and _symlink_release(owner, paths['current'], new_release_dir) _clear_old_releases(paths['releases'], keep_versions) return paths
def inside(): return dir.exists("/vagrant") and user.exists("vagrant")
def inside(): return dir.exists('/vagrant') and user.exists('vagrant')
def test_exists(get): get.expects_call().with_args("user").returns(None) assert not user.exists("user") get.expects_call().with_args("user").returns({}) assert user.exists("user")