示例#1
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
示例#2
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