Example #1
0
    def run(self):
        orgName = self.get_option('org')
        envName = self.get_option('environment')
        csName = self.get_option('name')
        displayDeps = self.has_option('deps')

        cset = get_changeset(orgName, envName, csName)

        cset['environment_name'] = envName

        cset["errata"] = self.format_item_list("display_name", cset["errata"])
        cset["products"] = self.format_item_list("name", cset["products"])
        cset["packages"] = self.format_item_list("display_name", cset["packages"])
        cset["repositories"] = self.format_item_list("name", cset["repos"])
        cset["content_views"] = self.format_item_list("label", cset["content_views"])
        cset["distributions"] = self.format_item_list("distribution_id", cset["distributions"])
        if displayDeps:
            cset["dependencies"] = self.get_dependencies(cset["id"])
        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")}, {'action_type': _("Action Type")})
        self.printer.add_column('description', _("Description"), multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column('updated_at', _("Last Updated"), formatter=format_date)
        batch_add_columns(self.printer, {'state': _("State")}, \
            {'environment_id': _("Environment ID")}, {'environment_name': _("Environment Name")})
        batch_add_columns(self.printer, {'errata': _("Errata")}, {'products': _("Products")}, \
            {'packages': _("Packages")}, {'repositories': _("Repositories")}, \
            {'distributions': _("Distributions")}, {'content_views': _("Content Views")}, \
            multiline=True, show_with=printer.VerboseStrategy)
        if displayDeps:
            self.printer.add_column('dependencies', _("Dependencies"), \
                multiline=True, show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Changeset Info"))
        self.printer.print_item(cset)

        return os.EX_OK
Example #2
0
    def run(self):
        #reset stored patch items (neccessary for shell mode)
        items = self.items.copy()
        self.reset_items()

        csName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('environment')
        csNewName = self.get_option('new_name')
        csDescription = self.get_option('description')

        cset = get_changeset(orgName, envName, csName)
        csType = cset['action_type']

        self.update(cset["id"], csNewName, csDescription)
        addPatch = self.PatchBuilder.build_patch('add',
            self.AddPatchItemBuilder(orgName, envName, csType), items)
        removePatch = self.PatchBuilder.build_patch('remove',
            self.RemovePatchItemBuilder(orgName, envName, csType), items)

        self.update_content(cset["id"], addPatch, self.api.add_content)
        self.update_content(cset["id"], removePatch, self.api.remove_content)

        print _("Successfully updated changeset [ %s ]") % csName
        return os.EX_OK
Example #3
0
    def run(self):
        #reset stored patch items (neccessary for shell mode)
        items = self.items.copy()
        self.reset_items()

        csName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('environment')
        csNewName = self.get_option('new_name')
        csDescription = self.get_option('description')

        cset = get_changeset(orgName, envName, csName)
        csType = cset['action_type']

        self.update(cset["id"], csNewName, csDescription)
        addPatch = self.PatchBuilder.build_patch(
            'add', self.AddPatchItemBuilder(orgName, envName, csType), items)
        removePatch = self.PatchBuilder.build_patch(
            'remove', self.RemovePatchItemBuilder(orgName, envName, csType),
            items)

        self.update_content(cset["id"], addPatch, self.api.add_content)
        self.update_content(cset["id"], removePatch, self.api.remove_content)

        print _("Successfully updated changeset [ %s ]") % csName
        return os.EX_OK
Example #4
0
    def run(self):
        orgName = self.get_option('org')
        envName = self.get_option('env')
        csName = self.get_option('name')
        displayDeps = self.has_option('deps')

        cset = get_changeset(orgName, envName, csName)

        cset['environment_name'] = envName

        cset["errata"] = self.format_item_list("display_name", cset["errata"])
        cset["products"] = self.format_item_list("name", cset["products"])
        cset["packages"] = self.format_item_list("display_name",
                                                 cset["packages"])
        cset["repositories"] = self.format_item_list("name", cset["repos"])
        cset["system_templates"] = self.format_item_list(
            "name", cset["system_templates"])
        cset["distributions"] = self.format_item_list("distribution_id",
                                                      cset["distributions"])
        if displayDeps:
            cset["dependencies"] = self.get_dependencies(cset["id"])

        self.printer.add_column('id')
        self.printer.add_column('name')
        self.printer.add_column('description',
                                multiline=True,
                                show_with=printer.VerboseStrategy)
        self.printer.add_column('updated_at', formatter=format_date)
        self.printer.add_column('state')
        self.printer.add_column('environment_id')
        self.printer.add_column('environment_name')
        self.printer.add_column('errata',
                                multiline=True,
                                show_with=printer.VerboseStrategy)
        self.printer.add_column('products',
                                multiline=True,
                                show_with=printer.VerboseStrategy)
        self.printer.add_column('packages',
                                multiline=True,
                                show_with=printer.VerboseStrategy)
        self.printer.add_column('repositories',
                                multiline=True,
                                show_with=printer.VerboseStrategy)
        self.printer.add_column('system_templates',
                                multiline=True,
                                show_with=printer.VerboseStrategy)
        self.printer.add_column('distributions',
                                multiline=True,
                                show_with=printer.VerboseStrategy)
        if displayDeps:
            self.printer.add_column('dependencies',
                                    multiline=True,
                                    show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Changeset Info"))
        self.printer.print_item(cset)

        return os.EX_OK
Example #5
0
    def run(self):
        csName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('environment')

        cset = get_changeset(orgName, envName, csName)

        msg = self.api.delete(cset["id"])
        print msg
        return os.EX_OK
Example #6
0
    def run(self):
        csName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('env')

        cset = get_changeset(orgName, envName, csName)

        msg = self.api.delete(cset["id"])
        print msg
        return os.EX_OK
Example #7
0
    def run(self):
        csName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('env')

        cset = get_changeset(orgName, envName, csName)
        if cset == None:
            return os.EX_DATAERR

        msg = self.api.delete(cset["id"])
        print msg
        return os.EX_OK
Example #8
0
    def run(self):
        csName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('environment')

        # Block attempts to call this on deletion changesets, otherwise continue
        cset = get_changeset(orgName, envName, csName)
        if 'type' in cset and cset['type'] == constants.DELETION:
            print _("This is a deletion changeset and does not support promotion")
            return os.EX_DATAERR

        super(Promote, self).run()
Example #9
0
    def run(self):
        csName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('environment')

        # Block attempts to call this on deletion changesets, otherwise continue
        cset = get_changeset(orgName, envName, csName)
        if 'type' in cset and cset['type'] == constants.DELETION:
            print _(
                "This is a deletion changeset and does not support promotion")
            return os.EX_DATAERR

        super(Promote, self).run()
Example #10
0
    def run(self):
        csName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('environment')

        cset = get_changeset(orgName, envName, csName)

        task = self.api.apply(cset["id"])
        task = AsyncTask(task)

        run_spinner_in_bg(wait_for_async_task, [task], message=_("Applying the changeset, please wait... "))

        return evaluate_task_status(task,
            failed = _("Changeset [ %s ] promotion failed") % csName,
            ok =     _("Changeset [ %s ] applied") % csName
        )
Example #11
0
    def run(self):
        csName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('environment')

        cset = get_changeset(orgName, envName, csName)

        task = self.api.apply(cset["id"])
        task = AsyncTask(task)

        run_spinner_in_bg(wait_for_async_task, [task],
                          message=_("Applying the changeset, please wait... "))

        return evaluate_task_status(
            task,
            failed=_("Changeset [ %s ] promotion failed") % csName,
            ok=_("Changeset [ %s ] applied") % csName)
Example #12
0
    def run(self):
        csName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('env')

        cset = get_changeset(orgName, envName, csName)

        task = self.api.promote(cset["id"])
        task = AsyncTask(task)

        run_spinner_in_bg(wait_for_async_task, [task], message=_("Promoting the changeset, please wait... "))

        if task.succeeded():
            print _("Changeset [ %s ] promoted" % csName)
            return os.EX_OK
        else:
            print _("Changeset [ %s ] promotion failed: %s" % (csName, format_task_errors(task.errors())))
            return os.EX_DATAERR
Example #13
0
    def run(self):
        orgName = self.get_option('org')
        envName = self.get_option('environment')
        csName = self.get_option('name')
        displayDeps = self.has_option('deps')

        cset = get_changeset(orgName, envName, csName)

        cset['environment_name'] = envName

        cset["errata"] = self.format_item_list("display_name", cset["errata"])
        cset["products"] = self.format_item_list("name", cset["products"])
        cset["packages"] = self.format_item_list("display_name",
                                                 cset["packages"])
        cset["repositories"] = self.format_item_list("name", cset["repos"])
        cset["content_views"] = self.format_item_list("name",
                                                      cset["content_views"])
        cset["distributions"] = self.format_item_list("distribution_id",
                                                      cset["distributions"])
        if displayDeps:
            cset["dependencies"] = self.get_dependencies(cset["id"])
        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")},
                          {'action_type': _("Action Type")})
        self.printer.add_column('description',
                                _("Description"),
                                multiline=True,
                                show_with=printer.VerboseStrategy)
        self.printer.add_column('updated_at',
                                _("Last Updated"),
                                formatter=format_date)
        batch_add_columns(self.printer, {'state': _("State")}, \
            {'environment_id': _("Environment ID")}, {'environment_name': _("Environment Name")})
        batch_add_columns(self.printer, {'errata': _("Errata")}, {'products': _("Products")}, \
            {'packages': _("Packages")}, {'repositories': _("Repositories")}, \
            {'distributions': _("Distributions")}, {'content_views': _("Content Views")}, \
            multiline=True, show_with=printer.VerboseStrategy)
        if displayDeps:
            self.printer.add_column('dependencies', _("Dependencies"), \
                multiline=True, show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Changeset Info"))
        self.printer.print_item(cset)

        return os.EX_OK
Example #14
0
    def run(self):
        csName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('environment')

        cset = get_changeset(orgName, envName, csName)

        task = self.api.apply(cset["id"])
        task = AsyncTask(task)

        run_spinner_in_bg(wait_for_async_task, [task], message=_("Applying the changeset, please wait... "))

        if task.succeeded():
            print _("Changeset [ %s ] applied" % csName)
            return os.EX_OK
        else:
            print _("Changeset [ %(csName)s ] promotion failed: %(task_errors)s" \
                % {'csName':csName, 'task_errors':format_task_errors(task.errors())})
            return os.EX_DATAERR
Example #15
0
    def run(self):
        orgName = self.get_option('org')
        envName = self.get_option('env')
        csName = self.get_option('name')
        displayDeps = self.has_option('deps')

        cset = get_changeset(orgName, envName, csName)
        if cset == None:
            return os.EX_DATAERR

        cset['updated_at'] = format_date(cset['updated_at'])
        cset['environment_name'] = envName

        cset["errata"] = self.format_item_list("display_name", cset["errata"])
        cset["products"] = self.format_item_list("name", cset["products"])
        cset["packages"] = self.format_item_list("display_name", cset["packages"])
        cset["repositories"] = self.format_item_list("name", cset["repos"])
        cset["system_templates"] = self.format_item_list("name", cset["system_templates"])
        cset["distributions"] = self.format_item_list("distribution_id", cset["distributions"])
        if displayDeps:
            cset["dependencies"] = self.get_dependencies(cset["id"])

        self.printer.addColumn('id')
        self.printer.addColumn('name')
        self.printer.addColumn('description', multiline=True, show_in_grep=False)
        self.printer.addColumn('updated_at')
        self.printer.addColumn('state')
        self.printer.addColumn('environment_id')
        self.printer.addColumn('environment_name')
        self.printer.addColumn('errata', multiline=True, show_in_grep=False)
        self.printer.addColumn('products', multiline=True, show_in_grep=False)
        self.printer.addColumn('packages', multiline=True, show_in_grep=False)
        self.printer.addColumn('repositories', multiline=True, show_in_grep=False)
        self.printer.addColumn('system_templates', multiline=True, show_in_grep=False)
        self.printer.addColumn('distributions', multiline=True, show_in_grep=False)
        if displayDeps:
            self.printer.addColumn('dependencies', multiline=True, show_in_grep=False)

        self.printer.setHeader(_("Changeset Info"))
        self.printer.printItem(cset)

        return os.EX_OK
Example #16
0
    def run(self):
        csName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('env')

        cset = get_changeset(orgName, envName, csName)

        task = self.api.promote(cset["id"])
        task = AsyncTask(task)

        run_spinner_in_bg(
            wait_for_async_task, [task],
            message=_("Promoting the changeset, please wait... "))

        if task.succeeded():
            print _("Changeset [ %s ] promoted" % csName)
            return os.EX_OK
        else:
            print _("Changeset [ %s ] promotion failed: %s" %
                    (csName, format_task_errors(task.errors())))
            return os.EX_DATAERR
Example #17
0
    def run(self):
        orgName = self.get_option('org')
        envName = self.get_option('environment')
        csName = self.get_option('name')
        displayDeps = self.has_option('deps')

        cset = get_changeset(orgName, envName, csName)

        cset['environment_name'] = envName

        cset["errata"] = self.format_item_list("display_name", cset["errata"])
        cset["products"] = self.format_item_list("name", cset["products"])
        cset["packages"] = self.format_item_list("display_name", cset["packages"])
        cset["repositories"] = self.format_item_list("name", cset["repos"])
        cset["system_templates"] = self.format_item_list("name", cset["system_templates"])
        cset["distributions"] = self.format_item_list("distribution_id", cset["distributions"])
        if displayDeps:
            cset["dependencies"] = self.get_dependencies(cset["id"])

        self.printer.add_column('id')
        self.printer.add_column('name')
        self.printer.add_column('action_type')
        self.printer.add_column('description', multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column('updated_at', formatter=format_date)
        self.printer.add_column('state')
        self.printer.add_column('environment_id')
        self.printer.add_column('environment_name')
        self.printer.add_column('errata', multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column('products', multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column('packages', multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column('repositories', multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column('system_templates', multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column('distributions', multiline=True, show_with=printer.VerboseStrategy)
        if displayDeps:
            self.printer.add_column('dependencies', multiline=True, show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Changeset Info"))
        self.printer.print_item(cset)

        return os.EX_OK
Example #18
0
    def run(self):
        orgName = self.get_option('org')
        envName = self.get_option('environment')
        csName = self.get_option('name')

        cset = get_changeset(orgName, envName, csName)

        cset['environment_name'] = envName
        cset["content_views"] = self.format_item_list("name", cset["content_views"])

        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")}, {'action_type': _("Action Type")})
        self.printer.add_column('description', _("Description"), multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column('updated_at', _("Last Updated"), formatter=format_date)
        batch_add_columns(self.printer, {'state': _("State")}, \
            {'environment_id': _("Environment ID")}, {'environment_name': _("Environment Name")})
        batch_add_columns(self.printer, {'content_views': _("Content Views")},
            multiline=True, show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Changeset Info"))
        self.printer.print_item(cset)

        return os.EX_OK