parser.add_argument('--yaml', default='./aws.yaml', help="yaml file to read (defaults to ./aws.yaml)") args = parser.parse_args() # Initialize dictionary for storage of globals (values that do not change, # but are discarded when the script exits). g = {} #PC * Parse YAML file. y = yaml_lib.parse_yaml(args.yaml) #PC * Connect to region specified in YAML ("region"). # (i.e., get VPCConnection and EC2Connection objects). # FIXME: validate that the region exists y['region'] = yaml_lib.yaml_attr(y, 'region', 'eu-west-1') (g['vpc_conn'], g['ec2_conn']) = init_lib.init_region(y['region']) print "Connected to region {}".format(y['region']) #PC * Connect to VPC specified in YAML ("vpc" -> "cidr-block"). n = yaml_lib.yaml_attr(y, 'vpc', None) n['cidr-block'] = yaml_lib.yaml_attr(n, 'cidr-block', None) n['name'] = yaml_lib.yaml_attr(n, 'name', 'susecon') print "Looking for VPC {}".format(n['cidr-block']) try: g['vpc_obj'] = init_lib.init_vpc(g['vpc_conn'], n['cidr-block']) except SpinupError as e: print "{}".format(e) sys.exit() #PC * Get Salt Master subnet (first one in "subnets" list).
# "'resume', 'start', 'stop', 'suspend', 'unpause') to perform", # nargs='?' #) args = parser.parse_args() # Initialize dictionary for storage of globals (values that do not change, # but are discarded when the script exits). g = {} #PC * Parse YAML. y = yaml_lib.parse_yaml( args.yaml ) #PC * Connect to region specified in YAML ("region"). # (i.e., get VPCConnection and EC2Connection objects). # FIXME: validate that the region exists y['region'] = yaml_lib.yaml_attr( y, 'region', 'eu-west-1' ) ( g['vpc_conn'], g['ec2_conn'] ) = init_lib.init_region( y['region'] ) print "Connected to region {}".format( y['region'] ) #PC * Connect to VPC specified in YAML ("vpc" -> "cidr-block"). n = yaml_lib.yaml_attr( y, 'vpc', None ) n['cidr-block'] = yaml_lib.yaml_attr( n, 'cidr-block', None ) n['name'] = yaml_lib.yaml_attr( n, 'name', 'susecon' ) print "Looking for VPC {}".format(n['cidr-block']) g['vpc_obj'] = init_lib.init_vpc( g['vpc_conn'], n['cidr-block'] ) #PC * Clobber existing VPC tag with YAML value ("vpc" -> "name"). init_lib.update_tag( g['vpc_obj'], 'Name', n['name'] ) print "Found VPC {} (Name: {})".format(n['cidr-block'], n['name']) #PC * Look at YAML "subnets" and see how many there are.
# Verify that delegate number was given on command line and that it is an integer. if args.delegate is None: raise SpinupError( "Must provide delegate number to start" ) delegate = int(args.delegate) # Initialize dictionary for storage of globals (values that do not change, # but are discarded when the script exits). g = {} #PC * Parse YAML file. y = yaml_lib.parse_yaml( args.yaml ) #PC * Connect to region specified in YAML ("region"). # (i.e., get VPCConnection and EC2Connection objects). # FIXME: validate that the region exists y['region'] = yaml_lib.yaml_attr( y, 'region', 'eu-west-1' ) ( g['vpc_conn'], g['ec2_conn'] ) = init_lib.init_region( y['region'] ) print "Connected to region {}".format( y['region'] ) #PC * Connect to VPC specified in YAML ("vpc" -> "cidr-block"). n = yaml_lib.yaml_attr( y, 'vpc', None ) n['cidr-block'] = yaml_lib.yaml_attr( n, 'cidr-block', None ) n['name'] = yaml_lib.yaml_attr( n, 'name', 'susecon' ) print "Looking for VPC {}".format(n['cidr-block']) g['vpc_obj'] = init_lib.init_vpc( g['vpc_conn'], n['cidr-block'] ) #PC * Get Salt Master subnet (first one in "subnets" list). g['master_subnet'] = init_lib.init_subnet( g['vpc_conn'], g['vpc_obj'].id, y['subnets'][0]['cidr-block']