Example #1
0
def convert_epu_description_to_asg_out(desc, asg):

    inst_list = desc['instances']
    name = desc['name']
    config = desc['config']

    log(logging.DEBUG, "Changing the config: %s" %(str(config)))
    #asg.DesiredCapacity = int(config['engine_conf']['preserve_n'])
    asg.Instances = AWSListType('Instances')

    for inst in inst_list:
        log(logging.DEBUG, "Converting instance %s" %(str(inst)))
        out_t = InstanceType('Instance')

        out_t.AutoScalingGroupName = name
        out_t.HealthStatus = _is_healthy(inst['state'])
        if 'state_desc' in inst and inst['state_desc'] is not None:
            out_t.HealthStatus = out_t.HealthStatus + " " + str(inst['state_desc'])
        out_t.LifecycleState = inst['state']
        out_t.AvailabilityZone = inst['site']
        out_t.LaunchConfigurationName = asg.LaunchConfigurationName

        if 'iaas_id' in  inst:
            out_t.InstanceId = inst['iaas_id']
        else:
            out_t.InstanceId = ""

        asg.Instances.type_list.append(out_t)

    return asg
Example #2
0
    def _make_new_instance(self, asg):
        inst = InstanceType('AutoScalingInstanceDetails')
        inst.AutoScalingGroupName = asg.AutoScalingGroupName
        inst.AvailabilityZone = asg.AvailabilityZones.type_list[0]
        inst.HealthStatus = "Healthy"
        inst.InstanceId = str(uuid.uuid4()).split('-')[0]
        inst.LaunchConfigurationName = asg.LaunchConfigurationName
        inst.LifecycleState = "running"

        asg.Instances.type_list.append(inst)

        g_instance_registry[inst.InstanceId] = inst
Example #3
0
    def _make_new_instance(self, asg):
        inst = InstanceType('AutoScalingInstanceDetails')
        inst.AutoScalingGroupName = asg.AutoScalingGroupName
        inst.AvailabilityZone = asg.AvailabilityZones.type_list[0]
        inst.HealthStatus = "Healthy"
        inst.InstanceId = str(uuid.uuid4()).split('-')[0]
        inst.LaunchConfigurationName = asg.LaunchConfigurationName
        inst.LifecycleState = "running"

        asg.Instances.type_list.append(inst)

        g_instance_registry[inst.InstanceId] = inst
Example #4
0
    def _set_instances(self, asg):
        asg.Instances = AWSListType('Instances')

        for i in range(asg.DesiredCapacity):
            out_t = InstanceType('Instance')

            out_t.AutoScalingGroupName = asg.AutoScalingGroupName
            out_t.HealthStatus = 'Healthy'
            out_t.LifecycleState = '400-Running'
            out_t.AvailabilityZone = 'alamo'
            out_t.LaunchConfigurationName = 'stuff'
            out_t.InstanceId = 'i-' + str(uuid.uuid4()).split('-')[0]
            asg.Instances.type_list.append(out_t)
Example #5
0
def convert_instance_type(name, inst):
    log(logging.DEBUG, "Converting instance %s" % (str(inst)))
    out_t = InstanceType('Instance')

    out_t.AutoScalingGroupName = name
    out_t.HealthStatus = _is_healthy(inst['state'])
    if 'state_desc' in inst and inst['state_desc'] is not None:
        out_t.HealthStatus = out_t.HealthStatus + " " + str(inst['state_desc'])
    out_t.LifecycleState = inst['state']
    out_t.AvailabilityZone = inst['site']
    out_t.LaunchConfigurationName = inst['deployable_type']

    if 'iaas_id' in inst:
        out_t.InstanceId = inst['iaas_id']
    else:
        out_t.InstanceId = ""
    return out_t
Example #6
0
def convert_instance_type(name, inst):
    log(logging.DEBUG, "Converting instance %s" %(str(inst)))
    out_t = InstanceType('Instance')

    out_t.AutoScalingGroupName = name
    out_t.HealthStatus = _is_healthy(inst['state'])
    if 'state_desc' in inst and inst['state_desc'] is not None:
        out_t.HealthStatus = out_t.HealthStatus + " " + str(inst['state_desc'])
    out_t.LifecycleState = inst['state']
    out_t.AvailabilityZone = inst['site']
    out_t.LaunchConfigurationName = inst['deployable_type']

    if 'iaas_id' in  inst:
        out_t.InstanceId = inst['iaas_id']
    else:
        out_t.InstanceId = ""
    return out_t