Skip to content

Instantly share code, notes, and snippets.

@mrvisser
Created February 13, 2014 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrvisser/8978662 to your computer and use it in GitHub Desktop.
Save mrvisser/8978662 to your computer and use it in GitHub Desktop.
@runs_once
@task
def upgrade():
pp = oae_env.pp_hosts()
activity = oae_env.activity_hosts()
app = oae_env.app_hosts()
env.hosts = pp[0:1]
execute(upgrade_host)
# Do the rest of the PP nodes, and half of the app nodes
env.hosts = pp[1:] + activity + app[:len(app) / 2]
execute(upgrade_host)
# If there was more than one app node, upgrade the other half of the app nodes
if len(app) > 1:
env.hosts = app[len(app) / 2:]
execute(upgrade_host)
@task
def upgrade_host():
"""Upgrade the hilary servers to the version configured in puppet. This will:
1. Forcefully stop puppet and any runs that are currently happening
2. Stop the hilary service
3. Back up the hilary app dir to /tmp/hilary_backup
4. Back up the ui app dir to /tmp/ui_backup
5. Run puppet, which should notice the missing directories and repopulate them with the
configured (updated) version of the packages
"""
execute(puppet.stop, force=True)
execute(hilary.stop)
execute(hilary.clean)
execute(ui.clean)
execute(puppet.run, force=False)
execute(puppet.start)
execute(hilary.wait_until_ready)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment