Example #1
0
    def run(self):
        packId   = self.get_option('id')
        repoId   = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName  = self.get_option('org')
        envName  = self.get_option('env')
        prodName = self.get_option('product')

        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            if repo == None:
                return os.EX_DATAERR
            repoId = repo["id"]

        pack = self.api.package(packId, repoId)

        self.printer.addColumn('id')
        self.printer.addColumn('name')
        self.printer.addColumn('filename')
        self.printer.addColumn('arch')
        self.printer.addColumn('release')
        self.printer.addColumn('version')
        self.printer.addColumn('vendor')
        self.printer.addColumn('download_url', show_in_grep=False)
        self.printer.addColumn('description', multiline=True, show_in_grep=False)
        self.printer.addColumn('provides', multiline=True, show_in_grep=False)
        self.printer.addColumn('requires', multiline=True, show_in_grep=False)

        self.printer.setHeader(_("Package Information"))
        self.printer.printItem(pack)
        return os.EX_OK
Example #2
0
    def run(self):
        packId   = self.get_option('id')
        repoId   = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName  = self.get_option('org')
        envName  = self.get_option('environment')
        prodName = self.get_option('product')
        prodLabel = self.get_option('product_label')
        prodId   = self.get_option('product_id')
        viewName = self.get_option('view_name')
        viewLabel = self.get_option('view_label')
        viewId = self.get_option('view_id')

        if not repoId:
            repo = get_repo(orgName, repoName, prodName, prodLabel, prodId, envName, False,
                            viewName, viewLabel, viewId)
            repoId = repo["id"]

        pack = self.api.package(packId, repoId)

        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")}, \
            {'filename': _("Filename")}, {'arch': _("Arch")}, {'release': _("Release")}, \
            {'version': _("Version")}, {'vendor': _("Vendor")})
        self.printer.add_column('download_url', _("Download URL"), show_with=printer.VerboseStrategy)
        batch_add_columns(self.printer, {'description': _("Description")}, \
            {'provides': _("Provides")}, {'requires': _("Requires")}, multiline=True, \
            show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Package Information"))
        self.printer.print_item(pack)
        return os.EX_OK
Example #3
0
    def run(self):
        repo_id   = self.get_option('repo_id')
        repo_name = self.get_option('repo')
        org_name  = self.get_option('org')
        env_name  = self.get_option('env')
        env_id, prod_id = None, None
        prod_name = self.get_option('product')

        self.printer.add_column('id')
        self.printer.add_column('title')
        self.printer.add_column('type')

        if not repo_id:
            if repo_name:
                repo = get_repo(org_name, prod_name, repo_name, env_name)
                repo_id = repo["id"]
            else:
                env = get_environment(org_name, env_name)
                env_id = env["id"]
                if prod_name:
                    product = get_product(org_name, prod_name)
                    prod_id = product["id"]


        errata = self.api.errata_filter(repo_id=repo_id, environment_id=env_id, type=self.get_option('type'), severity=self.get_option('severity'),prod_id=prod_id)

        self.printer.set_header(_("Errata List"))
        self.printer.print_items(errata)
        return os.EX_OK
Example #4
0
    def run(self):
        errId    = self.get_option('id')
        repoId   = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName  = self.get_option('org')
        envName  = self.get_option('env')
        prodName = self.get_option('product')

        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            repoId = repo["id"]

        pack = self.api.errata(errId, repoId)

        pack['affected_packages'] = [u_str(pinfo['filename'])
                         for pkg in pack['pkglist']
                         for pinfo in pkg['packages']]

        self.printer.add_column('id')
        self.printer.add_column('title')
        self.printer.add_column('description', multiline=True)
        self.printer.add_column('type')
        self.printer.add_column('issued')
        self.printer.add_column('updated')
        self.printer.add_column('version')
        self.printer.add_column('release')
        self.printer.add_column('status')
        self.printer.add_column('reboot_suggested')
        self.printer.add_column('affected_packages', multiline=True)

        self.printer.set_header(_("Errata Information"))
        self.printer.print_item(pack)
        return os.EX_OK
Example #5
0
    def run(self):
        repo_id = self.get_option('repo_id')
        repo_name = self.get_option('repo')
        org_name = self.get_option('org')
        env_name = self.get_option('environment')
        prod_name = self.get_option('product')
        prod_label = self.get_option('product_label')
        prod_id = self.get_option('product_id')
        filepath = self.get_option("filepath")
        content_type = self.get_option("content_type")
        chunk = self.get_option("chunk")

        if not repo_id:
            repo = get_repo(org_name, repo_name, prod_name, prod_label, prod_id, env_name, False)
            repo_id = repo["id"]

        paths = []
        if os.path.isdir(filepath):
            for dirname, __, filenames in os.walk(filepath):
                paths = [os.path.join(dirname, filename) for filename in filenames]
        elif os.path.isfile(filepath):
            paths = [filepath]
        else:
            print _("Invalid path '%s'.") % filepath
            return os.EX_DATAERR

        for path in paths:
            try:
                self.send_file(path, repo_id, content_type, chunk)
            except FileUploadError:
                if len(paths) > 1:
                    print _("Skipping file '%s'.") % path

        return os.EX_OK
Example #6
0
    def run(self):
        repoId   = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName  = self.get_option('org')
        envName  = self.get_option('env')
        prodName = self.get_option('product')

        self.printer.add_column('id')
        self.printer.add_column('name')
        self.printer.add_column('filename')


        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            if repo == None:
                return os.EX_DATAERR
            repoId = repo["id"]


        self.printer.set_header(_("Package List For Repo %s") % repoId)

        packages = self.api.packages_by_repo(repoId)

        self.printer.print_items(packages)
        return os.EX_OK
Example #7
0
    def run(self):
        module_id = self.get_option('id')
        repo_id = self.get_option('repo_id')
        repo_name = self.get_option('repo')
        org_name = self.get_option('org')
        env_name = self.get_option('environment')
        prod_name = self.get_option('product')
        prod_label = self.get_option('product_label')
        prod_id = self.get_option('product_id')
        view_name = self.get_option('view_name')
        view_label = self.get_option('view_label')
        view_id = self.get_option('view_id')

        if not repo_id:
            repo = get_repo(org_name, repo_name, prod_name, prod_label, prod_id, env_name, False,
                            view_name, view_label, view_id)
            repo_id = repo["id"]

        module = self.api.puppet_module(module_id, repo_id)

        batch_add_columns(self.printer, {'_id': _("ID")}, {'name': _("Name")},
                          {'_storage_path': _("Path")}, {'license': _("License")},
                          {'project_page': _("Project page")}, {'version': _("Version")},
                          {'author': _("Author")})
        batch_add_columns(self.printer, {'description': _("Description")},
                          {'summary': _("Summary")}, multiline=True,
                          show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Puppet Module Information"))
        self.printer.print_item(module)
        return os.EX_OK
Example #8
0
    def run(self):
        errId = self.get_option("id")
        repoId = self.get_option("repo_id")
        repoName = self.get_option("repo")
        orgName = self.get_option("org")
        envName = self.get_option("environment")
        prodName = self.get_option("product")
        prodLabel = self.get_option("product_label")
        prodId = self.get_option("product_id")

        if not repoId:
            repo = get_repo(orgName, prodName, prodLabel, prodId, repoName, envName)
            repoId = repo["id"]

        pack = self.api.errata(errId, repoId)

        pack["affected_packages"] = [u_str(pinfo["filename"]) for pkg in pack["pkglist"] for pinfo in pkg["packages"]]

        batch_add_columns(self.printer, {"id": _("ID")}, {"title": _("Title")})
        self.printer.add_column("description", _("Description"), multiline=True)
        batch_add_columns(
            self.printer,
            {"type": _("Type")},
            {"issued": _("Issued")},
            {"updated": _("Updated")},
            {"version": _("Version")},
            {"release": _("Release")},
            {"status": _("Status")},
            {"reboot_suggested": _("Reboot Suggested")},
        )
        self.printer.add_column("affected_packages", _("Affected Packages"), multiline=True)

        self.printer.set_header(_("Errata Information"))
        self.printer.print_item(pack)
        return os.EX_OK
Example #9
0
    def run(self):
        repoId   = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName  = self.get_option('org')
        envName  = self.get_option('environment')
        prodName = self.get_option('product')
        prodLabel = self.get_option('product_label')
        prodId   = self.get_option('product_id')
        viewName = self.get_option('view_name')
        viewLabel = self.get_option('view_label')
        viewId = self.get_option('view_id')

        self.printer.add_column('id', _("ID"))
        self.printer.add_column('description', _("Description"))
        self.printer.add_column('files', _("Files"), multiline=True, show_with=printer.VerboseStrategy)

        if not repoId:
            repo = get_repo(orgName, repoName, prodName, prodLabel, prodId, envName, False,
                            viewName, viewLabel, viewId)
            repoId = repo["id"]

        self.printer.set_header(_("Distribution List For Repo %s") % repoId)

        distributions = self.api.distributions_by_repo(repoId)

        self.printer.print_items(distributions)
        return os.EX_OK
Example #10
0
    def run(self):
        errId     = self.get_option('id')
        repoId    = self.get_option('repo_id')
        repoName  = self.get_option('repo')
        orgName   = self.get_option('org')
        envName   = self.get_option('environment')
        prodName  = self.get_option('product')
        prodLabel = self.get_option('product_label')
        prodId    = self.get_option('product_id')
        viewName  = self.get_option('view_name')
        viewLabel = self.get_option('view_label')
        viewId    = self.get_option('view_id')

        if not repoId:
            repo = get_repo(orgName, repoName, prodName, prodLabel, prodId, envName,
                            viewName, viewLabel, viewId)
            repoId = repo["id"]

        pack = self.api.errata(errId, repoId)

        pack['affected_packages'] = [u_str(pinfo['filename'])
                         for pkg in pack['pkglist']
                         for pinfo in pkg['packages']]

        batch_add_columns(self.printer, {'errata_id': _("ID")}, {'title': _("Title")})
        self.printer.add_column('description', _("Description"), multiline=True)
        batch_add_columns(self.printer, {'type': _("Type")}, {'issued': _("Issued")}, \
            {'updated': _("Updated")}, {'version': _("Version")}, {'release': _("Release")}, \
            {'status': _("Status")}, {'reboot_suggested': _("Reboot Suggested")})
        self.printer.add_column('affected_packages', _("Affected Packages"), multiline=True)

        self.printer.set_header(_("Errata Information"))
        self.printer.print_item(pack)
        return os.EX_OK
Example #11
0
    def run(self):
        repo_id   = self.get_option('repo_id')
        repo_name = self.get_option('repo')
        org_name  = self.get_option('org')
        env_name  = self.get_option('environment')
        env_id, prod_id = None, None
        prod_name = self.get_option('product')

        self.printer.add_column('id')
        self.printer.add_column('title')
        self.printer.add_column('type')

        if not repo_id:
            if repo_name:
                repo = get_repo(org_name, prod_name, repo_name, env_name)
                repo_id = repo["id"]
            else:
                env = get_environment(org_name, env_name)
                env_id = env["id"]
                if prod_name:
                    product = get_product(org_name, prod_name)
                    prod_id = product["id"]


        errata = self.api.errata_filter(repo_id=repo_id, environment_id=env_id, type_in=self.get_option('type'),
            severity=self.get_option('severity'), prod_id=prod_id)

        self.printer.set_header(_("Errata List"))
        self.printer.print_items(errata)
        return os.EX_OK
Example #12
0
    def run(self):
        errId    = self.get_option('id')
        repoId   = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName  = self.get_option('org')
        envName  = self.get_option('environment')
        prodName = self.get_option('product')

        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            repoId = repo["id"]

        pack = self.api.errata(errId, repoId)

        pack['affected_packages'] = [u_str(pinfo['filename'])
                         for pkg in pack['pkglist']
                         for pinfo in pkg['packages']]

        self.printer.add_column('id')
        self.printer.add_column('title')
        self.printer.add_column('description', multiline=True)
        self.printer.add_column('type')
        self.printer.add_column('issued')
        self.printer.add_column('updated')
        self.printer.add_column('version')
        self.printer.add_column('release')
        self.printer.add_column('status')
        self.printer.add_column('reboot_suggested')
        self.printer.add_column('affected_packages', multiline=True)

        self.printer.set_header(_("Errata Information"))
        self.printer.print_item(pack)
        return os.EX_OK
Example #13
0
    def run(self):
        packId = self.get_option("id")
        repoId = self.get_option("repo_id")
        repoName = self.get_option("repo")
        orgName = self.get_option("org")
        envName = self.get_option("environment")
        prodName = self.get_option("product")

        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            repoId = repo["id"]

        pack = self.api.package(packId, repoId)

        self.printer.add_column("id")
        self.printer.add_column("name")
        self.printer.add_column("filename")
        self.printer.add_column("arch")
        self.printer.add_column("release")
        self.printer.add_column("version")
        self.printer.add_column("vendor")
        self.printer.add_column("download_url", show_with=printer.VerboseStrategy)
        self.printer.add_column("description", multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column("provides", multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column("requires", multiline=True, show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Package Information"))
        self.printer.print_item(pack)
        return os.EX_OK
Example #14
0
    def run(self):
        repoId = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName = self.get_option('org')
        envName = self.get_option('environment')
        prodName = self.get_option('product')
        prodLabel = self.get_option('product_label')
        prodId = self.get_option('product_id')
        viewName = self.get_option('view_name')
        viewLabel = self.get_option('view_label')
        viewId = self.get_option('view_id')

        self.printer.add_column('id', _("ID"))
        self.printer.add_column('description', _("Description"))
        self.printer.add_column('files',
                                _("Files"),
                                multiline=True,
                                show_with=printer.VerboseStrategy)

        if not repoId:
            repo = get_repo(orgName, repoName, prodName, prodLabel, prodId,
                            envName, False, viewName, viewLabel, viewId)
            repoId = repo["id"]

        self.printer.set_header(_("Distribution List For Repo %s") % repoId)

        distributions = self.api.distributions_by_repo(repoId)

        self.printer.print_items(distributions)
        return os.EX_OK
Example #15
0
    def run(self):
        packId   = self.get_option('id')
        repoId   = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName  = self.get_option('org')
        envName  = self.get_option('env')
        prodName = self.get_option('product')

        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            repoId = repo["id"]

        pack = self.api.package(packId, repoId)

        self.printer.add_column('id')
        self.printer.add_column('name')
        self.printer.add_column('filename')
        self.printer.add_column('arch')
        self.printer.add_column('release')
        self.printer.add_column('version')
        self.printer.add_column('vendor')
        self.printer.add_column('download_url', show_with=printer.VerboseStrategy)
        self.printer.add_column('description', multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column('provides', multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column('requires', multiline=True, show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Package Information"))
        self.printer.print_item(pack)
        return os.EX_OK
Example #16
0
    def get_repo(self, includeDisabled=False):
        repoId = self.get_option("id")
        repoName = self.get_option("name")
        orgName = self.get_option("org")
        prodName = self.get_option("product")
        prodLabel = self.get_option("product_label")
        prodId = self.get_option("product_id")

        if self.select_by_env:
            envName = self.get_option("environment")
        else:
            envName = None

        if self.select_by_cv:
            view_name = self.get_option("view_name")
            view_label = self.get_option("view_label")
            view_id = self.get_option("view_id")
        else:
            view_name = None
            view_label = None
            view_id = None

        if repoId:
            repo = self.api.repo(repoId)
        else:
            repo = get_repo(
                orgName, repoName, prodName, prodLabel, prodId, envName, includeDisabled, view_name, view_label, view_id
            )

        return repo
Example #17
0
    def run(self):
        packId = self.get_option('id')
        repoId = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName = self.get_option('org')
        envName = self.get_option('environment')
        prodName = self.get_option('product')
        prodLabel = self.get_option('product_label')
        prodId = self.get_option('product_id')
        viewName = self.get_option('view_name')
        viewLabel = self.get_option('view_label')
        viewId = self.get_option('view_id')

        if not repoId:
            repo = get_repo(orgName, repoName, prodName, prodLabel, prodId,
                            envName, False, viewName, viewLabel, viewId)
            repoId = repo["id"]

        pack = self.api.package(packId, repoId)

        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")}, \
            {'filename': _("Filename")}, {'arch': _("Arch")}, {'release': _("Release")}, \
            {'version': _("Version")}, {'vendor': _("Vendor")})
        self.printer.add_column('download_url',
                                _("Download URL"),
                                show_with=printer.VerboseStrategy)
        batch_add_columns(self.printer, {'description': _("Description")}, \
            {'provides': _("Provides")}, {'requires': _("Requires")}, multiline=True, \
            show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Package Information"))
        self.printer.print_item(pack)
        return os.EX_OK
Example #18
0
 def repoNamesToIds(self, orgName, repos):
     ids = []
     for rec in repos:
         repo = get_repo(orgName, rec['product'], rec['name'])
         if repo != None:
             ids.append(repo['id'])
         else:
             system_exit(os.EX_DATAERR)
     return ids
Example #19
0
    def get_repo_id(self):
        repoId = self.get_option("repo_id")
        repoName = self.get_option("repo")
        orgName = self.get_option("org")
        envName = self.get_option("environment")
        prodName = self.get_option("product")

        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            if repo != None:
                repoId = repo["id"]

        return repoId
Example #20
0
    def get_repo_id(self):
        repoId   = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName  = self.get_option('org')
        envName  = self.get_option('env')
        prodName = self.get_option('product')

        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            if repo != None:
                repoId = repo["id"]

        return repoId
Example #21
0
    def get_repo_id(self):
        repoId = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName = self.get_option('org')
        envName = self.get_option('env')
        prodName = self.get_option('product')

        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            if repo != None:
                repoId = repo["id"]

        return repoId
Example #22
0
    def run(self):
        repo_id = self.get_option("repo_id")
        repo_name = self.get_option("repo")
        org_name = self.get_option("org")
        env_name = self.get_option("environment")
        prod_name = self.get_option("product")
        prod_label = self.get_option("product_label")
        prod_id = self.get_option("product_id")
        filepath = self.get_option("filepath")
        content_type = self.get_option("content_type")
        chunk = self.get_option("chunk")

        if not repo_id:
            repo = get_repo(org_name, repo_name, prod_name, prod_label, prod_id, env_name, False)
            repo_id = repo["id"]

        if not self._valid_upload_type(repo_id, content_type):
            return os.EX_DATAERR

        paths = []
        if os.path.isdir(filepath):
            for dirname, __, filenames in os.walk(filepath):
                paths = [os.path.join(dirname, filename) for filename in filenames]
        elif os.path.isfile(filepath):
            paths = [filepath]
        else:
            print _("Invalid path '%s'.") % filepath
            return os.EX_DATAERR

        uploads = []
        for path in paths:
            try:
                upload = self.send_file(path, repo_id, content_type, chunk)
                uploads.append(upload)
            except FileUploadError:
                if len(paths) > 1:
                    print _("Skipping file '%s'.") % path

        if uploads:
            run_spinner_in_bg(
                self.upload_api.import_into_repo, [repo_id, uploads], message=_("Importing content into repository")
            )

            self.remove_uploads(repo_id, uploads)

            print _("Successfully imported content into repository.")
            return os.EX_OK
        else:
            return os.EX_DATAERR
Example #23
0
File: repo.py Project: beav/katello
    def get_repo(self, includeDisabled=False):
        repoId   = self.get_option('id')
        repoName = self.get_option('name')
        orgName  = self.get_option('org')
        prodName = self.get_option('product')
        if self.select_by_env:
            envName = self.get_option('env')
        else:
            envName = None

        if repoId:
            repo = self.api.repo(repoId)
        else:
            repo = get_repo(orgName, prodName, repoName, envName, includeDisabled)

        return repo
Example #24
0
    def get_repo(self, includeDisabled=False):
        repoId   = self.get_option('id')
        repoName = self.get_option('name')
        orgName  = self.get_option('org')
        prodName = self.get_option('product')
        if self.select_by_env:
            envName = self.get_option('env')
        else:
            envName = None

        if repoId:
            repo = self.api.repo(repoId)
        else:
            repo = get_repo(orgName, prodName, repoName, envName, includeDisabled)

        return repo
    def run(self):
        org_name       = self.get_option('org')
        def_label      = self.get_option('label')
        def_name       = self.get_option('name')
        def_id         = self.get_option('id')
        repo_name      = self.get_option('repo')
        product        = self.get_option('product')
        product_label  = self.get_option('product_label')
        product_id     = self.get_option('product_id')

        view = get_cv_definition(org_name, def_label, def_name, def_id)
        repo = get_repo(org_name, repo_name, product, product_label, product_id)

        repos = self.api.repos(org_name, view['id'])
        repos = [f['id'] for f in repos]
        self.update_repos(org_name, view, repos, repo)
        return os.EX_OK
Example #26
0
    def _repoNamesToIds(cls, orgName, repos):
        ids = []
        for rec in repos:
            prodName = None
            prodLabel = None
            prodId = None

            if "from_product" in rec:
                prodName = rec["from_product"]
            elif "from_product_label" in rec:
                prodLabel = rec["from_product_label"]
            elif "from_product_id" in rec:
                prodId = rec["from_product_id"]

            repo = get_repo(orgName, prodName, prodLabel, prodId, rec["name"])
            ids.append(repo["id"])
        return ids
    def run(self):
        org_name       = self.get_option('org')
        def_label      = self.get_option('label')
        def_name       = self.get_option('name')
        def_id         = self.get_option('id')
        repo_name      = self.get_option('repo')
        product        = self.get_option('product')
        product_label  = self.get_option('product_label')
        product_id     = self.get_option('product_id')

        view = get_cv_definition(org_name, def_label, def_name, def_id)
        repo = get_repo(org_name, repo_name, product, product_label, product_id)

        repos = self.api.repos(org_name, view['id'])
        repos = [f['id'] for f in repos]
        self.update_repos(org_name, view, repos, repo)
        return os.EX_OK
Example #28
0
    def _repoNamesToIds(cls, orgName, repos):
        ids = []
        for rec in repos:
            prodName = None
            prodLabel = None
            prodId = None

            if 'from_product' in rec:
                prodName = rec['from_product']
            elif 'from_product_label' in rec:
                prodLabel = rec['from_product_label']
            elif 'from_product_id' in rec:
                prodId = rec['from_product_id']

            repo = get_repo(orgName, prodName, prodLabel, prodId, rec['name'])
            ids.append(repo['id'])
        return ids
Example #29
0
    def get_repo_id(self):
        repoId = self.get_option("repo_id")
        repoName = self.get_option("repo")
        orgName = self.get_option("org")
        envName = self.get_option("environment")
        prodName = self.get_option("product")
        prodLabel = self.get_option("product_label")
        prodId = self.get_option("product_id")
        viewName = self.get_option("view_name")
        viewLabel = self.get_option("view_label")
        viewId = self.get_option("view_id")

        if not repoId:
            repo = get_repo(orgName, repoName, prodName, prodLabel, prodId, envName, False, viewName, viewLabel, viewId)
            if repo != None:
                repoId = repo["id"]

        return repoId
Example #30
0
    def get_repo_id(self):
        repo_id = self.get_option('repo_id')
        repo_name = self.get_option('repo')
        org_name = self.get_option('org')
        env_name = self.get_option('environment')
        prod_name = self.get_option('product')
        prod_label = self.get_option('product_label')
        prod_id = self.get_option('product_id')
        view_name = self.get_option('view_name')
        view_label = self.get_option('view_label')
        view_id = self.get_option('view_id')

        if not repo_id:
            repo = get_repo(org_name, repo_name, prod_name, prod_label, prod_id, env_name, False,
                            view_name, view_label, view_id)
            if repo:
                repo_id = repo["id"]

        return repo_id
Example #31
0
    def get_repo_id(self):
        repoId   = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName  = self.get_option('org')
        envName  = self.get_option('environment')
        prodName = self.get_option('product')
        prodLabel = self.get_option('product_label')
        prodId   = self.get_option('product_id')
        viewName = self.get_option('view_name')
        viewLabel = self.get_option('view_label')
        viewId = self.get_option('view_id')

        if not repoId:
            repo = get_repo(orgName, repoName, prodName, prodLabel, prodId, envName, False,
                            viewName, viewLabel, viewId)
            if repo != None:
                repoId = repo["id"]

        return repoId
Example #32
0
    def get_repo_id(self):
        repoId = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName = self.get_option('org')
        envName = self.get_option('environment')
        prodName = self.get_option('product')
        prodLabel = self.get_option('product_label')
        prodId = self.get_option('product_id')
        viewName = self.get_option('view_name')
        viewLabel = self.get_option('view_label')
        viewId = self.get_option('view_id')

        if not repoId:
            repo = get_repo(orgName, repoName, prodName, prodLabel, prodId,
                            envName, False, viewName, viewLabel, viewId)
            if repo != None:
                repoId = repo["id"]

        return repoId
Example #33
0
    def run(self):
        repoId   = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName  = self.get_option('org')
        envName  = self.get_option('environment')
        prodName = self.get_option('product')

        self.printer.add_column('id')
        self.printer.add_column('description')
        self.printer.add_column('files', multiline=True, show_with=printer.VerboseStrategy)

        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            repoId = repo["id"]

        self.printer.set_header(_("Distribution List For Repo %s") % repoId)

        distributions = self.api.distributions_by_repo(repoId)

        self.printer.print_items(distributions)
        return os.EX_OK
Example #34
0
    def run(self):
        errId = self.get_option('id')
        repoId = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName = self.get_option('org')
        envName = self.get_option('environment')
        prodName = self.get_option('product')
        prodLabel = self.get_option('product_label')
        prodId = self.get_option('product_id')
        viewName = self.get_option('view_name')
        viewLabel = self.get_option('view_label')
        viewId = self.get_option('view_id')

        if not repoId:
            repo = get_repo(orgName, repoName, prodName, prodLabel, prodId,
                            envName, viewName, viewLabel, viewId)
            repoId = repo["id"]

        pack = self.api.errata(errId, repoId)

        pack['affected_packages'] = [
            u_str(pinfo['filename']) for pkg in pack['pkglist']
            for pinfo in pkg['packages']
        ]

        batch_add_columns(self.printer, {'errata_id': _("ID")},
                          {'title': _("Title")})
        self.printer.add_column('description',
                                _("Description"),
                                multiline=True)
        batch_add_columns(self.printer, {'type': _("Type")}, {'issued': _("Issued")}, \
            {'updated': _("Updated")}, {'version': _("Version")}, {'release': _("Release")}, \
            {'status': _("Status")}, {'reboot_suggested': _("Reboot Suggested")})
        self.printer.add_column('affected_packages',
                                _("Affected Packages"),
                                multiline=True)

        self.printer.set_header(_("Errata Information"))
        self.printer.print_item(pack)
        return os.EX_OK
Example #35
0
    def run(self):
        packId = self.get_option("id")
        repoId = self.get_option("repo_id")
        repoName = self.get_option("repo")
        orgName = self.get_option("org")
        envName = self.get_option("environment")
        prodName = self.get_option("product")
        prodLabel = self.get_option("product_label")
        prodId = self.get_option("product_id")

        if not repoId:
            repo = get_repo(orgName, repoName, prodName, prodLabel, prodId, envName)
            repoId = repo["id"]

        pack = self.api.package(packId, repoId)

        batch_add_columns(
            self.printer,
            {"id": _("ID")},
            {"name": _("Name")},
            {"filename": _("Filename")},
            {"arch": _("Arch")},
            {"release": _("Release")},
            {"version": _("Version")},
            {"vendor": _("Vendor")},
        )
        self.printer.add_column("download_url", _("Download URL"), show_with=printer.VerboseStrategy)
        batch_add_columns(
            self.printer,
            {"description": _("Description")},
            {"provides": _("Provides")},
            {"requires": _("Requires")},
            multiline=True,
            show_with=printer.VerboseStrategy,
        )

        self.printer.set_header(_("Package Information"))
        self.printer.print_item(pack)
        return os.EX_OK
Example #36
0
    def run(self):
        repoId = self.get_option("repo_id")
        repoName = self.get_option("repo")
        orgName = self.get_option("org")
        envName = self.get_option("environment")
        prodName = self.get_option("product")
        prodLabel = self.get_option("product_label")
        prodId = self.get_option("product_id")

        self.printer.add_column("id", _("ID"))
        self.printer.add_column("description", _("Description"))
        self.printer.add_column("files", _("Files"), multiline=True, show_with=printer.VerboseStrategy)

        if not repoId:
            repo = get_repo(orgName, prodName, prodLabel, prodId, repoName, envName)
            repoId = repo["id"]

        self.printer.set_header(_("Distribution List For Repo %s") % repoId)

        distributions = self.api.distributions_by_repo(repoId)

        self.printer.print_items(distributions)
        return os.EX_OK
Example #37
0
    def run(self):
        repoId = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName = self.get_option('org')
        envName = self.get_option('env')
        prodName = self.get_option('product')

        self.printer.add_column('id')
        self.printer.add_column('description')
        self.printer.add_column('files',
                                multiline=True,
                                show_with=printer.VerboseStrategy)

        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            repoId = repo["id"]

        self.printer.set_header(_("Distribution List For Repo %s") % repoId)

        distributions = self.api.distributions_by_repo(repoId)

        self.printer.print_items(distributions)
        return os.EX_OK
Example #38
0
    def run(self):
        packId = self.get_option('id')
        repoId = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName = self.get_option('org')
        envName = self.get_option('env')
        prodName = self.get_option('product')

        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            repoId = repo["id"]

        pack = self.api.package(packId, repoId)

        self.printer.add_column('id')
        self.printer.add_column('name')
        self.printer.add_column('filename')
        self.printer.add_column('arch')
        self.printer.add_column('release')
        self.printer.add_column('version')
        self.printer.add_column('vendor')
        self.printer.add_column('download_url',
                                show_with=printer.VerboseStrategy)
        self.printer.add_column('description',
                                multiline=True,
                                show_with=printer.VerboseStrategy)
        self.printer.add_column('provides',
                                multiline=True,
                                show_with=printer.VerboseStrategy)
        self.printer.add_column('requires',
                                multiline=True,
                                show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Package Information"))
        self.printer.print_item(pack)
        return os.EX_OK
Example #39
0
    def run(self):
        repoId   = self.get_option('repo_id')
        repoName = self.get_option('repo')
        orgName  = self.get_option('org')
        envName  = self.get_option('env')
        prodName = self.get_option('product')

        self.printer.addColumn('id')
        self.printer.addColumn('description')
        self.printer.addColumn('files', multiline=True, show_in_grep=False)

        if not repoId:
            repo = get_repo(orgName, prodName, repoName, envName)
            if repo == None:
                return os.EX_DATAERR
            repoId = repo["id"]


        self.printer.setHeader(_("Distribution List For Repo %s") % repoId)

        distributions = self.api.distributions_by_repo(repoId)

        self.printer.printItems(distributions)
        return os.EX_OK
Example #40
0
    def run(self):
        org_name = self.get_option('org')
        filter_name = self.get_option('name')
        filter_id = self.get_option('id')
        repo_name = self.get_option('repo')
        product = self.get_option('product')
        product_label = self.get_option('product_label')
        product_id = self.get_option('product_id')
        definition_label = self.get_option('definition_label')
        definition_name = self.get_option('definition_name')
        definition_id = self.get_option('definition_id')

        definition = get_cv_definition(org_name, definition_label,
                                       definition_name, definition_id)

        cvd_filter = get_filter(org_name, definition["id"], filter_name, filter_id)

        repo = get_repo(org_name, repo_name, product, product_label, product_id)
        repos = self.api.repos(cvd_filter["id"], definition["id"], org_name)
        repos = [f['id'] for f in repos]

        self.update_repos(org_name, definition["id"], cvd_filter, repos, repo)

        return os.EX_OK
Example #41
0
    def run(self):
        org_name = self.get_option('org')
        filter_name = self.get_option('name')
        filter_id = self.get_option('id')
        repo_name = self.get_option('repo')
        product = self.get_option('product')
        product_label = self.get_option('product_label')
        product_id = self.get_option('product_id')
        definition_label = self.get_option('definition_label')
        definition_name = self.get_option('definition_name')
        definition_id = self.get_option('definition_id')

        definition = get_cv_definition(org_name, definition_label,
                                       definition_name, definition_id)

        cvd_filter = get_filter(org_name, definition["id"], filter_name, filter_id)

        repo = get_repo(org_name, repo_name, product, product_label, product_id)
        repos = self.api.repos(cvd_filter["id"], definition["id"], org_name)
        repos = [f['id'] for f in repos]

        self.update_repos(org_name, definition["id"], cvd_filter, repos, repo)

        return os.EX_OK
Example #42
0
    def run(self):
        repo_id = self.get_option("repo_id")
        repo_name = self.get_option("repo")
        org_name = self.get_option("org")
        env_name = self.get_option("environment")
        env_id, prod_id = None, None
        prod_name = self.get_option("product")
        prod_label = self.get_option("product_label")
        prod_id = self.get_option("product_id")

        self.printer.add_column("id", _("ID"))
        self.printer.add_column("title", _("Title"))
        self.printer.add_column("type", _("Type"))

        if not repo_id:
            if repo_name:
                repo = get_repo(org_name, prod_name, prod_label, prod_id, repo_name, env_name)
                repo_id = repo["id"]
            else:
                env = get_environment(org_name, env_name)
                env_id = env["id"]
                if prod_name:
                    product = get_product(org_name, prod_name, prod_label, prod_id)
                    prod_id = product["id"]

        errata = self.api.errata_filter(
            repo_id=repo_id,
            environment_id=env_id,
            type_in=self.get_option("type"),
            severity=self.get_option("severity"),
            prod_id=prod_id,
        )

        self.printer.set_header(_("Errata List"))
        self.printer.print_items(errata)
        return os.EX_OK
Example #43
0
 def repo_id(self, options):
     prod_opts = self.product_options(options)
     repo = get_repo(self.org_name, options['name'], prod_opts['name'],
                     prod_opts['label'], prod_opts['id'], self.env_name)
     return repo['id']
Example #44
0
 def repoNamesToIds(self, orgName, repos):
     ids = []
     for rec in repos:
         repo = get_repo(orgName, rec['product'], rec['name'])
         ids.append(repo['id'])
     return ids
Example #45
0
 def repo_id(self, options):
     repo = get_repo(self.org_name, options['product'], options['name'],
                     self.prior_env_name)
     return repo['id']