示例#1
0
 def compose_tree_location_list(self, args):
     filters = extract_arguments(args)
     compose_tree_locations = self.client.get_paged(self.client['compose-tree-locations']._, **filters)
     if args.json:
         print(json.dumps(list(compose_tree_locations)))
         return
     fmt = '{0:<50} {1:20} {2:10} {3:10} {4:10} {5:40} {6}'
     if compose_tree_locations:
         print(fmt.format(
             'Compose',
             'Variant',
             'Arch',
             'Location',
             'Scheme',
             'Synced Content',
             'Url'))
         print()
         for compose_tree_location in compose_tree_locations:
             print(fmt.format(
                 compose_tree_location['compose'],
                 compose_tree_location['variant'],
                 compose_tree_location['arch'],
                 compose_tree_location['location'],
                 compose_tree_location['scheme'],
                 compose_tree_location['synced_content'],
                 compose_tree_location['url']))
 def release_component_create(self, args):
     data = extract_arguments(args)
     if args.active is not None:
         data['active'] = args.active
     self.logger.debug('Creating release component with data %r', data)
     response = self.client['release-components']._(data)
     self.release_component_info(args, response['id'])
示例#3
0
    def list_release_components(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error(
                'At least some filter must be used.')
        if 'include_inactive_release' in args and args.include_inactive_release:
            filters['include_inactive_release'] = True

        release_components = self.client.get_paged(
            self.client['release-components']._, **filters)

        if args.json:
            print(json.dumps(list(release_components)))
            return
        fmt = '{0:<10} {1:25} {2}'
        start_line = True
        for release_component in release_components:
            if start_line:
                start_line = False
                print(fmt.format('ID', 'Release_ID', 'Name'))
                print()
            release_id = self._get_release_id(release_component)
            print(
                fmt.format(release_component['id'], release_id,
                           release_component['name']))
示例#4
0
 def list_build_image(self, args):
     filters = extract_arguments(args)
     build_images = get_paged(self.client['build-images']._, **filters)
     if args.json:
         print json.dumps(list(build_images))
         return
     self._print_build_image_list(build_images, args.show_md5)
示例#5
0
 def release_component_create(self, args):
     data = extract_arguments(args)
     if args.active is not None:
         data['active'] = args.active
     self.logger.debug('Creating release component with data %r', data)
     response = self.client['release-components']._(data)
     self.release_component_info(args, response['id'])
 def repo_clone(self, args):
     data = extract_arguments(args)
     data["release_id_from"] = args.release_id_from
     data["release_id_to"] = args.release_id_to
     self.logger.debug("Clone repos with data {0}".format(data))
     response = self.client.rpc["content-delivery-repos"].clone._(data)
     self.repo_list(args, response)
示例#7
0
 def list_build_image(self, args):
     filters = extract_arguments(args)
     build_images = self.client.get_paged(self.client['build-images']._, **filters)
     if args.json:
         print(json.dumps(list(build_images)))
         return
     self._print_build_image_list(build_images, args.show_md5)
 def list_compose_image_rtt_tests(self, args):
     filters = extract_arguments(args)
     rtt_tests = self.client.get_paged(self.client['compose-image-rtt-tests']._, **filters)
     if args.json:
         print json.dumps(list(rtt_tests))
         return
     self._print_compose_image_rtt_test_list(rtt_tests)
 def list_build_image_rrt_tests(self, args):
     filters = extract_arguments(args)
     build_images_rrt = self.client.get_paged(self.client['build-image-rtt-tests']._, **filters)
     if args.json:
         print json.dumps(list(build_images_rrt))
         return
     if build_images_rrt:
         print_build_image_rtt_list(build_images_rrt)
示例#10
0
 def rpm_update(self, args):
     data = extract_arguments(args)
     if data:
         self.logger.debug('Updating rpm %s with data %r', args.rpmid, data)
         self.client.rpms[args.rpmid]._ += data
     else:
         self.logger.debug('Empty data, skipping request')
     self.rpm_info(args)
示例#11
0
 def repo_update(self, args):
     data = extract_arguments(args)
     if data:
         self.logger.debug('Updating ontent delivery repo %s with data %r', args.repoid, data)
         self.client['content-delivery-repos'][args.repoid]._ += data
     else:
         self.logger.debug('Empty data, skipping request')
     self.repo_info(args)
示例#12
0
    def get_release_data(self, args):
        data = extract_arguments(args)
        if args.active is not None:
            data['active'] = args.active

        self.run_hook('release_update_prepare', args, data)

        return data
示例#13
0
 def list_compose_image_rtt_tests(self, args):
     filters = extract_arguments(args)
     rtt_tests = self.client.get_paged(
         self.client['compose-image-rtt-tests']._, **filters)
     if args.json:
         print(json.dumps(list(rtt_tests)))
         return
     self._print_compose_image_rtt_test_list(rtt_tests)
示例#14
0
 def rpm_update(self, args):
     data = extract_arguments(args)
     if data:
         self.logger.debug('Updating rpm %s with data %r', args.rpmid, data)
         self.client.rpms[args.rpmid]._ += data
     else:
         self.logger.debug('Empty data, skipping request')
     self.rpm_info(args)
示例#15
0
    def image_list(self, args):
        filters = extract_arguments(args)
        images = get_paged(self.client.images._, **filters)
        if args.json:
            print json.dumps(list(images))
            return

        self._print_image_list(images, args.show_sha256)
示例#16
0
    def list_group_resource_permission(self, args):
        filters = extract_arguments(args)
        results = self.client.get_paged(self.client['auth/group-resource-permissions']._, **filters)
        if args.json:
            print(json.dumps(list(results)))
            return

        self.print_group_resource_permissions(results)
示例#17
0
    def get_release_data(self, args):
        data = extract_arguments(args)
        if args.active is not None:
            data['active'] = args.active

        self.run_hook('release_update_prepare', args, data)

        return data
示例#18
0
 def group_resource_permission_update(self, args):
     data = extract_arguments(args)
     if data:
         self.logger.debug('Updating group resource permission %s with data %r', args.id, data)
         self.client['auth/group-resource-permissions'][args.id]._ += data
     else:
         self.logger.debug('Empty data, skipping request')
     self.group_resource_permission_info(args)
示例#19
0
文件: repo.py 项目: dmach/pdc-client
    def get_repo_data(self, args):
        data = extract_arguments(args)
        if args.include_shadow is not None:
            data['include_shadow'] = args.include_shadow

        self.run_hook('repo_parser_setup', args, data)

        return data
示例#20
0
 def list_build_image_rrt_tests(self, args):
     filters = extract_arguments(args)
     build_images_rrt = self.client.get_paged(
         self.client['build-image-rtt-tests']._, **filters)
     if args.json:
         print(json.dumps(list(build_images_rrt)))
         return
     if build_images_rrt:
         print_build_image_rtt_list(build_images_rrt)
 def build_image_rrt_tests_update(self, args):
     data = extract_arguments(args)
     if data:
         self.logger.debug('Updating global component %s and %s with data %r',
                           args.build_nvr, args.image_format, data)
         self.client['build-image-rtt-tests'][args.build_nvr][args.image_format]._ += data
     else:
         self.logger.debug('Empty data, skipping request')
     self.build_image_rrt_tests_info(args)
示例#22
0
 def global_component_update(self, args):
     data = extract_arguments(args)
     if data:
         self.logger.debug('Updating global component %s with data %r',
                           args.global_component_id, data)
         self.client['global-components'][args.global_component_id]._ += data
     else:
         self.logger.debug('Empty data, skipping request')
     self.global_component_info(args)
示例#23
0
文件: repo.py 项目: dmach/pdc-client
 def repo_update(self, args):
     data = extract_arguments(args)
     if data:
         self.logger.debug('Updating ontent delivery repo %s with data %r',
                           args.repoid, data)
         self.client['content-delivery-repos'][args.repoid]._ += data
     else:
         self.logger.debug('Empty data, skipping request')
     self.repo_info(args)
 def compose_image_rtt_test_update(self, args):
     patch_data = extract_arguments(args)
     self.client['compose-image-rtt-tests'][args.compose_id][args.variant_uid][args.arch][args.file_name]._ += \
         patch_data
     data = {'compose': args.compose_id,
             'variant': args.variant_uid,
             'arch': args.arch,
             'file_name': args.file_name}
     data.update(patch_data)
     self._display_test_info_detail(args, data)
示例#25
0
 def build_image_rrt_tests_update(self, args):
     data = extract_arguments(args)
     if data:
         self.logger.debug(
             'Updating global component %s and %s with data %r',
             args.build_nvr, args.image_format, data)
         self.client['build-image-rtt-tests'][args.build_nvr][
             args.image_format]._ += data
     else:
         self.logger.debug('Empty data, skipping request')
     self.build_image_rrt_tests_info(args)
示例#26
0
    def list_global_component_contacts(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error('At least some filter must be used.')
        global_component_contacts = get_paged(self.client['global-component-contacts']._, **filters)

        if args.json:
            print json.dumps(list(global_component_contacts))
            return
        if global_component_contacts:
            print_component_contacts(global_component_contacts)
    def list_global_component_contacts(self, args):
        filters = extract_arguments(args, prefix="filter_")
        if not filters:
            self.subparsers.choices.get("list").error("At least some filter must be used.")
        global_component_contacts = self.client.get_paged(self.client["global-component-contacts"]._, **filters)

        if args.json:
            print(json.dumps(list(global_component_contacts)))
            return
        if global_component_contacts:
            print_component_contacts(global_component_contacts)
示例#28
0
    def rpm_list(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error('At least some filter must be used.')
        rpms = get_paged(self.client.rpms._, **filters)
        if args.json:
            print json.dumps(list(rpms))
            return

        for rpm in rpms:
            print '{id:10} {name:45} {epoch}:{version}-{release}.{arch}'.format(**rpm)
示例#29
0
 def compose_image_rtt_test_update(self, args):
     patch_data = extract_arguments(args)
     self.client['compose-image-rtt-tests'][args.compose_id][args.variant_uid][args.arch][args.file_name]._ += \
         patch_data
     data = {
         'compose': args.compose_id,
         'variant': args.variant_uid,
         'arch': args.arch,
         'file_name': args.file_name
     }
     data.update(patch_data)
     self._display_test_info_detail(args, data)
示例#30
0
 def global_component_update(self, args):
     data = extract_arguments(args)
     global_component_id = self._get_component_id(args.global_component_name)
     if not global_component_id:
         self.subparsers.choices.get('update').error("This global component doesn't exist.\n")
     if data:
         self.logger.debug('Updating global component %s with data %r',
                           global_component_id, data)
         self.client['global-components'][global_component_id]._ += data
     else:
         self.logger.debug('Empty data, skipping request')
     self.global_component_info(args, global_component_id)
示例#31
0
    def list_global_component_contacts(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error(
                'At least some filter must be used.')
        global_component_contacts = get_paged(
            self.client['global-component-contacts']._, **filters)

        if args.json:
            print json.dumps(list(global_component_contacts))
            return
        if global_component_contacts:
            print_component_contacts(global_component_contacts)
示例#32
0
 def global_component_update(self, args):
     data = extract_arguments(args)
     global_component_id = self._get_component_id(
         args.global_component_name)
     if not global_component_id:
         self.subparsers.choices.get('update').error(
             "This global component doesn't exist.\n")
     if data:
         self.logger.debug('Updating global component %s with data %r',
                           global_component_id, data)
         self.client['global-components'][global_component_id]._ += data
     else:
         self.logger.debug('Empty data, skipping request')
     self.global_component_info(args, global_component_id)
    def delete_matched_release_component_contact(self, args):
        filters = extract_arguments(args, prefix="filter_")
        if not filters:
            self.subparsers.choices.get("delete-match").error("At least some filter must be used.")
        release_component_contacts = self.client.get_paged(self.client["release-component-contacts"]._, **filters)

        release_component_contacts = list(release_component_contacts)
        match_count = len(release_component_contacts)
        if match_count == 1:
            self.client["release-component-contacts"][release_component_contacts[0]["id"]]._("DELETE", {})
        elif match_count < 1:
            print("No match, nothing to do.")
        else:
            print("Multi matches, please delete via ID or provide more restrictions.")
            print_component_contacts(release_component_contacts)
示例#34
0
 def release_component_update(self, args):
     data = extract_arguments(args)
     release_component_id = self._get_release_component_id(args.release, args.name)
     if not release_component_id:
         sys.stderr.write("The specified release component doesn't exist.\n")
         sys.exit(1)
     if args.active is not None:
         data['active'] = args.active
     if data:
         self.logger.debug('Updating release component %d with data %r',
                           release_component_id, data)
         self.client['release-components'][release_component_id]._ += data
     else:
         self.logger.debug('Empty data, skipping request')
     self.release_component_info(args, release_component_id)
示例#35
0
    def list_global_components(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error('At least some filter must be used.')

        global_components = self.client.get_paged(self.client['global-components']._, **filters)

        if args.json:
            print json.dumps(list(global_components))
            return

        if global_components:
            for global_component in global_components:
                print '{0:<10} {1}'.format(
                      global_component['id'],
                      global_component['name'])
示例#36
0
    def repo_list(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error('At least some filter must be used.')
        repos = self.client.get_paged(self.client['content-delivery-repos']._, **filters)
        if args.json:
            print json.dumps(list(repos))
            return

        start_line = True
        for repo in repos:
            if start_line:
                start_line = False
                print '{0:<10} {1:120} {2:20} {3}'.format('ID', 'Name', 'Content Format', 'Content Category')
                print
            print '{id:<10} {name:120} {content_format:20} {content_category}'.format(**repo)
    def repo_list(self, args, data=None):
        filters = extract_arguments(args, prefix="filter_")
        if not filters and not data:
            self.subparsers.choices.get("list").error("At least some filter must be used.")
        repos = data or self.client.get_paged(self.client["content-delivery-repos"]._, **filters)
        if args.json:
            print(json.dumps(list(repos)))
            return

        start_line = True
        for repo in repos:
            if start_line:
                start_line = False
                print("{0:<10} {1:120} {2:20} {3}".format("ID", "Name", "Content Format", "Content Category"))
                print()
            print("{id:<10} {name:120} {content_format:20} {content_category}".format(**repo))
示例#38
0
    def rpm_list(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error('At least some filter must be used.')
        rpms = self.client.get_paged(self.client.rpms._, **filters)
        if args.json:
            print(json.dumps(list(rpms)))
            return

        start_line = True
        for rpm in rpms:
            if start_line:
                start_line = False
                print('{0:<10} {1:45} {2}'.format('ID', 'Name', 'Epoch:Version-Release.Arch'))
                print()
            print('{id:<10} {name:45} {epoch}:{version}-{release}.{arch}'.format(**rpm))
示例#39
0
    def delete_matched_release_component_contact(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('delete-match').error('At least some filter must be used.')
        release_component_contacts = get_paged(self.client['release-component-contacts']._, **filters)

        release_component_contacts = list(release_component_contacts)
        match_count = len(release_component_contacts)
        if match_count == 1:
            self.client['release-component-contacts'
                        ][release_component_contacts[0]['id']]._("DELETE", {})
        elif match_count < 1:
            print "No match, nothing to do."
        else:
            print "Multi matches, please delete via ID or provide more restrictions."
            print_component_contacts(release_component_contacts)
示例#40
0
    def rpm_list(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error('At least some filter must be used.')
        rpms = self.client.get_paged(self.client.rpms._, **filters)
        if args.json:
            print json.dumps(list(rpms))
            return

        start_line = True
        for rpm in rpms:
            if start_line:
                start_line = False
                print '{0:<10} {1:45} {2}'.format('ID', 'Name', 'Epoch:Version-Release.Arch')
                print
            print '{id:<10} {name:45} {epoch}:{version}-{release}.{arch}'.format(**rpm)
示例#41
0
 def release_component_update(self, args):
     data = extract_arguments(args)
     release_component_id = self._get_release_component_id(
         args.release, args.name)
     if not release_component_id:
         sys.stderr.write(
             "The specified release component doesn't exist.\n")
         sys.exit(1)
     if args.active is not None:
         data['active'] = args.active
     if data:
         self.logger.debug('Updating release component %d with data %r',
                           release_component_id, data)
         self.client['release-components'][release_component_id]._ += data
     else:
         self.logger.debug('Empty data, skipping request')
     self.release_component_info(args, release_component_id)
示例#42
0
    def delete_matched_release_component_contact(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('delete-match').error(
                'At least some filter must be used.')
        release_component_contacts = get_paged(
            self.client['release-component-contacts']._, **filters)

        release_component_contacts = list(release_component_contacts)
        match_count = len(release_component_contacts)
        if match_count == 1:
            self.client['release-component-contacts'][
                release_component_contacts[0]['id']]._("DELETE", {})
        elif match_count < 1:
            print "No match, nothing to do."
        else:
            print "Multi matches, please delete via ID or provide more restrictions."
            print_component_contacts(release_component_contacts)
示例#43
0
    def get_compose_data(self, args):
        data = extract_arguments(args)
        rtts = data.get('rtt_tested_architectures', None)
        rtts = rtts if type(rtts) is list else [rtts]
        dic = {}
        for rtt in rtts:
            parts = rtt.split(':')
            if not len(parts) == 3:
                self.compose_update.error(
                    'Please input rtt-tested-architectures in format VARIANT:ARCHES:TESTING_STATUS.\n')

            variant = parts[0]
            arches = parts[1]
            status = parts[2]
            dic.update({variant: {arches: status}})

        data['rtt_tested_architectures'] = dic

        return data
示例#44
0
    def list_release_components(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error('At least some filter must be used.')
        if 'include_inactive_release' in args and args.include_inactive_release:
            filters['include_inactive_release'] = True
        release_components = get_paged(self.client['release-components']._, **filters)

        if args.json:
            print json.dumps(list(release_components))
            return

        if release_components:
            for release_component in release_components:
                release_id = self._get_release_id(release_component)
                print '{:<10} {:25} {}'.format(
                      release_component['id'],
                      release_id,
                      release_component['name'])
示例#45
0
文件: repo.py 项目: dmach/pdc-client
    def repo_list(self, args, data=None):
        filters = extract_arguments(args, prefix='filter_')
        if not filters and not data:
            self.subparsers.choices.get('list').error(
                'At least some filter must be used.')
        repos = data or self.client.get_paged(
            self.client['content-delivery-repos']._, **filters)
        if args.json:
            print(json.dumps(list(repos)))
            return

        start_line = True
        for repo in repos:
            if start_line:
                start_line = False
                print('{0:<10} {1:120} {2:20} {3}'.format(
                    'ID', 'Name', 'Content Format', 'Content Category'))
                print()
            print('{id:<10} {name:120} {content_format:20} {content_category}'.
                  format(**repo))
示例#46
0
    def get_compose_data(self, args):
        data = extract_arguments(args)
        rtts = data.get('rtt_tested_architectures', None)
        rtts = rtts if type(rtts) is list else [rtts]
        dic = {}
        for rtt in rtts:
            parts = rtt.split(':')
            if not len(parts) == 3:
                self.compose_update.error(
                    'Please input rtt-tested-architectures in format VARIANT:ARCHES:TESTING_STATUS.\n'
                )

            variant = parts[0]
            arches = parts[1]
            status = parts[2]
            dic.update({variant: {arches: status}})

        data['rtt_tested_architectures'] = dic

        return data
示例#47
0
    def list_global_components(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error(
                'At least some filter must be used.')

        global_components = self.client.get_paged(
            self.client['global-components']._, **filters)

        if args.json:
            print(json.dumps(list(global_components)))
            return

        start_line = True
        fmt = '{0:<10} {1}'
        for global_component in global_components:
            if start_line:
                start_line = False
                print(fmt.format('ID', 'Name'))
                print()
            print(fmt.format(global_component['id'], global_component['name']))
示例#48
0
    def list_release_components(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error(
                'At least some filter must be used.')
        if 'include_inactive_release' in args and args.include_inactive_release:
            filters['include_inactive_release'] = True

        release_components = get_paged(self.client['release-components']._,
                                       **filters)

        if args.json:
            print json.dumps(list(release_components))
            return

        if release_components:
            for release_component in release_components:
                release_id = self._get_release_id(release_component)
                print '{0:<10} {1:25} {2}'.format(release_component['id'],
                                                  release_id,
                                                  release_component['name'])
示例#49
0
    def list_global_components(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error('At least some filter must be used.')

        global_components = self.client.get_paged(self.client['global-components']._, **filters)

        if args.json:
            print(json.dumps(list(global_components)))
            return

        start_line = True
        fmt = '{0:<10} {1}'
        for global_component in global_components:
            if start_line:
                start_line = False
                print(fmt.format('ID', 'Name'))
                print()
            print(fmt.format(
                global_component['id'],
                global_component['name']))
示例#50
0
    def list_release_components(self, args):
        filters = extract_arguments(args, prefix='filter_')
        if not filters:
            self.subparsers.choices.get('list').error('At least some filter must be used.')
        if 'include_inactive_release' in args and args.include_inactive_release:
            filters['include_inactive_release'] = True

        release_components = self.client.get_paged(self.client['release-components']._, **filters)

        if args.json:
            print(json.dumps(list(release_components)))
            return
        fmt = '{0:<10} {1:25} {2}'
        start_line = True
        for release_component in release_components:
            if start_line:
                start_line = False
                print(fmt.format('ID', 'Release_ID', 'Name'))
                print()
            release_id = self._get_release_id(release_component)
            print(fmt.format(
                release_component['id'],
                release_id,
                release_component['name']))
示例#51
0
 def group_resource_permission_delete(self, args):
     data = extract_arguments(args)
     self.logger.debug('Deleting : group resource permission %s', args.id)
     self.client['auth/group-resource-permissions'][args.id]._("DELETE", data)
示例#52
0
文件: repo.py 项目: dmach/pdc-client
 def repo_delete(self, args):
     data = extract_arguments(args)
     self.logger.debug('Deleting content delivery repo: %s', args.repoid)
     self.client['content-delivery-repos'][args.repoid]._("DELETE", data)
示例#53
0
文件: repo.py 项目: dmach/pdc-client
 def repo_create(self, args):
     data = extract_arguments(args)
     self.logger.debug('Creating content delivery repo with data %r', data)
     response = self.client['content-delivery-repos']._(data)
     self.repo_info(args, response['id'])
示例#54
0
 def global_component_create(self, args):
     data = extract_arguments(args)
     self.logger.debug('Creating global component with data %r', data)
     response = self.client['global-components']._(data)
     self.global_component_info(args, response['id'])
示例#55
0
 def compose_full_import_create(self, args):
     parser_args = self._get_value_from_json(args)
     data = extract_arguments(parser_args)
     response = self.client['rpc/compose-full-import']._(data)
     self._display_compose_import_info(parser_args, response)