From 6c7d87675345624c37648180f194f3a84ad45b13 Mon Sep 17 00:00:00 2001 From: George Kraft Date: Tue, 17 Dec 2013 16:30:16 -0600 Subject: CXMAN-278: Add LAN info to tspackage command Basically just a dump of "ipmitool lan print" --- cxmanage_api/cli/__init__.py | 5 ++++- cxmanage_api/cli/commands/tspackage.py | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/cxmanage_api/cli/__init__.py b/cxmanage_api/cli/__init__.py index 00a7886..ea4284a 100644 --- a/cxmanage_api/cli/__init__.py +++ b/cxmanage_api/cli/__init__.py @@ -190,7 +190,10 @@ def run_command(args, nodes, name, *method_args): tasks = {} for node in nodes: - tasks[node] = task_queue.put(getattr(node, name), *method_args) + target = node + for member in name.split("."): + target = getattr(target, member) + tasks[node] = task_queue.put(target, *method_args) results = {} errors = {} diff --git a/cxmanage_api/cli/commands/tspackage.py b/cxmanage_api/cli/commands/tspackage.py index 0a4beb3..75158a8 100644 --- a/cxmanage_api/cli/commands/tspackage.py +++ b/cxmanage_api/cli/commands/tspackage.py @@ -93,6 +93,10 @@ def tspackage_command(args): print("Getting version information...") write_version_info(args, nodes) + if not quit: + print("Getting LAN information...") + write_lan_info(args, nodes) + if not quiet: print("Getting boot order...") write_boot_order(args, nodes) @@ -200,6 +204,19 @@ def write_version_info(args, nodes): write_to_file(node, lines) + +def write_lan_info(args, nodes): + """Write LAN info for each node""" + results, _ = run_command(args, nodes, "bmc.lan_print") + + for node in nodes: + lines = ["\n[ LAN info for Node %s ]" % node.node_id] + for (key, value) in sorted(vars(results[node]).items()): + lines.append("%s: %s" % (key, value)) + + write_to_file(node, lines) + + def write_mac_addrs(args, nodes): """Write the MAC addresses for each node to their respective files.""" mac_addr_results, _ = run_command( -- cgit v1.2.1