diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cluster | 7 | ||||
-rwxr-xr-x | bin/ohi | 4 | ||||
-rw-r--r-- | bin/openshift_ansible/awsutil.py | 27 | ||||
-rwxr-xr-x | bin/oscp | 2 |
4 files changed, 37 insertions, 3 deletions
diff --git a/bin/cluster b/bin/cluster index c3b101c98..ecb8bc58e 100755 --- a/bin/cluster +++ b/bin/cluster @@ -264,6 +264,13 @@ if __name__ == '__main__': providers = gce,aws,libvirt,openstack """ + warning = ("================================================================================\n" + "ATTENTION: You are running a community supported utility that has not been\n" + "tested by Red Hat. Visit https://docs.openshift.com for supported installation\n" + "instructions.\n" + "================================================================================\n\n") + sys.stderr.write(warning) + cluster_config = ConfigParser.SafeConfigParser({ 'cluster_ids': 'marketing,sales', 'validate_cluster_ids': 'False', @@ -34,6 +34,7 @@ class Ohi(object): 'openshift_ansible', \ 'openshift_ansible.conf') + self.args = None self.parse_cli_args() self.parse_config_file() @@ -57,6 +58,7 @@ class Ohi(object): hosts = self.aws.get_host_list(clusters=self.args.cluster, host_type=self.args.host_type, + sub_host_type=self.args.sub_host_type, envs=self.args.env, version=version, cached=self.args.cache_only) @@ -104,6 +106,8 @@ class Ohi(object): parser.add_argument('-t', '--host-type', action="store", help="Which host type to use") + parser.add_argument('-s', '--sub-host-type', action="store", help="Which sub host type to use") + parser.add_argument('-l', '--user', action='store', default=None, help='username') parser.add_argument('--cache-only', action='store_true', default=False, diff --git a/bin/openshift_ansible/awsutil.py b/bin/openshift_ansible/awsutil.py index 945e6a20c..eba11e851 100644 --- a/bin/openshift_ansible/awsutil.py +++ b/bin/openshift_ansible/awsutil.py @@ -31,6 +31,7 @@ class AwsUtil(object): host_type_aliases -- a list of aliases to common host-types (e.g. ex-node) """ + self.alias_lookup = {} host_type_aliases = host_type_aliases or {} self.host_type_aliases = host_type_aliases @@ -40,7 +41,6 @@ class AwsUtil(object): def setup_host_type_alias_lookup(self): """Sets up the alias to host-type lookup table.""" - self.alias_lookup = {} for key, values in self.host_type_aliases.iteritems(): for value in values: self.alias_lookup[value] = key @@ -101,6 +101,20 @@ class AwsUtil(object): host_types.sort() return host_types + def get_sub_host_types(self): + """Searches for sub-host-type tags in the inventory and returns all sub-host-types found.""" + pattern = re.compile(r'^oo_subhosttype_(.*)') + + sub_host_types = [] + inv = self.get_inventory() + for key in inv.keys(): + matched = pattern.match(key) + if matched: + sub_host_types.append(matched.group(1)) + + sub_host_types.sort() + return sub_host_types + def get_security_groups(self): """Searches for security_groups in the inventory and returns all SGs found.""" pattern = re.compile(r'^security_group_(.*)') @@ -192,9 +206,15 @@ class AwsUtil(object): host_type = self.resolve_host_type(host_type) return "oo_hosttype_%s" % host_type + @staticmethod + def gen_sub_host_type_tag(sub_host_type): + """Generate the host type tag + """ + return "oo_subhosttype_%s" % sub_host_type + # This function uses all of these params to perform a filters on our host inventory. # pylint: disable=too-many-arguments - def get_host_list(self, clusters=None, host_type=None, envs=None, version=None, cached=False): + def get_host_list(self, clusters=None, host_type=None, sub_host_type=None, envs=None, version=None, cached=False): """Get the list of hosts from the inventory using host-type and environment """ retval = set([]) @@ -229,6 +249,9 @@ class AwsUtil(object): if host_type: retval.intersection_update(inv.get(self.gen_host_type_tag(host_type, version), [])) + if sub_host_type: + retval.intersection_update(inv.get(self.gen_sub_host_type_tag(sub_host_type), [])) + if version != 'all': retval.intersection_update(inv.get(AwsUtil.gen_version_tag(version), [])) @@ -211,7 +211,7 @@ class Oscp(object): # Assume we have one and only one. hostname, server_info = results[0] - dns = server_info['oo_pulic_ip'] + dns = server_info['oo_public_ip'] host_str = "%s%s%s" % (self.user, dns, self.path) |