diff options
author | Lénaïc Huard <lhuard@amadeus.com> | 2015-11-16 14:42:45 +0100 |
---|---|---|
committer | Lénaïc Huard <lhuard@amadeus.com> | 2015-11-16 14:42:45 +0100 |
commit | 3c560d4a589cb7c7144f25468e0c7d2d0768853d (patch) | |
tree | 640fe87d6888105959e06cb3555966a930458dd4 | |
parent | 332aa8c8219ba99510090ce2412326780ad9ce74 (diff) | |
download | openshift-3c560d4a589cb7c7144f25468e0c7d2d0768853d.tar.gz openshift-3c560d4a589cb7c7144f25468e0c7d2d0768853d.tar.bz2 openshift-3c560d4a589cb7c7144f25468e0c7d2d0768853d.tar.xz openshift-3c560d4a589cb7c7144f25468e0c7d2d0768853d.zip |
cluster list: break host types by subtype
-rw-r--r-- | filter_plugins/oo_filters.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py index cf141d4f8..2386b5878 100644 --- a/filter_plugins/oo_filters.py +++ b/filter_plugins/oo_filters.py @@ -433,13 +433,16 @@ class FilterModule(object): def _add_host(clusters, env, host_type, + sub_host_type, host): ''' Add a new host in the clusters data structure ''' if env not in clusters: clusters[env] = {} if host_type not in clusters[env]: - clusters[env][host_type] = [] - clusters[env][host_type].append(host) + clusters[env][host_type] = {} + if sub_host_type not in clusters[env][host_type]: + clusters[env][host_type][sub_host_type] = [] + clusters[env][host_type][sub_host_type].append(host) clusters = {} for host in data: @@ -447,10 +450,10 @@ class FilterModule(object): _add_host(clusters=clusters, env=_get_tag_value(host['group_names'], 'env'), host_type=_get_tag_value(host['group_names'], 'host-type'), + sub_host_type=_get_tag_value(host['group_names'], 'sub-host-type'), host={'name': host['inventory_hostname'], 'public IP': host['ansible_ssh_host'], - 'private IP': host['ansible_default_ipv4']['address'], - 'subtype': _get_tag_value(host['group_names'], 'sub-host-type')}) + 'private IP': host['ansible_default_ipv4']['address']}) except KeyError: pass return clusters |