コード例 #1
0
ファイル: puppet_module.py プロジェクト: Katello/katello-cli
    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
コード例 #2
0
ファイル: package.py プロジェクト: Katello/katello-cli
    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
コード例 #3
0
ファイル: distributor.py プロジェクト: Katello/katello-cli
    def run(self):
        org_name = self.get_option('org')
        env_name = self.get_option('environment')
        dist_name = self.get_option('name')
        dist_uuid = self.get_option('uuid')

        if dist_uuid:
            self.printer.set_header(_("Distributor Information [ %s ]") % dist_uuid)
        elif env_name is None:
            self.printer.set_header(_("Distributor Information For Org [ %s ]") % org_name)
        else:
            self.printer.set_header(_("Distributor Information For Environment [ %(env)s ] in Org [ %(org)s ]") \
                % {'env':env_name, 'org':org_name})

        # get distributor details
        distributor = get_distributor(org_name, dist_name, env_name, dist_uuid)

        custom_info_api = CustomInfoAPI()
        custom_info = custom_info_api.get_custom_info("distributor", distributor['id'])
        distributor['custom_info'] = stringify_custom_info(custom_info)

        if 'environment' in distributor:
            distributor['environment'] = distributor['environment']['name']

        batch_add_columns(self.printer, {'name': _("Name")}, {'version': _("Version")},
            {'uuid': _("UUID")}, {'environment': _("Environment")})
        self.printer.add_column('created_at', _("Created"), formatter=format_date)
        self.printer.add_column('updated_at', _("Last Updated"), formatter=format_date)
        self.printer.add_column('description', _("Description"), multiline=True)
        self.printer.add_column('custom_info', _("Custom Info"), multiline=True, show_with=printer.VerboseStrategy)

        self.printer.print_item(distributor)

        return os.EX_OK
コード例 #4
0
ファイル: errata.py プロジェクト: knowncitizen/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": _("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
コード例 #5
0
ファイル: system.py プロジェクト: suganthidewakar/katello
    def run(self):
        org_name = self.get_option("org")
        env_name = self.get_option("environment")
        pool_id = self.get_option("pool_id")

        systems = self.get_systems(org_name, env_name, pool_id)

        if env_name is None:
            self.printer.set_header(_("Systems List For Org [ %s ]") % org_name)
        else:
            self.printer.set_header(
                _("Systems List For Environment [ %(env_name)s ] in Org [ %(org_name)s ]")
                % {"env_name": env_name, "org_name": org_name}
            )

        batch_add_columns(self.printer, {"name": _("Name")}, {"uuid": _("UUID")})
        self.printer.add_column(
            "environment", _("Environment"), item_formatter=lambda p: "%s" % (p["environment"]["name"])
        )

        self.printer.add_column("serviceLevel", _("Service Level"))

        cv_format = lambda p: "%s" % (p["content_view"]["name"] if "content_view" in p else "")
        self.printer.add_column("content_view", _("Content View"), item_formatter=cv_format)

        self.printer.print_items(systems)
        return os.EX_OK
コード例 #6
0
ファイル: system.py プロジェクト: lzap/katello
    def run(self):
        org_name = self.get_option('org')
        env_name = self.get_option('environment')
        pool_id = self.get_option('pool_id')

        systems = self.get_systems(org_name, env_name, pool_id)

        if env_name is None:
            self.printer.set_header(_("Systems List For Org [ %s ]") % org_name)
        else:
            self.printer.set_header(_("Systems List For Environment [ %(env_name)s ] in Org [ %(org_name)s ]") \
                % {'env_name':env_name, 'org_name':org_name})

        batch_add_columns(self.printer, {'name': _("Name")}, {'uuid': _("UUID")})
        self.printer.add_column('environment', _("Environment"), \
            item_formatter=lambda p: "%s" % (p['environment']['name']))

        self.printer.add_column('serviceLevel', _("Service Level"))

        cv_format = lambda p: "%s" % (p['content_view']['name'] if 'content_view' in p else "")
        self.printer.add_column('content_view', _("Content View"),
                                item_formatter=cv_format)

        self.printer.print_items(systems)
        return os.EX_OK
コード例 #7
0
ファイル: errata.py プロジェクト: alda519/katello-cli
    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
コード例 #8
0
ファイル: product.py プロジェクト: AsherBond/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
コード例 #9
0
ファイル: product.py プロジェクト: AsherBond/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': _("ID")}, {'name': _("Name")}, \
            {'provider_id': _("Provider ID")}, {'provider_name': _("Provider Name")})
        self.printer.add_column('last_sync', _("Last Sync"), formatter=format_sync_time)
        self.printer.add_column('sync_state', _("Sync State"), formatter=format_sync_state)
        self.printer.add_column('progress', _("Progress"), show_with=printer.VerboseStrategy)

        self.printer.set_header(_("Product Status"))
        self.printer.print_item(prod)
        return os.EX_OK
コード例 #10
0
ファイル: system.py プロジェクト: lzap/katello
    def run(self):
        org_name = self.get_option('org')
        env_name = self.get_option('environment')
        sys_name = self.get_option('name')
        sys_uuid = self.get_option('uuid')

        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')

        task = None

        if env_name is None:
            self.printer.set_header(_("Package Information for System [ %(sys_name)s ] in Org [ %(org_name)s ]") \
                % {'sys_name':sys_name, 'org_name':org_name})
        else:
            self.printer.set_header(_("Package Information for System [ %(sys_name)s ] " \
                "in Environment [ %(env_name)s ] in Org [ %(org_name)s ]") % \
                {'sys_name':sys_name, 'env_name':env_name, 'org_name':org_name})

        system = get_system(org_name, sys_name, env_name, sys_uuid)
        system_id = system['uuid']

        if install:
            task = self.api.install_packages(system_id, install)
        if remove:
            task = self.api.remove_packages(system_id, remove)
        if update:
            if update == '--all':
                update_packages = []
            else:
                update_packages = update
            task = self.api.update_packages(system_id, update_packages)
        if install_groups:
            task = self.api.install_package_groups(system_id, install_groups)
        if remove_groups:
            task = self.api.remove_package_groups(system_id, remove_groups)

        if task:
            uuid = task["uuid"]
            print (_("Performing remote action [ %s ]... ") % uuid)
            task = SystemAsyncTask(task)
            run_spinner_in_bg(wait_for_async_task, [task])

            return evaluate_remote_action(task)

        packages = self.api.packages(system_id)

        batch_add_columns(self.printer, {'name': _("Name")}, {'vendor': _("Vendor")}, \
            {'version': _("Version")}, {'release': _("Release")}, {'arch': _("Arch")}, \
            show_with=printer.VerboseStrategy)
        self.printer.add_column('name_version_release_arch', _("Name_Version_Release_Arch"), \
            show_with=printer.GrepStrategy, \
            item_formatter=lambda p: "%s-%s-%s.%s" % (p['name'], p['version'], p['release'], p['arch']))

        self.printer.print_items(packages)

        return os.EX_OK
コード例 #11
0
ファイル: product.py プロジェクト: Katello/katello-cli
    def run(self):
        org_name = self.get_option('org')
        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"], marketing=all_opt)

        else:
            self.printer.set_header(_("Product List For Organization %(org_name)s") \
                % {'org_name':org_name})
            prods = self.api.products_by_org(org_name, None, all_opt)

        self.printer.print_items(prods)

        return os.EX_OK
コード例 #12
0
ファイル: template.py プロジェクト: bcrochet/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
コード例 #13
0
ファイル: config_template.py プロジェクト: bcrochet/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)
コード例 #14
0
ファイル: smart_proxy.py プロジェクト: bcrochet/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)
コード例 #15
0
ファイル: organization.py プロジェクト: lzap/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
ファイル: domain.py プロジェクト: bcrochet/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)
コード例 #17
0
ファイル: repo.py プロジェクト: Katello/katello-cli
    def run(self):
        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")
        listDisabled = self.has_option("disabled")
        content_view_name = self.get_option("view_name")
        content_view_label = self.get_option("view_label")
        content_view_id = self.get_option("view_id")

        batch_add_columns(
            self.printer,
            {"id": _("ID")},
            {"name": _("Name")},
            {"label": _("Label")},
            {"content_type": _("Type")},
            {"package_count": _("Package Count")},
            {"puppet_module_count": _("Puppet Module Count")},
        )

        self.printer.add_column("last_sync", _("Last Sync"), formatter=format_sync_time)

        if content_view_name or content_view_label or content_view_id:
            content_view = get_content_view(orgName, content_view_label, content_view_name, content_view_id)
            content_view_id = content_view["id"]

        prodIncluded = prodName or prodLabel or prodId
        if prodIncluded and envName:
            env = get_environment(orgName, envName)
            prod = get_product(orgName, prodName, prodLabel, prodId)

            self.printer.set_header(
                _("Repo List For Org %(org_name)s Environment %(env_name)s Product %(prodName)s")
                % {"org_name": orgName, "env_name": env["name"], "prodName": prodName}
            )
            repos = self.api.repos_by_env_product(env["id"], prod["id"], None, listDisabled, content_view_id)
            self.printer.print_items(repos)

        elif prodIncluded:
            prod = get_product(orgName, prodName, prodLabel, prodId)
            self.printer.set_header(
                _("Repo List for Product %(prodName)s in Org %(orgName)s ") % {"prodName": prodName, "orgName": orgName}
            )
            repos = self.api.repos_by_product(orgName, prod["id"], listDisabled)
            self.printer.print_items(repos)

        else:
            env = get_environment(orgName, envName)
            self.printer.set_header(
                _("Repo List For Org %(orgName)s Environment %(env_name)s")
                % {"orgName": orgName, "env_name": env["name"]}
            )
            repos = self.api.repos_by_org_env(orgName, env["id"], listDisabled, content_view_id)
            self.printer.print_items(repos)

        return os.EX_OK
コード例 #18
0
ファイル: architecture.py プロジェクト: bcrochet/katello
    def run(self):
        archs = self.api.index()
        if archs:
            archs = unnest_one(archs)
        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")})

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

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

        self.printer.set_header(_("Architecture"))
        self.printer.print_item(arch)
        return os.EX_OK
コード例 #20
0
ファイル: subnet.py プロジェクト: bcrochet/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)
コード例 #21
0
ファイル: config_template.py プロジェクト: bcrochet/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)
コード例 #22
0
ファイル: domain.py プロジェクト: bcrochet/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)
コード例 #23
0
ファイル: user.py プロジェクト: mccun934/katello-cli
    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
コード例 #24
0
ファイル: subnet.py プロジェクト: bcrochet/katello
    def run(self):
        subnet = unnest_one(self.api.get(self.get_option("name")))
        batch_add_columns(self.printer, {'name': _("Name")}, {'network': _("Network")}, \
            {'mask': _("Mask")}, {'gateway': _("Gateway")}, {'dns_primary': _("Primary DNS")}, \
            {'dns_secondary': _("Secondary DNS")}, {'from': _("From")}, {'to': _("To")}, \
            {'vlanid': _("VLAN ID")})
        self.printer.add_column('domain_ids', _("Domain IDs"), multiline=True)
        batch_add_columns(self.printer, {'dhcp': _("DHCP")}, {'tftp': _("TFTP")}, \
            {'dns': _("DNS")}, formatter=self.format_smart_proxy)

        self.printer.set_header(_("Subnet"))
        self.printer.print_item(subnet)
コード例 #25
0
ファイル: ping.py プロジェクト: AsherBond/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)
コード例 #26
0
ファイル: system.py プロジェクト: lzap/katello
    def run(self):
        org_name = self.get_option('org')
        env_name = self.get_option('environment')
        sys_name = self.get_option('name')
        sys_uuid = self.get_option('uuid')

        if sys_uuid:
            self.printer.set_header(_("System Information [ %s ]") % sys_uuid)
        elif env_name is None:
            self.printer.set_header(_("System Information For Org [ %s ]") % org_name)
        else:
            self.printer.set_header(_("System Information For Environment [ %(env_name)s ] in Org [ %(org_name)s ]") \
                % {'env_name':env_name, 'org_name':org_name})

        # get system details
        system = get_system(org_name, sys_name, env_name, sys_uuid)

        custom_info_api = CustomInfoAPI()
        custom_info = custom_info_api.get_custom_info("system", system['id'])
        system['custom_info'] = stringify_custom_info(custom_info)

        system["activation_keys"] = "[ "+ ", ".join([ak["name"] for ak in system["activation_key"]]) +" ]"
        if 'host' in system:
            system['host'] = system['host']['name']
        if 'guests' in system:
            system["guests"] = "[ "+ ", ".join([guest["name"] for guest in system["guests"]]) +" ]"
        if 'environment' in system:
            system['environment'] = system['environment']['name']

        if 'content_view' in system:
            system['content_view'] = "[ %s ]" % system['content_view']['name']


        batch_add_columns(self.printer, {'name': _("Name")}, {'ipv4_address': _("IPv4 Address")}, \
            {'uuid': _("UUID")}, {'environment': _("Environment")}, {'location': _("Location")})
        self.printer.add_column('created_at', _("Registered"), formatter=format_date)
        self.printer.add_column('updated_at', _("Last Updated"), formatter=format_date)
        self.printer.add_column('description', _("Description"), multiline=True)
        if 'release' in system and system['release']:
            self.printer.add_column('release', _("OS Release"))
        self.printer.add_column('activation_keys', _("Activation Keys"), multiline=True, \
            show_with=printer.VerboseStrategy)
        self.printer.add_column('host', _("Host"), show_with=printer.VerboseStrategy)
        self.printer.add_column('sockets', _("Sockets"))
        self.printer.add_column('ram', _("RAM (MB)"))
        self.printer.add_column('serviceLevel', _("Service Level"))
        self.printer.add_column('guests', _("Guests"), show_with=printer.VerboseStrategy)
        self.printer.add_column('custom_info', _("Custom Info"), multiline=True, show_with=printer.VerboseStrategy)
        self.printer.add_column('content_view', _("Content View"))

        self.printer.print_item(system)

        return os.EX_OK
コード例 #27
0
ファイル: packagegroup.py プロジェクト: AsherBond/katello
    def run(self):
        repoid = self.get_option('repo_id')
        groups = self.api.packagegroups(repoid)
        if not groups:
            system_exit(os.EX_DATAERR,
                        _("No package groups found in repo [%s]") % (repoid))
        self.printer.set_header(_("Package Group Information"))

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

        self.printer.print_items(groups)

        return os.EX_OK
コード例 #28
0
ファイル: environment.py プロジェクト: bcrochet/katello
    def run(self):
        orgName = self.get_option('org')

        envs = self.api.environments_by_org(orgName)

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

        self.printer.set_header(_("Environment List"))
        self.printer.print_items(envs)
        return os.EX_OK
コード例 #29
0
ファイル: compute_resource.py プロジェクト: bcrochet/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
コード例 #30
0
ファイル: packagegroup.py プロジェクト: AsherBond/katello
    def run(self):
        categoryId = self.get_option('id')
        repoid = self.get_option('repo_id')
        category = self.api.packagegroupcategory_by_id(repoid, categoryId)

        if category == None:
            system_exit(os.EX_DATAERR, _("Package group category [%(categoryId)s] not found in repo [%(repoid)s]") \
                % {'categoryId':categoryId, 'repoid':repoid})

        self.printer.set_header(_("Package Group Category Information"))
        batch_add_columns(self.printer, {'id': _("ID")}, {'name': _("Name")}, \
            {'packagegroupids': _("Package Group IDs")})

        self.printer.print_item(category)