From 7109c081d2b058ac29f2dab93552b68350f22401 Mon Sep 17 00:00:00 2001 From: George Kraft Date: Tue, 17 Dec 2013 14:22:08 -0600 Subject: CXMAN-223: Add partition_config command to CLI Convenience command to get partition config without having to manually use TFTP. --- cxmanage_api/cli/commands/fabric.py | 25 +++++++++++++++++++++++++ scripts/cxmanage | 8 +++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/cxmanage_api/cli/commands/fabric.py b/cxmanage_api/cli/commands/fabric.py index b42f797..49f73fd 100644 --- a/cxmanage_api/cli/commands/fabric.py +++ b/cxmanage_api/cli/commands/fabric.py @@ -81,3 +81,28 @@ def macaddrs_command(args): print "Some errors occured during the command.\n" return len(errors) == 0 + + +def partition_config_command(args): + """get partition config from nodes""" + args.all_nodes = False + + tftp = get_tftp(args) + nodes = get_nodes(args, tftp) + + if not args.quiet: + print "Getting partition config..." + results, errors = run_command( + args, nodes, "run_fabric_tftp_command", "fabric_info_partition_config" + ) + + for node in nodes: + if node in results: + print "[ Partition config from %s ]" % node.ip_address + print results[node].strip() + print + + if not args.quiet and errors: + print "Some errors occured during the command.\n" + + return len(errors) == 0 diff --git a/scripts/cxmanage b/scripts/cxmanage index c9e64f8..858c532 100755 --- a/scripts/cxmanage +++ b/scripts/cxmanage @@ -43,7 +43,8 @@ from cxmanage_api.cli.commands.power import power_command, \ from cxmanage_api.cli.commands.mc import mcreset_command from cxmanage_api.cli.commands.fw import fwupdate_command, fwinfo_command from cxmanage_api.cli.commands.sensor import sensor_command -from cxmanage_api.cli.commands.fabric import ipinfo_command, macaddrs_command +from cxmanage_api.cli.commands.fabric import ipinfo_command, macaddrs_command, \ + partition_config_command from cxmanage_api.cli.commands.config import config_reset_command, \ config_boot_command, config_pxe_command from cxmanage_api.cli.commands.info import info_command @@ -267,6 +268,11 @@ def build_parser(): help='get mac addresses') macaddrs.set_defaults(func=macaddrs_command) + # partition_config command + partition_config = subparsers.add_parser('partition_config', + help='get partition config') + partition_config.set_defaults(func=partition_config_command) + # config command config = subparsers.add_parser('config', help='configure hosts') config_subs = config.add_subparsers() -- cgit v1.2.1