Skip to content

Instantly share code, notes, and snippets.

@BlackDex
Forked from dosaboy/charm-upgrade-openstack
Created February 27, 2017 14:56
Show Gist options
  • Save BlackDex/b02e3ae7ec1728c1de76dd1f9e583157 to your computer and use it in GitHub Desktop.
Save BlackDex/b02e3ae7ec1728c1de76dd1f9e583157 to your computer and use it in GitHub Desktop.
Upgrade Openstack deployed with Juju Charm
#!/bin/bash -eu
#
# Trigger a managed upgrade.
#
# Authors:
# edward.hope-morley@canonical.com
#
SERVICE=$1
RELEASE=$2
SERIES=${3:-'trusty'}
units ()
{
cat << EOF| python -
import json, subprocess
data = subprocess.check_output(['juju', 'status', '--format=json'])
j = json.loads(data)
services = j['services']
print '\n'.join(services["$1"]['units'].keys())
EOF
}
juju set $SERVICE action-managed-upgrade=True openstack-origin="cloud:$SERIES-$RELEASE"
for unit in `units $SERVICE`; do
echo -e "\033[32mUpgrading unit \033[33m$unit\033[32m to \033[33mcloud:$SERIES-$RELEASE\033[0m"
juju action do $unit openstack-upgrade
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment