Fix style issues in update script.

This commit is contained in:
Jeremiah Orem 2013-04-19 14:01:23 -07:00
Родитель 2184082116
Коммит 2354b8aa16
1 изменённых файлов: 33 добавлений и 17 удалений

Просмотреть файл

@ -37,7 +37,7 @@ notify = setup_notifier()
def create_virtualenv(ctx):
venv = VIRTUALENV
if not venv.startswith('/data'):
raise Exception('venv must start with /data') # this is just to avoid rm'ing /
raise Exception('venv must start with /data')
ctx.local('rm -rf %s' % venv)
ctx.local('virtualenv --distribute --never-download %s' % venv)
@ -55,7 +55,8 @@ def create_virtualenv(ctx):
# make sure this always runs
ctx.local("rm -f %s/lib/python2.6/no-global-site-packages.txt" % venv)
ctx.local("%s/bin/python /usr/bin/virtualenv --relocatable %s" % (venv, venv))
ctx.local("%s/bin/python /usr/bin/virtualenv --relocatable %s" %
(venv, venv))
@task
@ -71,7 +72,8 @@ def loadtest(ctx, repo=''):
if hasattr(settings, 'MARTEAU'):
os.environ['MACAUTH_USER'] = settings.MARTEAU_USER
os.environ['MACAUTH_SECRET'] = settings.MARTEAU_SECRET
ctx.local('%s %s --server %s' % (settings.MARTEAU, repo, settings.MARTEAU_SERVER))
ctx.local('%s %s --server %s' % (settings.MARTEAU, repo,
settings.MARTEAU_SERVER))
@task
@ -100,9 +102,10 @@ def update_code(ctx, ref='origin/master'):
ctx.local("git reset --hard %s" % ref)
ctx.local("git submodule sync")
ctx.local("git submodule update --init --recursive")
# Recursively run submodule sync and update to get all the right repo URLs.
# Recursively run submodule sync/update to get all the right repo URLs.
ctx.local("git submodule foreach 'git submodule sync --quiet'")
ctx.local("git submodule foreach 'git submodule update --init --recursive'")
ctx.local("git submodule foreach "
"'git submodule update --init --recursive'")
@task
@ -110,8 +113,10 @@ def update_info(ctx, ref='origin/master'):
with ctx.lcd(settings.SRC_DIR):
ctx.local("git status")
ctx.local("git log -1")
ctx.local("/bin/bash -c 'source /etc/bash_completion.d/git && __git_ps1'")
ctx.local('git show -s {0} --pretty="format:%h" > media/git-rev.txt'.format(ref))
ctx.local("/bin/bash -c "
"'source /etc/bash_completion.d/git && __git_ps1'")
ctx.local('git show -s {0} --pretty="format:%h" '
'> media/git-rev.txt'.format(ref))
@task
@ -127,9 +132,13 @@ def disable_cron(ctx):
@task
def install_cron(ctx):
with ctx.lcd(settings.SRC_DIR):
ctx.local('%s ./scripts/crontab/gen-cron.py -z %s -r %s/bin -u apache -p %s > /etc/cron.d/.%s' %
(settings.PYTHON, settings.SRC_DIR, settings.REMORA_DIR, settings.PYTHON, settings.CRON_NAME))
ctx.local('mv /etc/cron.d/.%s /etc/cron.d/%s' % (settings.CRON_NAME, settings.CRON_NAME))
ctx.local('%s ./scripts/crontab/gen-cron.py '
'-z %s -r %s/bin -u apache -p %s > /etc/cron.d/.%s' %
(settings.PYTHON, settings.SRC_DIR, settings.REMORA_DIR,
settings.PYTHON, settings.CRON_NAME))
ctx.local('mv /etc/cron.d/.%s /etc/cron.d/%s' % (settings.CRON_NAME,
settings.CRON_NAME))
@hostgroups(settings.WEB_HOSTGROUP,
@ -147,8 +156,10 @@ def restart_workers(ctx):
else:
ctx.remote("/bin/touch %s/wsgi/zamboni.wsgi" % settings.REMOTE_APP)
ctx.remote("/bin/touch %s/wsgi/mkt.wsgi" % settings.REMOTE_APP)
ctx.remote("/bin/touch %s/services/wsgi/verify.wsgi" % settings.REMOTE_APP)
ctx.remote("/bin/touch %s/services/wsgi/application.wsgi" % settings.REMOTE_APP)
ctx.remote("/bin/touch %s/services/wsgi/verify.wsgi" %
settings.REMOTE_APP)
ctx.remote("/bin/touch %s/services/wsgi/application.wsgi" %
settings.REMOTE_APP)
@task
@ -163,10 +174,13 @@ def update_celery(ctx):
ctx.remote(settings.REMOTE_UPDATE_SCRIPT)
if getattr(settings, 'CELERY_SERVICE_PREFIX', False):
ctx.remote("/sbin/service %s restart" % settings.CELERY_SERVICE_PREFIX)
ctx.remote("/sbin/service %s-devhub restart" % settings.CELERY_SERVICE_PREFIX)
ctx.remote("/sbin/service %s-bulk restart" % settings.CELERY_SERVICE_PREFIX)
ctx.remote("/sbin/service %s-devhub restart" %
settings.CELERY_SERVICE_PREFIX)
ctx.remote("/sbin/service %s-bulk restart" %
settings.CELERY_SERVICE_PREFIX)
if getattr(settings, 'CELERY_SERVICE_MKT_PREFIX', False):
ctx.remote("/sbin/service %s restart" % settings.CELERY_SERVICE_MKT_PREFIX)
ctx.remote("/sbin/service %s restart" %
settings.CELERY_SERVICE_MKT_PREFIX)
@task
@ -176,7 +190,8 @@ def deploy(ctx):
deploy_app()
update_celery()
with ctx.lcd(settings.SRC_DIR):
ctx.local('%s manage.py cron cleanup_validation_results' % settings.PYTHON)
ctx.local('%s manage.py cron cleanup_validation_results' %
settings.PYTHON)
@task
@ -196,6 +211,7 @@ def update(ctx):
compress_assets(arg='--settings=settings_local_mkt')
schematic()
with ctx.lcd(settings.SRC_DIR):
ctx.local('%s manage.py --settings=settings_local_mkt build_appcache' % settings.PYTHON)
ctx.local('%s manage.py --settings=settings_local_mkt build_appcache' %
settings.PYTHON)
ctx.local('%s manage.py dump_apps' % settings.PYTHON)
ctx.local('%s manage.py statsd_ping --key=update' % settings.PYTHON)