Example #1
0
def collect_image(args, platform, os_name):
    """Collect data for image.

    @param args: cmdline arguments
    @param platform: instantiated platform
    @param os_name: name of distro to collect for
    @return_value: tuple of results and fail count
    """
    res = ({}, 1)

    os_config = config.load_os_config(
        platform.platform_name, os_name, require_enabled=True,
        feature_overrides=args.feature_override)
    LOG.debug('os config: %s', os_config)
    component = PlatformComponent(
        partial(platforms.get_image, platform, os_config))

    LOG.info('acquiring image for os: %s', os_name)
    with component as image:
        res = run_stage('set up and collect data for os: {}'.format(os_name),
                        [partial(setup_image.setup_image, args, image)] +
                        [partial(collect_snapshot, args, image, os_name)],
                        continue_after_error=False)

    return res
Example #2
0
def collect_image(args, platform, os_name):
    """
    collect data for image
    args: cmdline arguments
    platform: instantiated platform
    os_name: name of distro to collect for
    return_value: tuple of results and fail count
    """
    res = ({}, 1)

    os_config = config.load_os_config(os_name)
    if not os_config.get('enabled'):
        raise ValueError('OS {} not enabled'.format(os_name))

    component = PlatformComponent(
        partial(images.get_image, platform, os_config))

    LOG.info('acquiring image for os: %s', os_name)
    with component as image:
        res = run_stage('set up and collect data for os: {}'.format(os_name),
                        [partial(setup_image.setup_image, args, image)] +
                        [partial(collect_snapshot, args, image, os_name)],
                        continue_after_error=False)

    return res
Example #3
0
def collect_image(args, platform, os_name):
    """Collect data for image.

    @param args: cmdline arguments
    @param platform: instantiated platform
    @param os_name: name of distro to collect for
    @return_value: tuple of results and fail count
    """
    res = ({}, 1)

    os_config = config.load_os_config(
        platform.platform_name, os_name, require_enabled=True,
        feature_overrides=args.feature_override)
    LOG.debug('os config: %s', os_config)
    component = PlatformComponent(
        partial(platforms.get_image, platform, os_config))

    LOG.info('acquiring image for os: %s', os_name)
    with component as image:
        res = run_stage('set up and collect data for os: {}'.format(os_name),
                        [partial(setup_image.setup_image, args, image)] +
                        [partial(collect_snapshot, args, image, os_name)],
                        continue_after_error=False)

    return res
Example #4
0
def setup_build(args):
    """Set build system up then run build.

    @param args: cmdline arguments
    @return_value: tuple of results and fail count
    """
    res = ({}, 1)

    # set up platform
    LOG.info('setting up platform: %s', args.build_platform)
    platform_config = config.load_platform_config(args.build_platform)
    platform_call = partial(platforms.get_platform, args.build_platform,
                            platform_config)
    with PlatformComponent(platform_call) as platform:

        # set up image
        LOG.info('acquiring image for os: %s', args.build_os)
        img_conf = config.load_os_config(platform.platform_name, args.build_os)
        image_call = partial(images.get_image, platform, img_conf)
        with PlatformComponent(image_call) as image:

            # set up snapshot
            snapshot_call = partial(snapshots.get_snapshot, image)
            with PlatformComponent(snapshot_call) as snapshot:

                # create instance with cloud-config to set it up
                LOG.info('creating instance to build deb in')
                empty_cloud_config = "#cloud-config\n{}"
                instance_call = partial(instances.get_instance,
                                        snapshot,
                                        empty_cloud_config,
                                        use_desc='build cloud-init deb')
                with PlatformComponent(instance_call) as instance:

                    # build the deb
                    res = run_single('build deb on system',
                                     partial(build_deb, args, instance))

    return res
Example #5
0
def setup_build(args):
    """Set build system up then run build.

    @param args: cmdline arguments
    @return_value: tuple of results and fail count
    """
    res = ({}, 1)

    # set up platform
    LOG.info('setting up platform: %s', args.build_platform)
    platform_config = config.load_platform_config(args.build_platform)
    platform_call = partial(platforms.get_platform, args.build_platform,
                            platform_config)
    with PlatformComponent(platform_call) as platform:

        # set up image
        LOG.info('acquiring image for os: %s', args.build_os)
        img_conf = config.load_os_config(platform.platform_name, args.build_os)
        image_call = partial(platforms.get_image, platform, img_conf)
        with PlatformComponent(image_call) as image:

            # set up snapshot
            snapshot_call = partial(platforms.get_snapshot, image)
            with PlatformComponent(snapshot_call) as snapshot:

                # create instance with cloud-config to set it up
                LOG.info('creating instance to build deb in')
                empty_cloud_config = "#cloud-config\n{}"
                instance_call = partial(
                    platforms.get_instance, snapshot, empty_cloud_config,
                    use_desc='build cloud-init deb')
                with PlatformComponent(instance_call) as instance:

                    # build the deb
                    res = run_single('build deb on system',
                                     partial(build_deb, args, instance))

    return res