Ejemplo n.º 1
0
def main(args: argparse.Namespace):
    exit_code = os.EX_OK
    try:
        target_list = args.targets.split(',')
        factory_client = FactoryClient(args.factory, args.token)

        targets = factory_client.get_targets(target_list)

        apps_fetcher = SkopeAppFetcher(args.token, args.dst_dir)
        for target in targets:
            target.shortlist = args.apps_shortlist
            apps_fetcher.fetch_target(target, force=True)

    except Exception as exc:
        logging.error('Failed to pull Target apps and images: {}\n{}'.format(
            exc, traceback.format_exc()))
        exit_code = os.EX_SOFTWARE
    return exit_code
Ejemplo n.º 2
0
    return args


if __name__ == '__main__':
    exit_code = 0

    try:
        logging.basicConfig(
            format='%(asctime)s %(levelname)s: %(module)s: %(message)s',
            level=logging.INFO)
        args = get_args()

        factory_client = FactoryClient(args.factory, args.token)
        if args.targets:
            logger.info('Getting Targets for {}'.format(args.targets))
            targets = factory_client.get_targets(args.targets)
            err_msg = 'No Targets found; Factory: {}, input Target list: {}'.format(
                args.factory, args.targets)
        else:
            logger.info('Getting Targets of version {}'.format(
                args.target_version))
            targets = factory_client.get_targets_by_version(
                args.target_version)
            err_msg = 'No Targets found; Factory: {}, Version/Build Number: {}'.format(
                args.factory, args.target_version)

        found_targets_number = len(targets)
        if found_targets_number == 0:
            logger.warning(err_msg)
            exit(1)
Ejemplo n.º 3
0
    return args


if __name__ == '__main__':
    exit_code = 0
    try:
        logging.basicConfig(
            format=
            '%(asctime)s %(levelname)s: Apps Fetcher: %(module)s: %(message)s',
            level=logging.INFO)
        args = get_args()

        target_names = args.targets.split(',')
        factory_client = FactoryClient(args.factory, args.token)

        targets = factory_client.get_targets(target_names)
        app_store = ArchOSTreeTargetAppsStore(args.factory,
                                              args.ostree_repo_archive_dir,
                                              args.repo_dir)

        publisher = TargetPublisher(args.factory, args.token, args.cred_arch,
                                    targets, app_store, args.fetch_dir,
                                    args.treehub_repo_dir)

        publisher.fetch_targets()
        publisher.publish_targets()
        app_store.store_archive()

        for target in targets:
            logging.info('New Target: {}\n{}'.format(
                target.name,