From 029abcad0ab431ac53b680fae2938541dbaed3ce Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Fri, 8 Jan 2016 13:28:06 -0500 Subject: Update to metadata tooling. --- bin/ohi | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) (limited to 'bin/ohi') diff --git a/bin/ohi b/bin/ohi index be9c53ec0..d71a4c4b1 100755 --- a/bin/ohi +++ b/bin/ohi @@ -48,28 +48,18 @@ class Ohi(object): self.aws.print_host_types() return 0 - hosts = None - if self.args.host_type is not None and \ - self.args.env is not None: - # Both env and host-type specified - hosts = self.aws.get_host_list(host_type=self.args.host_type, - envs=self.args.env, - version=self.args.openshift_version, - cached=self.args.cache_only) - - if self.args.host_type is None and \ - self.args.env is not None: - # Only env specified - hosts = self.aws.get_host_list(envs=self.args.env, - version=self.args.openshift_version, - cached=self.args.cache_only) - - if self.args.host_type is not None and \ - self.args.env is None: - # Only host-type specified - hosts = self.aws.get_host_list(host_type=self.args.host_type, - version=self.args.openshift_version, - cached=self.args.cache_only) + if self.args.v3: + version = '3' + elif self.args.all_versions: + version = 'all' + else: + version = '2' + + hosts = self.aws.get_host_list(clusters=self.args.cluster, + host_type=self.args.host_type, + envs=self.args.env, + version=version, + cached=self.args.cache_only) if hosts is None: # We weren't able to determine what they wanted to do @@ -104,19 +94,26 @@ class Ohi(object): parser = argparse.ArgumentParser(description='OpenShift Host Inventory') parser.add_argument('--list-host-types', default=False, action='store_true', help='List all of the host types') + parser.add_argument('--list', default=False, action='store_true', help='List all hosts') - parser.add_argument('-e', '--env', action="store", help="Which environment to use") + parser.add_argument('-c', '--cluster', action="append", help="Which clusterid to use") + parser.add_argument('-e', '--env', action="append", help="Which environment to use") parser.add_argument('-t', '--host-type', action="store", help="Which host type to use") parser.add_argument('-l', '--user', action='store', default=None, help='username') - parser.add_argument('-c', '--cache-only', action='store_true', default=False, + parser.add_argument('--cache-only', action='store_true', default=False, help='Retrieve the host inventory by cache only. Default is false.') - parser.add_argument('-o', '--openshift-version', action='store', default='2', + parser.add_argument('--v2', action='store_true', default=True, help='Specify the openshift version. Default is 2') + parser.add_argument('--v3', action='store_true', default=False, + help='Specify the openshift version.') + + parser.add_argument('--all-versions', action='store_true', default=False, + help='Specify the openshift version. Return all versions') self.args = parser.parse_args() -- cgit v1.2.3