Add command 'reclass-vcp-list'
Shows all VM names that will be used for VCP
in the parameters.salt.control.cluster object on all nodes
diff --git a/reclass_tools/cli.py b/reclass_tools/cli.py
index 8b4ebe7..48e3d9f 100644
--- a/reclass_tools/cli.py
+++ b/reclass_tools/cli.py
@@ -91,6 +91,7 @@
verbose=params.verbose,
pretend=pretend)
+
def inventory_list(args=None):
try:
from reclass_tools import reclass_models
@@ -106,4 +107,25 @@
params = parser.parse_args(args)
- reclass_models.inventory_list(domain=params.domain)
+ inventory = reclass_models.inventory_list(domain=params.domain)
+
+ print('\n'.join(sorted(inventory.keys())))
+
+def vcp_list(args=None):
+ try:
+ from reclass_tools import reclass_models
+ except ImportError:
+ print("Please run this tool on the salt-master node with installed 'reclass'")
+ return
+
+ parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
+ description="")
+ parser.add_argument('--domain', '-d', dest='domain',
+ help=('Show only the nodes which names are ended with the specified domain, for example:'
+ ' reclass-inventory-list -d example.local'))
+
+ params = parser.parse_args(args)
+
+ vcp_node_names = reclass_models.vcp_list(domain=params.domain)
+ print('\n'.join(sorted(vcp_node_names)))
+