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)
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)
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)
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)
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)
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
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)
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
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)
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)
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)
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
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)
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)
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)
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)
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)
def run(self): resource = self.api.show(self.get_option("name")) resource = unnest_one(resource) batch_add_columns( self.printer, {"id": _("ID")}, {"name": _("Name")}, {"url": _("Url")}, {"provider": _("Provider")} ) self.printer.add_column("description", _("Description"), multiline=True) provider_fields = self.PROVIDER_SPECIFIC_FIELDS.get(resource["provider"].lower(), tuple()) batch_add_columns(self.printer, *provider_fields) batch_add_columns( self.printer, {"created_at": _("Created At")}, {"updated_at": _("Updated At")}, formatter=format_date ) self.printer.set_header(_("Compute Resource")) self.printer.print_item(resource) return os.EX_OK
def run(self): smartproxy = self.api.create(self.get_option_dict('name', 'url')) print _('Smart Proxy [ %s ] created') % unnest_one(smartproxy)['name']
def run(self): proxies = unnest_one(self.api.list()) batch_add_columns(self.printer, {'name': _("Name")}, {'url': _("URL")}) self.printer.set_header(_("Smart Proxies")) self.printer.print_items(proxies)