Exemplo n.º 1
0
    def run(self):
        org_name = self.get_option("org")
        system_group_name = self.get_option("name")
        # info is always grep friendly

        # get system details
        system_group = get_system_group(org_name, system_group_name)
        if not system_group:
            return os.EX_DATAERR

        systems = self.api.system_group_systems(org_name, system_group["id"])

        if systems is None:
            return os.EX_DATAERR

        self.printer.set_header(
            _("Systems within System Group [ %s ] For Org [ %s ]") % (system_group["name"], org_name)
        )

        self.printer.add_column("id")
        self.printer.add_column("name")

        self.printer.print_items(systems)

        return os.EX_OK
Exemplo n.º 2
0
    def run(self):
        systemGroupApi = SystemGroupAPI()

        org_name = self.get_option('org')
        group_name = self.get_option('name')
        type_in = self.get_option('type')

        system_group = get_system_group(org_name, group_name)
        system_group_id = system_group['id']

        errata = systemGroupApi.errata(org_name,
                                       system_group_id,
                                       type_in=type_in)

        batch_add_columns(self.printer, {'errata_id': _("ID")},
                          {'title': _("Title")}, {'type': _("Type")})
        self.printer.add_column('systems', _('# Systems'), formatter=len)
        self.printer.add_column('systems',
                                _("Systems"),
                                multiline=True,
                                show_with=printer.VerboseStrategy)

        self.printer.set_header(
            _("Errata for system group %(org_name)s in organization %(org_name)s"
              ) % {
                  'group_name': group_name,
                  'org_name': org_name
              })
        self.printer.print_items(errata)

        return os.EX_OK
Exemplo n.º 3
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')

        self.printer.set_header(
            _("System Group History For [ %s ]") % (system_group_name))

        system_group = get_system_group(org_name, system_group_name)

        # get list of jobs
        history = self.api.system_group_history(org_name, system_group['id'])

        for job in history:
            job['tasks'] = len(job['tasks'])
            params = ""
            for key, value in job['parameters'].items():
                params += key + ": " + (', ').join(value) + "\n"
            job['parameters'] = params

        self.printer.add_column('id', _("ID"))
        self.printer.add_column('task_type', _("Type"))
        self.printer.add_column('parameters', _("Parameters"), multiline=True)
        self.printer.add_column('tasks', _("Tasks"))
        self.printer.print_items(history)

        return os.EX_OK
Exemplo n.º 4
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')

        self.printer.set_header(_("System Group History For [ %s ]") % (system_group_name))

        system_group = get_system_group(org_name, system_group_name)

        # get list of jobs
        history = self.api.system_group_history(org_name, system_group['id'])

        for job in history:
            job['tasks'] = len(job['tasks'])
            params = ""
            for key, value in job['parameters'].items():
                params += key + ": " + (', ').join(value) + "\n"
            job['parameters'] = params


        self.printer.add_column('id', _("ID"))
        self.printer.add_column('task_type', _("Type"))
        self.printer.add_column('parameters', _("Parameters"), multiline=True)
        self.printer.add_column('tasks', _("Tasks"))
        self.printer.print_items(history)

        return os.EX_OK
Exemplo n.º 5
0
    def run(self):
        org_name = self.get_option('org')
        group_name = self.get_option('name')
        env_name = self.get_option('environment')
        view_label = self.get_option('view_label')
        view_id = self.get_option('view_id')
        view_name = self.get_option('view_name')

        system_group = get_system_group(org_name, group_name)
        system_group_id = system_group['id']

        if env_name:
            environment = get_environment(org_name, env_name)
            env_id = environment["id"]
        else:
            env_id = None

        if view_name or view_id or view_label:
            view = get_content_view(org_name, view_label, view_name, view_id)
            view_id = view["id"]
        else:
            view_id = None

        group = self.api.update_systems(org_name, system_group_id, env_id,
                                        view_id)

        if group:
            print (_("Successfully updated systems in group [ %s ]" % group["name"]))
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 6
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')
        job_id = self.get_option('job_id')

        self.printer.set_header(
            _("System Group Job tasks For [ %s ]") % (system_group_name))

        system_group = get_system_group(org_name, system_group_name)

        # get list of jobs
        history = self.api.system_group_history(org_name, system_group['id'],
                                                {'job_id': job_id})
        if len(history) == 0:
            print >> sys.stderr, _(
                "Could not find job [ %s ] for system group [ %s ]") % (
                    job_id, system_group_name)
            return os.EX_DATAERR

        tasks = history[0]['tasks']

        self.printer.add_column('id', name='task id')
        self.printer.add_column('uuid', name='system uuid')
        self.printer.add_column('state', )
        self.printer.add_column('progress')
        self.printer.add_column('start_time')
        self.printer.add_column('finish_time')
        self.printer.print_items(tasks)
Exemplo n.º 7
0
    def run(self):
        org_name = self.get_option('org')
        group_name = self.get_option('name')
        install = self.get_option('install')

        job = None

        system_group = get_system_group(org_name, group_name)
        system_group_id = system_group['id']

        if install:
            job = self.api.install_errata(org_name, system_group_id, install)

        if job:
            job_id = job["id"]
            print (_("Performing remote action [ %s ]... ") % job_id)
            job = SystemGroupAsyncJob(org_name, system_group_id, job)
            run_spinner_in_bg(wait_for_async_task, [job])
            if job.succeeded():
                print _("Remote action finished:")
                print job.get_status_message()
                return os.EX_OK
            else:
                print _("Remote action failed:")
                print job.get_status_message()
                return os.EX_DATAERR

        return os.EX_OK
Exemplo n.º 8
0
    def run(self):
        org_name = self.get_option('org')
        group_name = self.get_option('name')
        env_name = self.get_option('environment')
        view_label = self.get_option('view_label')
        view_id = self.get_option('view_id')
        view_name = self.get_option('view_name')

        system_group = get_system_group(org_name, group_name)
        system_group_id = system_group['id']

        if env_name:
            environment = get_environment(org_name, env_name)
            env_id = environment["id"]
        else:
            env_id = None

        if view_name or view_id or view_label:
            view = get_content_view(org_name, view_label, view_name, view_id)
            view_id = view["id"]
        else:
            view_id = None

        group = self.api.update_systems(org_name, system_group_id, env_id,
                                        view_id)

        if group:
            print(
                _("Successfully updated systems in group [ %s ]" %
                  group["name"]))
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 9
0
    def run(self):
        org_name = self.get_option('org')
        name = self.get_option('name')

        system_group = get_system_group(org_name, name)

        message = self.api.delete(org_name, system_group["id"])
        if message != None:
            print message
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 10
0
    def run(self):
        org_name = self.get_option('org')
        name = self.get_option('name')

        system_group = get_system_group(org_name, name)

        message = self.api.delete(org_name, system_group["id"])
        if message != None:
            print message
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 11
0
    def run(self):
        org_name = self.get_option('org')
        name = self.get_option('name')
        system_ids = self.get_option('system_uuids')

        system_group = get_system_group(org_name, name)

        # confirm that the requested systems exist
        get_systems(org_name, system_ids)

        # retrieve the current system group members
        systems = self.api.system_group_systems(org_name, system_group['id'])
        initial_system_ids = [system['id'] for system in systems]

        # filter out systems that aren't currently members, so that only
        # existing members are removed
        remove_system_ids = []
        non_existing_system_ids = []
        for system_id in system_ids:
            if system_id not in initial_system_ids:
                non_existing_system_ids.append(system_id)
            else:
                remove_system_ids.append(system_id)

        if len(remove_system_ids) == 0:
            system_id_str = ', '.join(system_id for system_id in non_existing_system_ids)
            print _("Systems [ %(system_uuids)s ] are not members of the " \
                "system group; therefore, no changes were made to system group " \
                "[ %(system_group_name)s ].") % \
                {'system_uuids':system_id_str, 'system_group_name':system_group['name']}

            return os.EX_OK

        else:

            systems = self.api.remove_systems(org_name, system_group["id"], system_ids)

            if systems is not None:
                system_id_str = ', '.join(system_id for system_id in remove_system_ids)
                print _("Successfully removed systems [ %(system_uuids)s ] from " \
                    "system group [ %(system_group_name)s ].") % \
                    {'system_uuids':system_id_str, 'system_group_name':system_group['name']}

                if len(non_existing_system_ids) > 0:
                    system_id_str = ', '.join(system_id for system_id in non_existing_system_ids)
                    print _("Note: Systems [ %(system_uuids)s ] were not members " \
                        "of the system group; therefore, no changes were made " \
                        "for them.") % {'system_uuids':system_id_str}

                return os.EX_OK
            else:
                return os.EX_DATAERR
Exemplo n.º 12
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')

        # get system details
        system_group = get_system_group(org_name, system_group_name)
        system_group = self.api.unlock(org_name, system_group["id"])

        if system_group != None:
            print _("Successfully unlocked system group [ %s ]") % system_group['name']
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 13
0
    def run(self):
        org_name = self.get_option('org')
        name = self.get_option('name')
        system_ids = self.get_option('system_uuids')

        system_group = get_system_group(org_name, name)

        systems = self.api.remove_systems(org_name, system_group["id"], system_ids)

        if systems != None:
            print _("Successfully removed systems from system group [ %s ]") % system_group['name']
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 14
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')

        # get system details
        system_group = get_system_group(org_name, system_group_name)
        system_group = self.api.unlock(org_name, system_group["id"])

        if system_group != None:
            print _("Successfully unlocked system group [ %s ]"
                    ) % system_group['name']
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 15
0
    def run(self):
        org_name = self.get_option('org')
        name = self.get_option('name')
        new_name = self.get_option('new_name')
        description = self.get_option('description')
        max_systems = self.get_option('max_systems')
        
        source_system_group = get_system_group(org_name, name)
        new_system_group = self.api.copy(org_name, source_system_group["id"], new_name, description, max_systems)

        test_record(new_system_group,
            _("Successfully copied system group [ %s ] to [ %s ]") % 
                       (source_system_group['name'], new_system_group['name']),
            _("Could not create system group [ %s ]") % new_name
        )
Exemplo n.º 16
0
    def run(self):
        org_name = self.get_option("org")
        name = self.get_option("name")

        system_group = get_system_group(org_name, name)
        if not system_group:
            return os.EX_DATAERR

        message = self.api.delete(org_name, system_group["id"])

        if message != None:
            print message
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 17
0
    def run(self):
        org_name = self.get_option('org')
        group_name = self.get_option('name')

        install = self.get_option('install')
        remove = self.get_option('remove')
        update = self.get_option('update')
        install_groups = self.get_option('install_groups')
        remove_groups = self.get_option('remove_groups')
        update_groups = self.get_option('update_groups')

        job = None

        system_group = get_system_group(org_name, group_name)
        system_group_id = system_group['id']

        if install:
            job = self.api.install_packages(org_name, system_group_id, install)
        if remove:
            job = self.api.remove_packages(org_name, system_group_id, remove)
        if update:
            if update == '--all':
                update_packages = []
            else:
                update_packages = update
            job = self.api.update_packages(org_name, system_group_id, update_packages)
        if install_groups:
            job = self.api.install_package_groups(org_name, system_group_id, install_groups)
        if remove_groups:
            job = self.api.remove_package_groups(org_name, system_group_id, remove_groups)
        if update_groups:
            job = self.api.update_package_groups(org_name, system_group_id, update_groups)

        if job:
            job_id = job["id"]
            print (_("Performing remote action [ %s ]... ") % job_id)
            job = SystemGroupAsyncJob(org_name, system_group_id, job)
            run_spinner_in_bg(wait_for_async_task, [job])
            if job.succeeded():
                print _("Remote action finished:")
                print job.get_status_message()
                return os.EX_OK
            else:
                print _("Remote action failed:")
                print job.get_status_message()
                return os.EX_DATAERR

        return os.EX_OK
Exemplo n.º 18
0
    def run(self):
        org_name = self.get_option('org')
        name = self.get_option('name')
        system_ids = self.get_option('system_uuids')

        system_group = get_system_group(org_name, name)

        systems = self.api.remove_systems(org_name, system_group["id"],
                                          system_ids)

        if systems != None:
            print _("Successfully removed systems from system group [ %s ]"
                    ) % system_group['name']
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 19
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')

        # get system details
        system_group = get_system_group(org_name, system_group_name)

        systems = self.api.system_group_systems(org_name, system_group["id"])
        if systems is None:
            return os.EX_DATAERR

        self.printer.set_header(_("Systems within System Group [ %s ] For Org [ %s ]") % (system_group["name"], org_name))
        self.printer.add_column('id')
        self.printer.add_column('name')
        self.printer.print_items(systems)

        return os.EX_OK
Exemplo n.º 20
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')

        self.printer.set_header(_("System Group Information For Org [ %s ]") % (org_name))

        # get system details
        system_group = get_system_group(org_name, system_group_name)

        self.printer.add_column('id')
        self.printer.add_column('name')
        self.printer.add_column('description', multiline=True)
        self.printer.add_column('total_systems')

        self.printer.print_item(system_group)

        return os.EX_OK
Exemplo n.º 21
0
    def run(self):
        org_name = self.get_option('org')
        name = self.get_option('name')
        new_name = self.get_option('new_name')
        description = self.get_option('description')
        max_systems = self.get_option('max_systems')

        source_system_group = get_system_group(org_name, name)
        new_system_group = self.api.copy(org_name, source_system_group["id"],
                                         new_name, description, max_systems)

        test_record(new_system_group,
            _("Successfully copied system group [ %(source_system_group_name)s ] to [ %(new_system_group_name)s ]") % \
                {'source_system_group_name':source_system_group['name'], \
                'new_system_group_name':new_system_group['name']},
            _("Could not create system group [ %s ]") % new_name
        )
Exemplo n.º 22
0
    def run(self):
        org_name = self.get_option('org')
        group_name = self.get_option('name')

        install = self.get_option('install')
        remove = self.get_option('remove')
        update = self.get_option('update')
        install_groups = self.get_option('install_groups')
        remove_groups = self.get_option('remove_groups')
        update_groups = self.get_option('update_groups')

        job = None

        system_group = get_system_group(org_name, group_name)
        system_group_id = system_group['id']

        if install:
            job = self.api.install_packages(org_name, system_group_id, install)
        if remove:
            job = self.api.remove_packages(org_name, system_group_id, remove)
        if update:
            if update == '--all':
                update_packages = []
            else:
                update_packages = update
            job = self.api.update_packages(org_name, system_group_id,
                                           update_packages)
        if install_groups:
            job = self.api.install_package_groups(org_name, system_group_id,
                                                  install_groups)
        if remove_groups:
            job = self.api.remove_package_groups(org_name, system_group_id,
                                                 remove_groups)
        if update_groups:
            job = self.api.update_package_groups(org_name, system_group_id,
                                                 update_groups)

        if job:
            job_id = job["id"]
            print(_("Performing remote action [ %s ]... ") % job_id)
            job = SystemGroupAsyncJob(org_name, system_group_id, job)
            run_spinner_in_bg(wait_for_async_task, [job])

            return evaluate_remote_action(job)

        return os.EX_OK
Exemplo n.º 23
0
    def run(self):
        org_name = self.get_option('org')
        name = self.get_option('name')
        new_name = self.get_option('new_name')
        new_description = self.get_option('new_description')
        max_systems = self.get_option('max_systems')

        system_group = get_system_group(org_name, name)


        system_group = self.api.update(org_name, system_group["id"], new_name, new_description, max_systems)

        if system_group != None:
            print _("Successfully updated system group [ %s ]") % system_group['name']
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 24
0
    def run(self):
        org_name = self.get_option("org")
        system_group_name = self.get_option("name")
        # info is always grep friendly

        # get system details
        system_group = get_system_group(org_name, system_group_name)
        if not system_group:
            return os.EX_DATAERR

        system_group = self.api.unlock(org_name, system_group["id"])

        if system_group != None:
            print _("Successfully unlocked system group [ %s ]") % system_group["name"]
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 25
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')

        self.printer.set_header(
            _("System Group Information For Org [ %s ]") % (org_name))

        # get system details
        system_group = get_system_group(org_name, system_group_name)

        self.printer.add_column('id')
        self.printer.add_column('name')
        self.printer.add_column('description', multiline=True)
        self.printer.add_column('locked')

        self.printer.print_item(system_group)

        return os.EX_OK
Exemplo n.º 26
0
    def run(self):
        org_name = self.get_option('org')
        name = self.get_option('name')
        new_name = self.get_option('new_name')
        new_description = self.get_option('new_description')
        max_systems = self.get_option('max_systems')

        system_group = get_system_group(org_name, name)

        system_group = self.api.update(org_name, system_group["id"], new_name,
                                       new_description, max_systems)

        if system_group != None:
            print _("Successfully updated system group [ %s ]"
                    ) % system_group['name']
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 27
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')

        # get system details
        system_group = get_system_group(org_name, system_group_name)

        systems = self.api.system_group_systems(org_name, system_group["id"])
        if systems is None:
            return os.EX_DATAERR

        self.printer.set_header(
            _("Systems within System Group [ %s ] For Org [ %s ]") %
            (system_group["name"], org_name))
        self.printer.add_column('id')
        self.printer.add_column('name')
        self.printer.print_items(systems)

        return os.EX_OK
Exemplo n.º 28
0
    def run(self):
        org_name = self.get_option("org")
        name = self.get_option("name")
        system_ids = self.get_option("system_uuids")

        system_group = get_system_group(org_name, name)

        if system_group is None:
            return os.EX_DATAERR

        system_ids = [uuid for uuid in system_ids.split(",")]

        systems = self.api.remove_systems(org_name, system_group["id"], system_ids)

        if systems != None:
            print _("Successfully removed systems from system group [ %s ]") % system_group["name"]
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 29
0
    def run(self):
        org_name = self.get_option("org")
        name = self.get_option("name")
        new_name = self.get_option("new_name")
        new_description = self.get_option("new_description")
        max_systems = self.get_option("max_systems")

        system_group = get_system_group(org_name, name)

        if system_group is None:
            return os.EX_DATAERR

        system_group = self.api.update(org_name, system_group["id"], new_name, new_description, max_systems)

        if system_group != None:
            print _("Successfully updated system group [ %s ]") % system_group["name"]
            return os.EX_OK
        else:
            return os.EX_DATAERR
Exemplo n.º 30
0
    def run(self):
        org_name = self.get_option('org')
        group_name = self.get_option('name')

        install = self.get_option('install')
        remove = self.get_option('remove')
        update = self.get_option('update')
        install_groups = self.get_option('install_groups')
        remove_groups = self.get_option('remove_groups')
        update_groups = self.get_option('update_groups')

        job = None

        system_group = get_system_group(org_name, group_name)
        system_group_id = system_group['id']

        if install:
            job = self.api.install_packages(org_name, system_group_id, install)
        if remove:
            job = self.api.remove_packages(org_name, system_group_id, remove)
        if update:
            if update.count('--all') > 0:
                update_packages = "all"
            else:
                update_packages = update
            job = self.api.update_packages(org_name, system_group_id, update_packages)
        if install_groups:
            job = self.api.install_package_groups(org_name, system_group_id, install_groups)
        if remove_groups:
            job = self.api.remove_package_groups(org_name, system_group_id, remove_groups)
        if update_groups:
            job = self.api.update_package_groups(org_name, system_group_id, update_groups)

        if job:
            job_id = job["id"]
            print (_("Performing remote action [ %s ]... ") % job_id)
            job = SystemGroupAsyncJob(org_name, system_group_id, job)
            run_spinner_in_bg(wait_for_async_task, [job])

            return evaluate_remote_action(job)

        return os.EX_OK
Exemplo n.º 31
0
    def run(self):
        systemGroupApi = SystemGroupAPI()

        org_name = self.get_option('org')
        group_name = self.get_option('name')
        type_in = self.get_option('type')

        system_group = get_system_group(org_name, group_name)
        system_group_id = system_group['id']

        errata = systemGroupApi.errata(org_name, system_group_id, type_in=type_in)

        batch_add_columns(self.printer, 'id', 'title', 'type')
        self.printer.add_column('systems', _('# Systems'), formatter=len)
        self.printer.add_column('systems', multiline=True, show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Errata for system group %s in organization %s") % (group_name, org_name))
        self.printer.print_items(errata)

        return os.EX_OK
Exemplo n.º 32
0
    def run(self):
        org_name = self.get_option("org")
        system_group_name = self.get_option("name")
        # info is always grep friendly

        self.printer.set_header(_("System Group Information For Org [ %s ]") % (org_name))

        # get system details
        system_group = get_system_group(org_name, system_group_name)

        if not system_group:
            return os.EX_DATAERR

        self.printer.add_column("id")
        self.printer.add_column("name")
        self.printer.add_column("description", multiline=True)
        self.printer.add_column("locked")

        self.printer.printItem(system_group)

        return os.EX_OK
Exemplo n.º 33
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')

        self.printer.set_header(
            _("System Group Information For Org [ %s ]") % (org_name))

        # get system details
        system_group = get_system_group(org_name, system_group_name)

        self.printer.add_column('id', _("ID"))
        self.printer.add_column('name', _("Name"))
        self.printer.add_column('description',
                                _("Description"),
                                multiline=True)
        self.printer.add_column('max_systems', _("Max Systems"))
        self.printer.add_column('total_systems', _("Total Systems"))

        self.printer.print_item(system_group)

        return os.EX_OK
Exemplo n.º 34
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')
        job_id = self.get_option('job_id')

        self.printer.set_header(_("System Group Job tasks For [ %s ]") % (system_group_name))

        system_group = get_system_group(org_name, system_group_name)

        # get list of jobs
        history = self.api.system_group_history(org_name, system_group['id'], job_id)
        if history == None:
            print >> sys.stderr, _("Could not find job [ %s ] for system group [ %s ]") % (job_id, system_group_name)
            return os.EX_DATAERR

        tasks = history['tasks']

        self.printer.add_column('id', name='task id')
        self.printer.add_column('uuid', name='system uuid')
        batch_add_columns(self.printer, 'state', 'progress', 'start_time', 'finish_time')
        self.printer.print_items(tasks)
Exemplo n.º 35
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')
        job_id = self.get_option('job_id')

        self.printer.set_header(_("System Group Job tasks For [ %s ]") % (system_group_name))

        system_group = get_system_group(org_name, system_group_name)

        # get list of jobs
        history = self.api.system_group_history(org_name, system_group['id'], job_id)
        if history == None:
            print >> sys.stderr, _("Could not find job [ %(job_id)s ] for system group [ %(system_group_name)s ]") \
                % {'job_id':job_id, 'system_group_name':system_group_name}
            return os.EX_DATAERR

        tasks = history['tasks']

        batch_add_columns(self.printer, {'id': _("Task ID")}, {'uuid': _("System UUID")}, \
            {'state': _("State")}, {'progress': _("Progress")}, {'start_time': _("Start Time")}, \
            {'finish_time': _("Finish Time")})
        self.printer.print_items(tasks)
Exemplo n.º 36
0
    def run(self):
        org_name = self.get_option('org')
        group_name = self.get_option('name')
        install = self.get_option('install')

        job = None

        system_group = get_system_group(org_name, group_name)
        system_group_id = system_group['id']

        if install:
            job = self.api.install_errata(org_name, system_group_id, install)

        if job:
            job_id = job["id"]
            print (_("Performing remote action [ %s ]... ") % job_id)
            job = SystemGroupAsyncJob(org_name, system_group_id, job)
            run_spinner_in_bg(wait_for_async_task, [job])

            return evaluate_remote_action(job)

        return os.EX_OK
Exemplo n.º 37
0
    def run(self):
        org_name = self.get_option('org')
        group_name = self.get_option('name')
        install = self.get_option('install')

        job = None

        system_group = get_system_group(org_name, group_name)
        system_group_id = system_group['id']

        if install:
            job = self.api.install_errata(org_name, system_group_id, install)

        if job:
            job_id = job["id"]
            print(_("Performing remote action [ %s ]... ") % job_id)
            job = SystemGroupAsyncJob(org_name, system_group_id, job)
            run_spinner_in_bg(wait_for_async_task, [job])

            return evaluate_remote_action(job)

        return os.EX_OK
Exemplo n.º 38
0
    def run(self):
        systemGroupApi = SystemGroupAPI()

        org_name = self.get_option("org")
        group_name = self.get_option("name")
        type_in = self.get_option("type")

        system_group = get_system_group(org_name, group_name)
        system_group_id = system_group["id"]

        errata = systemGroupApi.errata(org_name, system_group_id, type_in=type_in)

        batch_add_columns(self.printer, {"id": _("ID")}, {"title": _("Title")}, {"type": _("Type")})
        self.printer.add_column("systems", _("# Systems"), formatter=len)
        self.printer.add_column("systems", _("Systems"), multiline=True, show_with=printer.VerboseStrategy)

        self.printer.set_header(
            _("Errata for system group %(org_name)s in organization %(org_name)s")
            % {"group_name": group_name, "org_name": org_name}
        )
        self.printer.print_items(errata)

        return os.EX_OK
Exemplo n.º 39
0
    def run(self):
        systemGroupApi = SystemGroupAPI()

        org_name = self.get_option('org')
        group_name = self.get_option('name')
        type_in = self.get_option('type')

        system_group = get_system_group(org_name, group_name)
        system_group_id = system_group['id']

        errata = systemGroupApi.errata(org_name, system_group_id, type_in=type_in)
        for erratum in errata:
            erratum['applicable_consumers'] = [x['name'] for x in erratum['applicable_consumers']]


        batch_add_columns(self.printer, {'errata_id': _("ID")}, {'title': _("Title")}, {'type': _("Type")})
        self.printer.add_column('applicable_consumers', _('# Systems'), formatter=len)
        self.printer.add_column('applicable_consumers', _("Systems"), multiline=True, show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Errata for system group %(org_name)s in organization %(org_name)s")
            % {'group_name':group_name, 'org_name':org_name})
        self.printer.print_items(errata)

        return os.EX_OK
Exemplo n.º 40
0
    def run(self):
        org_name = self.get_option('org')
        system_group_name = self.get_option('name')
        job_id = self.get_option('job_id')

        self.printer.set_header(
            _("System Group Job tasks For [ %s ]") % (system_group_name))

        system_group = get_system_group(org_name, system_group_name)

        # get list of jobs
        history = self.api.system_group_history(org_name, system_group['id'],
                                                job_id)
        if history == None:
            print >> sys.stderr, _("Could not find job [ %(job_id)s ] for system group [ %(system_group_name)s ]") \
                % {'job_id':job_id, 'system_group_name':system_group_name}
            return os.EX_DATAERR

        tasks = history['tasks']

        batch_add_columns(self.printer, {'id': _("Task ID")}, {'uuid': _("System UUID")}, \
            {'state': _("State")}, {'progress': _("Progress")}, {'start_time': _("Start Time")}, \
            {'finish_time': _("Finish Time")})
        self.printer.print_items(tasks)