def maintenance_on(): """ Turn maintenance mode on. """ starting() require('app_path') run('touch %(app_path)s/.upgrading' % env)
def maintenance_off(): """ Turn maintenance mode off. """ starting() require('app_path') run('rm -f %(app_path)s/.upgrading' % env) time.sleep(5) check()
def apply(path): starting() target_directory = '/tmp/puppet' module_path = os.path.join(target_directory, 'modules') manifest_path = os.path.join(target_directory, 'manifests', 'site.pp') sudo('mkdir -p %s' % (target_directory,)) # Give the env.user permsions on the target directory sudo('chown %s %s' % (env.user, target_directory)) # get consistent local path to make rsync happy path = os.path.normpath(path) + '/' rsync_project(remote_dir=target_directory, local_dir=path, extra_opts='--exclude=.git --exclude=manifests/src') with cd(target_directory): sudo('puppet apply --modulepath=%s %s' % (module_path, manifest_path))