Ejemplo n.º 1
0
def validate_new_image(image_id, machine_request_id):
    machine_request = MachineRequest.objects.get(id=machine_request_id)
    machine_request.status = "validating"
    machine_request.save()
    from service.instance import launch_esh_instance

    admin_driver = machine_request.new_admin_driver()
    admin_ident = machine_request.new_admin_identity()
    if not admin_driver:
        logger.warn("Need admin_driver functionality to auto-validate instance")
        return False
    if not admin_ident:
        logger.warn("Need to know the AccountProvider to auto-validate instance")
        return False
    # Update the admin driver's User (Cannot be initialized via. Chromogenic)
    admin_driver.identity.user = admin_ident.created_by
    # Update metadata on rtwo/libcloud machine -- NOT a glance machine
    machine = admin_driver.get_machine(image_id)
    small_size = admin_driver.list_sizes()[0]
    (instance_id, token, password) = launch_esh_instance(
        admin_driver,
        machine.id,
        small_size.id,
        admin_ident,
        "Automated Image Verification - %s" % image_id,
        "atmoadmin",
        using_admin=True,
    )
    return instance_id
Ejemplo n.º 2
0
def validate_new_image(image_id, machine_request_id):
    machine_request = MachineRequest.objects.get(id=machine_request_id)
    machine_request.status = 'validating'
    machine_request.save()
    from service.instance import launch_esh_instance
    admin_driver = machine_request.new_admin_driver()
    admin_ident = machine_request.new_admin_identity()
    if not admin_driver:
        logger.warn("Need admin_driver functionality to auto-validate instance")
        return False
    if not admin_ident:
        logger.warn("Need to know the AccountProvider to auto-validate instance")
        return False
    # Attempt to launch using the admin_driver
    admin_driver.identity.user = admin_ident.created_by
    machine = admin_driver.get_machine(image_id)
    small_size = admin_driver.list_sizes()[0]
    (instance, token, password) = launch_esh_instance(
            admin_driver,
            machine.id,
            small_size.id,
            admin_ident,
            'Automated Image Verification - %s' % image_id,
            'atmoadmin',
            using_admin=True)
    return instance.id
Ejemplo n.º 3
0
def validate_new_image(image_id, machine_request_id):
    machine_request = MachineRequest.objects.get(id=machine_request_id)
    machine_request.status = 'validating'
    machine_request.save()
    from service.instance import launch_esh_instance
    admin_driver = machine_request.new_admin_driver()
    admin_ident = machine_request.new_admin_identity()
    if not admin_driver:
        logger.warn(
            "Need admin_driver functionality to auto-validate instance")
        return False
    if not admin_ident:
        logger.warn(
            "Need to know the AccountProvider to auto-validate instance")
        return False
    # Attempt to launch using the admin_driver
    admin_driver.identity.user = admin_ident.created_by
    machine = admin_driver.get_machine(image_id)
    small_size = admin_driver.list_sizes()[0]
    (instance, token, password) = launch_esh_instance(
        admin_driver,
        machine.id,
        small_size.id,
        admin_ident,
        'Automated Image Verification - %s' % image_id,
        'atmoadmin',
        using_admin=True)
    return instance.id
Ejemplo n.º 4
0
def validate_new_image(image_id, machine_request_id):
    machine_request = MachineRequest.objects.get(id=machine_request_id)
    machine_request.status = 'validating'
    machine_request.save()
    from service.instance import launch_esh_instance
    admin_driver = machine_request.new_admin_driver()
    admin_ident = machine_request.new_admin_identity()
    if not admin_driver:
        logger.warn(
            "Need admin_driver functionality to auto-validate instance")
        return False
    if not admin_ident:
        logger.warn(
            "Need to know the AccountProvider to auto-validate instance")
        return False
    #Update the admin driver's User (Cannot be initialized via. Chromogenic)
    admin_driver.identity.user = admin_ident.created_by
    #Update metadata on rtwo/libcloud machine -- NOT a glance machine
    machine = admin_driver.get_machine(image_id)
    small_size = admin_driver.list_sizes()[0]
    (instance_id, token, password) = launch_esh_instance(
        admin_driver,
        machine.id,
        small_size.id,
        admin_ident,
        'Automated Image Verification - %s' % image_id,
        'atmoadmin',
        using_admin=True)
    return instance_id