Ejemplo n.º 1
0
 def test_get_old_ami(self, input):
     # "Session should have exited because user doesn't ignore coreos version change"
     with self.assertRaises(SystemExit):
         coreos.get_ami('801.0.0', 'alpha', 'eu-central-1', 'm1.small')
Ejemplo n.º 2
0
args = parser.parse_args()
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)

region = os.getenv("AWS_DEFAULT_REGION")
cluster = Cluster(args.cluster_name)

if args.op == 'launch':
    logging.info("--> Fetching CoreOS etcd discovery token")
    cloud_config = CloudConfig(
        open(args.cloud_config_path).read()
    ).with_new_token(args.instances_count)

    try:
        launcher = ClusterLauncher()
        ami = get_ami(region, args.instance_type)

        conf = ClusterConf(
            args.cluster_name, ami, args.key_pair_name,
            user_data = cloud_config,
            instances_count = int(args.instances_count),
            instance_type = args.instance_type,
            allocate_ip_address = False
        ) \
        .volume(
            name = '/dev/sdb', 
            size = 100, 
            volume_type = 'gp2', 
            delete_on_termination = True
        )
 
Ejemplo n.º 3
0
 def assert_ami_matches(self, version, channel, region, instance_type, category):
     ami = coreos.get_ami(version, channel, region, instance_type)
     ami_file = utils.download_file_as_string(coreos.release_metadata_url(channel, version, coreos.ami_list_file_name))
     stable_current_amis = json.loads(ami_file)
     expected_ami = [ ami for ami in stable_current_amis['amis'] if ami['name'] == region ][0][category]
     self.assertEqual(ami, expected_ami)