Пример #1
0
    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
Пример #2
0
    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
Пример #3
0
    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")}, \
            {'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
    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
Пример #5
0
    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)
        if "template" in system:
            self.printer.add_column(
                "template", _("Template"), show_with=printer.VerboseStrategy, value=system["template"]["name"]
            )
        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