daily pastebin goal
32%
SHARE
TWEET

Untitled

a guest Jul 22nd, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from os import path
  2.  
  3. from commander.commands import remote, local
  4.  
  5.  
  6. AMO_DIR="/data/amo_python/src/prod/zamboni"
  7. SAMO_DIR="/data/amo_python/src/services.prod/zamboni"
  8.  
  9. def confirm(prompt):
  10.     resp = raw_input("%s [y/n]: " % prompt)
  11.  
  12.     if resp == 'y':
  13.         return True
  14.     else:
  15.         return False
  16.  
  17.  
  18. def git_checkout(directory, tag):
  19.     return """
  20.     cd {directory}
  21.     git fetch -t origin
  22.     git checkout {tag}
  23.     git submodule update --init""".format(directory=directory, tag=tag)
  24.  
  25.  
  26. def git_checkout_vendor(directory, tag):
  27.     return git_checkout(path.join(directory, 'vendor'), tag)
  28.  
  29.  
  30. def update_locales(directory):
  31.     return """
  32.         cd {directory}/locale
  33.         svn revert -R .
  34.         svn up
  35.     """.format(directory=directory)
  36.  
  37.  
  38. def compress_assets(directory):
  39.     return """
  40.         cd {directory}
  41.         python26 manage.py compress_assets
  42.     """.format(directory=directory)
  43.  
  44.  
  45. def schematic(directory):
  46.     return """
  47.         cd {directory}
  48.         python26 ./vendor/src/schematic/schematic migrations
  49.     """.format(directory=directory)
  50.  
  51.  
  52. def update_zamboni(tag, vendor_tag=None):
  53.     return
  54.     local(git_checkout(SAMO_DIR, tag))
  55.     if vendor_tag:
  56.         local(git_checkout_vendor(SAMO_DIR, vendor_tag))
  57.  
  58.     local(git_checkout(AMO_DIR, tag))
  59.     if vendor_tag:
  60.         local(git_checkout_vendor(AMO_DIR, vendor_tag))
  61.  
  62.     if confirm("Update locales?"):
  63.         local(update_locales(AMO_DIR))
  64.  
  65.     if confirm("Compress assets?"):
  66.         local(compress_assets(AMO_DIR))
  67.  
  68.     if confirm("Run schematic?"):
  69.         local(schematic(AMO_DIR))
  70.    
  71.     if confirm("Push live?"):
  72.         local("/data/bin/omg_push_zamboni_live.sh")
  73.  
  74.         if confirm("Restart celery?"):
  75.             remote(hosts['amo_gearman'], "/data/bin/libget/get-php5-www-git.sh")
  76.             remote(hosts['amo_gearman'], "service celeryd-prod restart")
  77.             remote(hosts['amo_gearman'], "service celeryd-prod-devhub restart")
  78.  
  79.         remote(hosts['amo'], "/data/bin/libget/get-php5-www-git.sh")
  80.         remote(hosts['amo'], "apachectl graceful", remote_limit=1)
  81.    
  82.  
  83. update_zamboni('5.12.10', '5.12.10')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top