Пример #1
0
def init_ssr_config_tag(as_group, min_healthy_azs):
    try:
        config_dict = {
            'enabled': True,
            'original_bid': get_bid(as_group),
            'min_AZs': min_healthy_azs,
            # LC name size can be up to 255 chars (also tag value max length).
            # Final chars should be unique so we cut this short
            'LC_name': as_group.launch_config_name[-155:],
            'demand_expiration': False,
        }
        create_tag(as_group, 'ssr_config', config_dict)
    except Exception as e:
        handle_exception(e)
        sys.exit(1)
Пример #2
0
def init_ssr_config_tag(as_group, min_healthy_azs):
    try:
        config_dict = {
            'enabled': True,
            'original_bid': get_bid(as_group),
            'min_AZs': min_healthy_azs,
            # LC name size can be up to 255 chars (also tag value max length).
            # Final chars should be unique so we cut this short
            'LC_name': as_group.launch_config_name[-155:],
            'demand_expiration': False,
        }
        create_tag(as_group, 'ssr_config', config_dict)
    except Exception as e:
        handle_exception(e)
        sys.exit(1)
Пример #3
0
def init_az_status_tag(as_group):
    try:
        potential_zones = get_potential_azs(as_group)
        ec2_conn = boto.ec2.connect_to_region(as_group.connection.region.name)
        all_zones = ec2_conn.get_all_zones()
        zone_dict = {}
        for zone in all_zones:
            if zone.name in potential_zones:
                zone_dict[zone.name[-1]] = {"use": True, "health": [0, 0, 0]}
            else:
                zone_dict[zone.name[-1]] = {"use": False, "health": [0, 0, 0]}
        return create_tag(as_group, "AZ_status", zone_dict)
    except Exception as e:
        handle_exception(e)
        sys.exit(1)
Пример #4
0
def init_az_status_tag(as_group):
    try:
        potential_zones = get_potential_azs(as_group)
        ec2_conn = boto.ec2.connect_to_region(as_group.connection.region.name)
        all_zones = ec2_conn.get_all_zones()
        zone_dict = {}
        for zone in all_zones:
            if zone.name in potential_zones:
                zone_dict[zone.name[-1]] = {"use": True, "health": [0, 0, 0]}
            else:
                zone_dict[zone.name[-1]] = {"use": False, "health": [0, 0, 0]}
        return create_tag(as_group, "AZ_status", zone_dict)
    except Exception as e:
        handle_exception(e)
        sys.exit(1)
def set_tag_dict_value(as_group, tag_key, val_key, value):
    as_group = reload_as_group(as_group)
    tag_val = get_tag_dict_value(as_group, tag_key)
    tag_val[val_key] = value
    create_tag(as_group, tag_key, tag_val)
Пример #6
0
def set_tag_dict_value(as_group, tag_key, val_key, value):
    as_group = reload_as_group(as_group)
    tag_val = get_tag_dict_value(as_group, tag_key)
    tag_val[val_key] = value
    create_tag(as_group, tag_key, tag_val)