summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kraft <george.kraft@calxeda.com>2013-12-17 14:22:08 -0600
committerGeorge Kraft <george.kraft@calxeda.com>2013-12-17 14:22:08 -0600
commit7109c081d2b058ac29f2dab93552b68350f22401 (patch)
treefbdeea03784fbfa03ac50afe782fddc96021f992
parentf2b9396d3b06c7d10f9223f015b8f8e41a8dedb5 (diff)
downloadcxmanage-7109c081d2b058ac29f2dab93552b68350f22401.tar.gz
CXMAN-223: Add partition_config command to CLI
Convenience command to get partition config without having to manually use TFTP.
-rw-r--r--cxmanage_api/cli/commands/fabric.py25
-rwxr-xr-xscripts/cxmanage8
2 files changed, 32 insertions, 1 deletions
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()