コード例 #1
0
ファイル: package.py プロジェクト: chiehwen/katello
    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, prodName, prodLabel, prodId, repoName, 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
コード例 #2
0
ファイル: config_template.py プロジェクト: chiehwen/katello
    def run(self):
        configtemplate = self.api.show(self.get_option('id'))
        configtemplate = unnest_one(configtemplate)

        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")}, {'snippet': _("Snippet")})

        if not configtemplate.get('snippet'):
            self.printer.add_column('kind', _("Template Kind"),
                                item_formatter=lambda item: format_sub_resource(item, 'kind', 'kind_id'))

        if configtemplate.get('template_combinations'):
            content = []
            for combo in configtemplate.get('template_combinations'):
                combo = unnest_one(combo)
                content.append("%s / %s (Id: %d)" % (combo['hostgroup_id'], combo['environment_id'], combo['id']))
                # key = "Hostgroup / Environment id %d" % combo['id']
            configtemplate['Hostgroup/Environment combinations'] = ', '.join(content)
            self.printer.add_column('Hostgroup/Environment combinations', _("Hostgroup/Environment Combinations"))

        if configtemplate.get('operatingsystems'):
            content = []
            for system in configtemplate.get('operatingsystems'):
                system = unnest_one(system)
                content.append("%s (Id: %d)" % (system['name'], system['id']))
            configtemplate['Operating Systems'] = ', '.join(content)
            self.printer.add_column('Operating Systems', _("Operating Systems"))

        self.printer.add_column('template', _("Template"))

        self.printer.set_header(_("Config Template"))
        self.printer.print_item(configtemplate)
コード例 #3
0
ファイル: template.py プロジェクト: icewwn/katello
    def run(self):
        tplName = self.get_option('name')
        orgName = self.get_option('org')
        envName = self.get_option('environment')

        template = get_template(orgName, envName, tplName)

        template["products"]     = [p["name"] for p in template["products"]]
        template["repositories"] = [r["name"] for r in template["repositories"]]
        template["packages"]   = [self._build_nvrea(p) for p in template["packages"]]
        template["parameters"] = [key+":\t"+value for key, value in template["parameters"].iteritems()]
        template["package_groups"] = [p["name"] for p in template["package_groups"]]
        template["package_group_categories"] = [p["name"] for p in template["pg_categories"]]


        batch_add_columns(self.printer, 'id', 'name')
        self.printer.add_column('revision', show_with=printer.VerboseStrategy)
        self.printer.add_column('description', multiline=True)
        self.printer.add_column('environment_id')
        self.printer.add_column('parent_id')
        batch_add_columns(self.printer, \
            'errata', 'products', 'repositories', \
            'packages', 'parameters', 'package_groups', \
            'package_group_categories', \
            multiline=True, show_with=printer.VerboseStrategy)
        self.printer.set_header(_("Template Info"))
        self.printer.print_item(template)
        return os.EX_OK
コード例 #4
0
ファイル: config_template.py プロジェクト: icewwn/katello
    def run(self):
        configtemplate = self.api.show(self.get_option('id'))
        configtemplate = unnest_one(configtemplate)

        batch_add_columns(self.printer, 'id', 'name', 'snippet')

        if not configtemplate.get('snippet'):
            configtemplate['Template Kind'] = "%s (Id: %d)" % (configtemplate['kind'], configtemplate['kind_id'])
            self.printer.add_column('Template Kind')

        if configtemplate.get('template_combinations'):
            content = []
            for combo in configtemplate.get('template_combinations'):
                combo = unnest_one(combo)
                content.append("%s / %s (Id: %d)" % (combo['hostgroup_id'], combo['environment_id'], combo['id']))
                # key = "Hostgroup / Environment id %d" % combo['id']
            configtemplate['Hostgroup/Environment combinations'] = ', '.join(content)
            self.printer.add_column('Hostgroup/Environment combinations')

        if configtemplate.get('operatingsystems'):
            content = []
            for system in configtemplate.get('operatingsystems'):
                system = unnest_one(system)
                content.append("%s (Id: %d)" % (system['name'], system['id']))
            configtemplate['Operating Systems'] = ', '.join(content)
            self.printer.add_column('Operating Systems')

        self.printer.add_column('template')

        self.printer.set_header(_("Config Template"))
        self.printer.print_item(configtemplate)
コード例 #5
0
ファイル: config_template.py プロジェクト: AdamSaleh/katello
    def run(self):
        configtemplate = self.api.show(self.get_option("id"))
        configtemplate = unnest_one(configtemplate)

        batch_add_columns(self.printer, "id", "name", "snippet")

        if not configtemplate.get("snippet"):
            configtemplate["Template Kind"] = "%s (Id: %d)" % (configtemplate["kind"], configtemplate["kind_id"])
            self.printer.add_column("Template Kind")

        if configtemplate.get("template_combinations"):
            content = []
            for combo in configtemplate.get("template_combinations"):
                combo = unnest_one(combo)
                content.append("%s / %s (Id: %d)" % (combo["hostgroup_id"], combo["environment_id"], combo["id"]))
                # key = "Hostgroup / Environment id %d" % combo['id']
            configtemplate["Hostgroup/Environment combinations"] = ", ".join(content)
            self.printer.add_column("Hostgroup/Environment combinations")

        if configtemplate.get("operatingsystems"):
            content = []
            for system in configtemplate.get("operatingsystems"):
                system = unnest_one(system)
                content.append("%s (Id: %d)" % (system["name"], system["id"]))
            configtemplate["Operating Systems"] = ", ".join(content)
            self.printer.add_column("Operating Systems")

        self.printer.add_column("template")

        self.printer.set_header(_("Config Template"))
        self.printer.print_item(configtemplate)
コード例 #6
0
ファイル: errata.py プロジェクト: icewwn/katello
    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', 'title')
        self.printer.add_column('description', multiline=True)
        batch_add_columns(self.printer,
            'type', 'issued', 'updated', 'version',
            'release', 'status', '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
コード例 #7
0
ファイル: package.py プロジェクト: AdamSaleh/katello
    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, prodName, prodLabel, prodId, repoName, envName)
            repoId = repo["id"]

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

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

        self.printer.set_header(_("Package Information"))
        self.printer.print_item(pack)
        return os.EX_OK
コード例 #8
0
ファイル: product.py プロジェクト: AdamSaleh/katello
    def run(self):
        orgName     = self.get_option('org')
        prodName    = self.get_option('name')
        prodLabel   = self.get_option('label')
        prodId      = self.get_option('id')

        prod = get_product(orgName, prodName, prodLabel, prodId)

        task = AsyncTask(self.api.last_sync_status(orgName, prod['id']))

        if task.is_running():
            pkgsTotal = task.total_count()
            pkgsLeft = task.items_left()
            prod['progress'] = ("%d%% done (%d of %d packages downloaded)" %
                (task.get_progress()*100, pkgsTotal-pkgsLeft, pkgsTotal))

        #TODO: last errors?

        batch_add_columns(self.printer, 'id', 'name', 'provider_id', 'provider_name')
        self.printer.add_column('last_sync', formatter=format_sync_time)
        self.printer.add_column('sync_state', formatter=format_sync_state)
        self.printer.add_column('progress', show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Product Status"))
        self.printer.print_item(prod)
        return os.EX_OK
コード例 #9
0
ファイル: template.py プロジェクト: chiehwen/katello
    def run(self):
        tplName = self.get_option("name")
        orgName = self.get_option("org")
        envName = self.get_option("environment")

        template = get_template(orgName, envName, tplName)

        template["products"] = [p["name"] for p in template["products"]]
        template["repositories"] = [r["name"] for r in template["repositories"]]
        template["packages"] = [self._build_nvrea(p) for p in template["packages"]]
        template["parameters"] = [key + ":\t" + value for key, value in template["parameters"].iteritems()]
        template["package_groups"] = [p["name"] for p in template["package_groups"]]
        template["package_group_categories"] = [p["name"] for p in template["pg_categories"]]

        batch_add_columns(self.printer, {"id": _("ID")}, {"name": _("Name")})
        self.printer.add_column("revision", _("Revision"), show_with=printer.VerboseStrategy)
        self.printer.add_column("description", _("Description"), multiline=True)
        self.printer.add_column("environment_id", _("Environment ID"))
        self.printer.add_column("parent_id", _("Parent ID"))
        batch_add_columns(
            self.printer,
            {"errata": _("Errata")},
            {"products": _("Products")},
            {"repositories": _("Repositories")},
            {"packages": _("Packages")},
            {"parameters": _("Parameters")},
            {"package_groups": _("Package Groups")},
            {"package_group_categories": _("Package Group Categories")},
            multiline=True,
            show_with=printer.VerboseStrategy,
        )
        self.printer.set_header(_("Template Info"))
        self.printer.print_item(template)
        return os.EX_OK
コード例 #10
0
ファイル: product.py プロジェクト: AdamSaleh/katello
    def run(self):
        org_name = self.get_option('org')
        env_name = self.get_option('environment')
        prov_name = self.get_option('prov')
        all_opt = self.get_option('all')

        batch_add_columns(self.printer, 'id', 'name', 'label', 'provider_id', 'provider_name', 'sync_plan_name')
        self.printer.add_column('last_sync', formatter=format_sync_time)
        self.printer.add_column('gpg_key_name', name=_("GPG key"))

        if prov_name:
            prov = get_provider(org_name, prov_name)

            self.printer.set_header(_("Product List For Provider %s") % (prov_name))
            prods = self.api.products_by_provider(prov["id"])

        else:
            env = get_environment(org_name, env_name)

            self.printer.set_header(_("Product List For Organization %s, Environment '%s'") % (org_name, env["name"]))
            prods = self.api.products_by_env(env['id'])

        # hide marketing products by default
        if not all_opt:
            def isNotMarketingProduct(p):
                return not (("marketing_product" in p) and (p["marketing_product"]))
            prods = filter(isNotMarketingProduct, prods)

        self.printer.print_items(prods)

        return os.EX_OK
コード例 #11
0
ファイル: product.py プロジェクト: chiehwen/katello
    def run(self):
        org_name = self.get_option('org')
        env_name = self.get_option('environment')
        prov_name = self.get_option('prov')
        all_opt = self.get_option('all')

        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")}, \
            {'label': _("Label")}, {'provider_id': _("Provider ID")}, \
            {'provider_name': _("Provider Name")}, {'sync_plan_name': _("Sync Plan Name")})
        self.printer.add_column('last_sync', _("Last Sync"), formatter=format_sync_time)
        self.printer.add_column('gpg_key_name', _("GPG key"))

        if prov_name:
            prov = get_provider(org_name, prov_name)

            self.printer.set_header(_("Product List For Provider [ %s ]") % (prov_name))
            prods = self.api.products_by_provider(prov["id"])

        else:
            env = get_environment(org_name, env_name)

            self.printer.set_header(_("Product List For Organization %(org_name)s, Environment '%(env_name)s'") \
                % {'org_name':org_name, 'env_name':env["name"]})
            prods = self.api.products_by_env(env['id'])

        # hide marketing products by default
        if not all_opt:
            def isNotMarketingProduct(p):
                return not (("marketing_product" in p) and (p["marketing_product"]))
            prods = filter(isNotMarketingProduct, prods)

        self.printer.print_items(prods)

        return os.EX_OK
コード例 #12
0
ファイル: smart_proxy.py プロジェクト: chiehwen/katello
    def run(self):
        proxy = self.api.show(self.get_option('name'))
        proxy = unnest_one(proxy)
        batch_add_columns(self.printer, {'name': _("Name")}, {'url': _("URL")})
        self.printer.add_column('features', _("Features"), multiline=True)

        self.printer.set_header(_("Smart Proxy"))
        self.printer.print_item(proxy)
コード例 #13
0
ファイル: domain.py プロジェクト: icewwn/katello
    def run(self):
        domain_id = self.get_option('id')
        domain = unnest_one(self.api.show(domain_id))

        batch_add_columns(self.printer,
            'id', 'name', 'fullname', 'dns_id')

        self.printer.set_header(_("Domain"))
        self.printer.print_item(domain)
コード例 #14
0
ファイル: organization.py プロジェクト: recsu/katello
    def run(self):
        orgs = self.api.organizations()

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

        self.printer.set_header(_("Organization List"))
        self.printer.print_items(orgs)
        return os.EX_OK
コード例 #15
0
ファイル: organization.py プロジェクト: chiehwen/katello
    def run(self):
        orgs = self.api.organizations()

        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")}, {'label': _("Label")})
        self.printer.add_column('description', _("Description"), multiline=True)

        self.printer.set_header(_("Organization List"))
        self.printer.print_items(orgs)
        return os.EX_OK
コード例 #16
0
ファイル: user.py プロジェクト: AdamSaleh/katello
    def run(self):
        users = self.api.users()

        batch_add_columns(self.printer, 'id', 'username', 'email', \
            'disabled', 'default_organization', 'default_environment')

        self.printer.set_header(_("User List"))
        self.printer.print_items(users)
        return os.EX_OK
コード例 #17
0
ファイル: architecture.py プロジェクト: icewwn/katello
    def run(self):
        archs = self.api.index()
        if archs:
            archs = unnest_one(archs)
        batch_add_columns(self.printer, 'id', 'name')

        self.printer.set_header(_("Architectures List"))
        self.printer.print_items(archs)
        return os.EX_OK
コード例 #18
0
ファイル: architecture.py プロジェクト: icewwn/katello
    def run(self):
        arch = self.api.show(self.get_option('name'))
        arch = unnest_one(arch)

        batch_add_columns(self.printer, 'id', 'name')

        self.printer.set_header(_("Architecture"))
        self.printer.print_item(arch)
        return os.EX_OK
コード例 #19
0
ファイル: organization.py プロジェクト: AdamSaleh/katello
    def run(self):
        orgs = self.api.organizations()

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

        self.printer.set_header(_("Organization List"))
        self.printer.print_items(orgs)
        return os.EX_OK
コード例 #20
0
ファイル: domain.py プロジェクト: chiehwen/katello
    def run(self):
        domain_id = self.get_option('id')
        domain = unnest_one(self.api.show(domain_id))

        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")}, \
            {'fullname': _("Full Name")}, {'dns_id': _("DNS ID")})

        self.printer.set_header(_("Domain"))
        self.printer.print_item(domain)
コード例 #21
0
ファイル: subnet.py プロジェクト: chiehwen/katello
    def run(self):
        subnets = unnest_one(self.api.list())

        batch_add_columns(self.printer, {'name': _("Name")}, {'network': _("Network")}, \
            {'mask': _("Mask")})
        batch_add_columns(self.printer, {'dhcp': _("DHCP")}, {'tftp': _("TFTP")}, \
            {'dns': _("DNS")}, formatter=self.format_smart_proxy)

        self.printer.set_header(_("Subnets"))
        self.printer.print_items(subnets)
コード例 #22
0
ファイル: config_template.py プロジェクト: AdamSaleh/katello
    def run(self):
        data = self.get_option_dict("order", "search")
        configtemplates = self.api.list(data)
        if configtemplates:
            configtemplates = unnest_one(configtemplates)

        batch_add_columns(self.printer, "id", "name", "snippet")

        self.printer.set_header(_("Config Template"))
        self.printer.print_items(configtemplates)
コード例 #23
0
ファイル: config_template.py プロジェクト: chiehwen/katello
    def run(self):
        data = self.get_option_dict('order', 'search')
        configtemplates = self.api.list(data)
        if configtemplates:
            configtemplates = unnest_one(configtemplates)

        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")}, {'snippet': _("Snippet")})

        self.printer.set_header(_("Config Template"))
        self.printer.print_items(configtemplates)
コード例 #24
0
ファイル: compute_resource.py プロジェクト: chiehwen/katello
    def run(self):
        resources = self.api.index()
        resources = unnest_one(resources)

        batch_add_columns(
            self.printer, {"id": _("ID")}, {"name": _("Name")}, {"url": _("Url")}, {"provider": _("Provider")}
        )

        self.printer.set_header(_("Compute Resources List"))
        self.printer.print_items(resources)
        return os.EX_OK
コード例 #25
0
ファイル: domain.py プロジェクト: chiehwen/katello
    def run(self):
        data = self.get_option_dict('search', 'order')
        domains = self.api.list(data)
        if domains:
            domains = unnest_one(domains)

        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")}, \
            {'fullname': _("Full Name")}, {'dns_id': _("DNS ID")})

        self.printer.set_header(_("Domains"))
        self.printer.print_items(domains)
コード例 #26
0
ファイル: subnet.py プロジェクト: icewwn/katello
    def run(self):
        subnets = unnest_one(self.api.list())

        batch_add_columns(self.printer, \
            'name', 'network', 'mask')
        batch_add_columns(self.printer, \
            'dhcp', 'tftp', 'dns', \
            formatter=self.format_smart_proxy)

        self.printer.set_header(_("Subnets"))
        self.printer.print_items(subnets)
コード例 #27
0
ファイル: domain.py プロジェクト: icewwn/katello
    def run(self):
        data = self.get_option_dict('search', 'order')
        domains = self.api.list(data)
        if domains:
            domains = unnest_one(domains)

        batch_add_columns(self.printer,
            'id', 'name', 'fullname', 'dns_id')

        self.printer.set_header(_("Domains"))
        self.printer.print_items(domains)
コード例 #28
0
ファイル: user.py プロジェクト: chiehwen/katello
    def run(self):
        users = self.api.users()

        batch_add_columns(self.printer, {'id': _("ID")}, {'username': _("Username")}, \
            {'email': _("Email")}, {'disabled': _("Disabled")}, \
            {'default_organization': _("Default Organization")}, \
            {'default_environment': _("Default Environment")})

        self.printer.set_header(_("User List"))
        self.printer.print_items(users)
        return os.EX_OK
コード例 #29
0
ファイル: ping.py プロジェクト: chiehwen/katello
    def run(self):

        status = self.api.ping()

        batch_add_columns(self.printer, {'status': _("Status")}, {'service': _("Service")}, \
            {'result': _("Result")}, {'duration': _("Duration")}, {'message': _("Message")})
        self.printer.set_header(_("Katello Status"))

        statusList = self.__statusToList(status)
        self.printer.print_items(statusList)

        return self.__returnCode(status)
コード例 #30
0
ファイル: subnet.py プロジェクト: icewwn/katello
    def run(self):
        subnet = unnest_one(self.api.get(self.get_option("name")))
        batch_add_columns(self.printer, \
            'name', 'network', 'mask', 'gateway', \
            'dns_primary', 'dns_secondary', 'from', 'to', 'vlanid')
        self.printer.add_column('domain_ids', multiline=True)
        batch_add_columns(self.printer, \
            'dhcp', 'tftp', 'dns', \
            formatter=self.format_smart_proxy)

        self.printer.set_header(_("Subnet"))
        self.printer.print_item(subnet)