def do_osimage_show(cc, args): """Show detailed information about osimage.""" fields = [] if args.fields: fields = args.fields.split(',') if fields and 'name' not in fields: fields.append('name') result = cc.osimage.show(args.name, fields) cliutils.print_dict(result)
def do_passwd_show(cc, args): """Show detailed information about passwd.""" fields = [] if args.fields: fields = args.fields.split(',') if fields and 'key' not in fields: fields.append('key') result = cc.passwd.show(args.key, fields) cliutils.print_dict(result)
def do_nic_show(cc, args): """Show detailed infomation about nic.""" fields = [] if args.fields: fields = args.fields.split(',') if fields and 'uuid' not in fields: fields.append('uuid') if args.uuid: result = cc.nic.show(args.uuid, fields) elif args.mac: result = cc.nic.get_by_mac(args.mac) else: print(_("Invalid argument given.")) return cliutils.print_dict(result)
def do_show(cc, args): """Show detailed information about node(s).""" def format(result): out = [] if result.has_key('nodes'): result = result.get('nodes') for r in result: node = dict() node['node'] = r.get('name') node['attr'] = r out.append(node) else: node = dict() node['node'] = result.get('name') node['attr'] = result out.append(node) return out nodes = _get_node_from_args(args.nodes) fields = [] if args.fields: fields = args.fields.split(',') if fields and 'name' not in fields: fields.append('name') if 'nics' in fields: fields.remove('nics') fields.append('nics_info') if 'control' in fields: fields.remove('control') fields.append('control_info') if len(nodes) == 1: result = cc.node.show(nodes[0], fields) result = format(result) cliutils.print_dict(result) return node_dict = {'nodes': []} map(lambda x: node_dict['nodes'].append({'name': x}), nodes) result = cc.node.get(node_dict, fields) result = format(result) cliutils.print_dict(result)
def do_service_show(cc, args): """Show detailed information about service.""" result = cc.service.get_by_hostname(args.hostname) cliutils.print_dict(result)
def do_osimage_update(cc, args): """Update information about registered osimage.""" patch = utils.args_array_to_patch(args.attributes[0]) result = cc.osimage.update(args.name, patch) cliutils.print_dict(result)
def do_nic_create(cc, args): """Register nic into xCAT3 service.""" dct = utils.to_attrs_dict(args.attributes[0], VALID_FIELDS) _validate(dct) result = cc.nic.post(dct) cliutils.print_dict(result)
def do_nic_update(cc, args): """Update information about registered nic(s).""" patch = utils.args_array_to_patch(args.attributes[0]) result = cc.nic.update(args.uuid, patch) cliutils.print_dict(result)
def do_network_create(cc, args): """Register network into xCAT3 service.""" dct = utils.to_attrs_dict(args.attributes[0], VALID_FIELDS) dct['name'] = args.name result = cc.network.post(dct) cliutils.print_dict(result)
def do_network_update(cc, args): """Update information about registered network(s).""" patch = utils.args_array_to_patch(args.attributes[0]) result = cc.network.update(args.name, patch) cliutils.print_dict(result)
def do_passwd_create(cc, args): """Register passwd into xCAT3 service.""" dct = utils.to_attrs_dict(args.attributes[0], VALID_FIELDS) dct['key'] = args.key result = cc.passwd.post(dct) cliutils.print_dict(result)
def do_passwd_update(cc, args): """Update information about registered passwd.""" patch = utils.args_array_to_patch(args.attributes[0]) result = cc.passwd.update(args.key, patch) cliutils.print_dict(result)