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
def collect_platform(args, platform_name): """Collect data for platform. @param args: cmdline arguments @param platform_name: platform to collect for @return_value: tuple of results and fail count """ res = ({}, 1) platform_config = config.load_platform_config(platform_name, require_enabled=True) component = PlatformComponent( partial(platforms.get_platform, platform_name, platform_config)) LOG.info('setting up platform: %s', platform_name) with component as platform: res = run_stage('collect for platform: {}'.format(platform_name), [ partial(collect_image, args, platform, os_name) for os_name in args.os_name ]) return res
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
def collect_platform(args, platform_name): """Collect data for platform. @param args: cmdline arguments @param platform_name: platform to collect for @return_value: tuple of results and fail count """ res = ({}, 1) platform_config = config.load_platform_config( platform_name, require_enabled=True) platform_config['data_dir'] = args.data_dir LOG.debug('platform config: %s', platform_config) component = PlatformComponent( partial(platforms.get_platform, platform_name, platform_config)) LOG.info('setting up platform: %s', platform_name) with component as platform: res = run_stage('collect for platform: {}'.format(platform_name), [partial(collect_image, args, platform, os_name) for os_name in args.os_name]) return res
def collect_platform(args, platform_name): """ collect data for platform args: cmdline arguments platform_name: platform to collect for return_value: tuple of results and fail count """ res = ({}, 1) platform_config = config.load_platform_config(platform_name) if not platform_config.get('enabled'): raise ValueError('Platform {} not enabled'.format(platform_name)) component = PlatformComponent( partial(platforms.get_platform, platform_name, platform_config)) LOG.info('setting up platform: %s', platform_name) with component as platform: res = run_stage('collect for platform: {}'.format(platform_name), [ partial(collect_image, args, platform, os_name) for os_name in args.os_name ]) return res