def test_default_type(cloud_fixture, minimum_config_fixture):
    (get_cloud, get_hostname, create_security_group) = cloud_fixture
    cloud = get_cloud.return_value

    launch_instance('environment-server')

    assert cloud.launch_instance.called

    args, kwargs = get_cloud.return_value.launch_instance.call_args
    (name, image_name, instance_type,
     zone, key_name, tags) = args

    assert instance_type == 'instance_type.default'
Beispiel #2
0
def test_launch_instance(get_cloud,
                         get_hostname,
                         create_security_group, minimum_config_fixture):
    cloud = Mock(name='cloud')
    get_cloud.return_value = cloud
    get_hostname.return_value = 'prod-100'

    launch_instance('environment-server')

    assert cloud.launch_instance.called

    args, kwargs = cloud.launch_instance.call_args
    (name, image_name, instance_type,
     zone, key_name, tags) = args
def test_cli_specified_type(cloud_fixture, minimum_config_fixture):
    (get_cloud, get_hostname, create_security_group) = cloud_fixture
    cloud = get_cloud.return_value

    launch_instance('environment-role-specific',
                    size="instance_type.overwritten")

    assert cloud.launch_instance.called

    args, kwargs = cloud.launch_instance.call_args
    (name, image_name, instance_type,
     zone, key_name, tags) = args

    assert instance_type == 'instance_type.overwritten'
Beispiel #4
0
def launch(args):
    """ Launch instances """

    username = os.environ.get('USER')

    instance = launch_instance(args.env_type,
                               security_groups=args.security_groups,
                               size=args.size,
                               user_data_uri=args.user_data_uri,
                               user_data_params=args.user_data_params,
                               image_name=args.image_name,
                               extra_tags=args.extra_tags,
                               owner=username)
    instance.create_dns_entries_from_tag(args.dns_tag)
    wait_for_instance_boot(instance, args.color)
    configure_instance(instance)
    print "Created instance {}".format(instance.name)