diff options
author | George Kraft <george.kraft@calxeda.com> | 2013-11-05 12:28:57 -0600 |
---|---|---|
committer | George Kraft <george.kraft@calxeda.com> | 2013-11-05 12:28:57 -0600 |
commit | 081d083cff8c9e4477a93bc1ba5dc213a867021a (patch) | |
tree | 79453e3dc8a5e5903a47b652c1111589ce8b7276 | |
parent | f0a8672967a708136151a3b42150e7ee50ec2e40 (diff) | |
download | cxmanage-081d083cff8c9e4477a93bc1ba5dc213a867021a.tar.gz |
CXMAN-242: Add ECME serial logs to tspackage
-rw-r--r-- | cxmanage_api/cli/commands/tspackage.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cxmanage_api/cli/commands/tspackage.py b/cxmanage_api/cli/commands/tspackage.py index c0c18c5..10b812d 100644 --- a/cxmanage_api/cli/commands/tspackage.py +++ b/cxmanage_api/cli/commands/tspackage.py @@ -115,6 +115,14 @@ def tspackage_command(args): print("Getting routing tables...") write_routing_table(args, nodes) + if not quiet: + print("Getting serial log...") + write_serial_log(args, nodes) + + if not quiet: + print("Getting crash log...") + write_crash_log(args, nodes) + # Archive the files archive(os.getcwd(), original_dir) @@ -358,6 +366,30 @@ def write_routing_table(args, nodes): write_to_file(node, lines) +def write_serial_log(args, nodes): + """Write the serial log for each node""" + results, errors = run_command(args, nodes, "read_fru", 98) + for node in nodes: + lines = ["\n[ Serial log for Node %d ]" % node.node_id] + if node in results: + lines.append(results[node].strip()) + else: + lines.append(str(errors[node])) + write_to_file(node, lines) + + +def write_crash_log(args, nodes): + """Write the crash log for each node""" + results, errors = run_command(args, nodes, "read_fru", 99) + for node in nodes: + lines = ["\n[ Crash log for Node %d ]" % node.node_id] + if node in results: + lines.append(results[node].strip()) + else: + lines.append(str(errors[node])) + write_to_file(node, lines) + + def write_to_file(node, to_write, add_newlines=True): """Append to_write to an info file for every node in nodes. |