Created
February 8, 2012 19:47
-
-
Save turtlebender/1772776 to your computer and use it in GitHub Desktop.
updated deployment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import * | |
from fabric.operations import * | |
from fabric.colors import * | |
import boto | |
machines = [("prod1.globuscs.info", "i-c248f4a0"), ("prod2.globuscs.info", "i-e3a80680"), ("prod3.globuscs.info", "i-05403a66")] | |
if __name__ == "__main__": | |
elb_conn = boto.connect_elb() | |
elbs = dict([(elb.name, elb) for elb in elb_conn.get_all_load_balancers()]) | |
for machine_name, machine_id in machines: | |
print(blue("Removing machine from ELBS")) | |
for name in ['graph-api-prod', 'www-prod-globusonline-org', 'birn-migration-production']: | |
elb_conn.deregister_instances(name, [machine_id]) | |
print(blue("Machine removed from ELBS")) | |
env.host_string = machine_name | |
sudo('chef-client') | |
print(green("Opening shell for remote testing. Exit after testing")) | |
open_shell() | |
success = prompt(green("Was the deploy successful (yes/no) ?")) | |
if success.lower() != 'yes': | |
print(red("Deploy cancelled because of failure on: {0}. Machine is not in the load balancers.".format(machine_name))) | |
sys.exit(1) | |
print(blue("Adding machine to ELBS")) | |
for name in ['graph-api-prod', 'www-prod-globusonline-org', 'birn-migration-production']: | |
elb_conn.register_instances(name, [machine_id]) | |
print(blue("Machine added to ELBS")) | |
print(blue("Deployment Complete")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment