コード例 #1
0
def test(context, accelerated_networking, access_key_id, account, cleanup,
         config, description, distro, early_exit, history_log, image_id,
         image_project, inject, instance_type, ip_address, log_level,
         no_default_test_dirs, cloud_config, region, results_dir,
         running_instance_id, secret_access_key, security_group_id,
         service_account_file, ssh_key_name, ssh_private_key_file, ssh_user,
         subnet_id, test_dirs, timeout, vnet_name, vnet_resource_group,
         collect_vm_info, cloud, compartment_id, availability_domain,
         signing_key_fingerprint, signing_key_file, tenancy, oci_user_id,
         enable_secure_boot, enable_uefi, tests):
    """Test image in the given framework using the supplied test files."""
    no_color = context.obj['no_color']
    try:
        status, results = test_image(
            cloud, accelerated_networking, access_key_id, account, cleanup,
            config, description, distro, early_exit, history_log, image_id,
            image_project, inject, instance_type, ip_address, log_level,
            no_default_test_dirs, cloud_config, region, results_dir,
            running_instance_id, secret_access_key, security_group_id,
            service_account_file, ssh_key_name, ssh_private_key_file, ssh_user,
            subnet_id, test_dirs, tests, timeout, vnet_name,
            vnet_resource_group, collect_vm_info, compartment_id,
            availability_domain, signing_key_fingerprint, signing_key_file,
            tenancy, oci_user_id, enable_secure_boot, enable_uefi)
        echo_results(results, no_color)
        sys.exit(status)
    except Exception as error:
        if log_level == logging.DEBUG:
            raise

        echo_style("{}: {}".format(type(error).__name__, error),
                   no_color,
                   fg='red')
        sys.exit(1)
コード例 #2
0
ファイル: img_proof_helper.py プロジェクト: illfelder/mash
def img_proof_test(cloud=None,
                   access_key_id=None,
                   description=None,
                   distro=None,
                   image_id=None,
                   instance_type=None,
                   img_proof_timeout=None,
                   region=None,
                   secret_access_key=None,
                   security_group_id=None,
                   service_account_file=None,
                   ssh_key_name=None,
                   ssh_private_key_file=None,
                   ssh_user=None,
                   subnet_id=None,
                   tests=None,
                   availability_domain=None,
                   compartment_id=None,
                   tenancy=None,
                   oci_user_id=None,
                   signing_key_file=None,
                   signing_key_fingerprint=None,
                   boot_firmware=None,
                   image_project=None,
                   log_callback=None,
                   sev_capable=None,
                   access_key=None,
                   access_secret=None,
                   vswitch_id=None,
                   use_gvnic=None):
    if boot_firmware and boot_firmware == 'uefi':
        enable_secure_boot = True
    else:
        enable_secure_boot = False

    status, result = test_image(
        cloud,
        access_key_id=access_key_id,
        availability_domain=availability_domain,
        cleanup=True,
        compartment_id=compartment_id,
        description=description,
        distro=distro,
        image_id=image_id,
        instance_type=instance_type,
        log_level=logging.DEBUG,
        oci_user_id=oci_user_id,
        region=region,
        secret_access_key=secret_access_key,
        security_group_id=security_group_id,
        service_account_file=service_account_file,
        signing_key_file=signing_key_file,
        signing_key_fingerprint=signing_key_fingerprint,
        ssh_key_name=ssh_key_name,
        ssh_private_key_file=ssh_private_key_file,
        ssh_user=ssh_user,
        subnet_id=subnet_id,
        tenancy=tenancy,
        tests=tests,
        timeout=img_proof_timeout,
        enable_secure_boot=enable_secure_boot,
        image_project=image_project,
        log_callback=log_callback,
        prefix_name='mash',
        sev_capable=sev_capable,
        access_key=access_key,
        access_secret=access_secret,
        v_switch_id=vswitch_id,
        use_gvnic=use_gvnic)

    status = SUCCESS if status == 0 else FAILED
    return {
        'status': status,
        'results_file': result['info']['results_file'],
        'instance_id': result['info']['instance'],
        'summary': result['summary'],
        'tests': result['tests']
    }