Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from os import path
- from commander.commands import remote, local
- AMO_DIR="/data/amo_python/src/prod/zamboni"
- SAMO_DIR="/data/amo_python/src/services.prod/zamboni"
- def confirm(prompt):
- resp = raw_input("%s [y/n]: " % prompt)
- if resp == 'y':
- return True
- else:
- return False
- def git_checkout(directory, tag):
- return """
- cd {directory}
- git fetch -t origin
- git checkout {tag}
- git submodule update --init""".format(directory=directory, tag=tag)
- def git_checkout_vendor(directory, tag):
- return git_checkout(path.join(directory, 'vendor'), tag)
- def update_locales(directory):
- return """
- cd {directory}/locale
- svn revert -R .
- svn up
- """.format(directory=directory)
- def compress_assets(directory):
- return """
- cd {directory}
- python26 manage.py compress_assets
- """.format(directory=directory)
- def schematic(directory):
- return """
- cd {directory}
- python26 ./vendor/src/schematic/schematic migrations
- """.format(directory=directory)
- def update_zamboni(tag, vendor_tag=None):
- return
- local(git_checkout(SAMO_DIR, tag))
- if vendor_tag:
- local(git_checkout_vendor(SAMO_DIR, vendor_tag))
- local(git_checkout(AMO_DIR, tag))
- if vendor_tag:
- local(git_checkout_vendor(AMO_DIR, vendor_tag))
- if confirm("Update locales?"):
- local(update_locales(AMO_DIR))
- if confirm("Compress assets?"):
- local(compress_assets(AMO_DIR))
- if confirm("Run schematic?"):
- local(schematic(AMO_DIR))
- if confirm("Push live?"):
- local("/data/bin/omg_push_zamboni_live.sh")
- if confirm("Restart celery?"):
- remote(hosts['amo_gearman'], "/data/bin/libget/get-php5-www-git.sh")
- remote(hosts['amo_gearman'], "service celeryd-prod restart")
- remote(hosts['amo_gearman'], "service celeryd-prod-devhub restart")
- remote(hosts['amo'], "/data/bin/libget/get-php5-www-git.sh")
- remote(hosts['amo'], "apachectl graceful", remote_limit=1)
- update_zamboni('5.12.10', '5.12.10')
Add Comment
Please, Sign In to add comment