diff options
author | Matt Woodson <mwoodson@gmail.com> | 2016-02-15 16:24:51 -0500 |
---|---|---|
committer | Matt Woodson <mwoodson@gmail.com> | 2016-02-15 16:24:51 -0500 |
commit | ef56d0297d29dd0d65e8912daa1ede67c4d46516 (patch) | |
tree | 2e814b8937d4403768025dd1a52a56705949bb6b | |
parent | abba5eeb468a994caca5194eaf217e7527262613 (diff) | |
parent | 012428e6bccd562b8ecff3c21a42d4a3b15e53b3 (diff) | |
download | openshift-ef56d0297d29dd0d65e8912daa1ede67c4d46516.tar.gz openshift-ef56d0297d29dd0d65e8912daa1ede67c4d46516.tar.bz2 openshift-ef56d0297d29dd0d65e8912daa1ede67c4d46516.tar.xz openshift-ef56d0297d29dd0d65e8912daa1ede67c4d46516.zip |
Merge pull request #1403 from mwoodson/aws
oo_filter: added custom fitler to return hosts group info
-rw-r--r-- | filter_plugins/oo_filters.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py index dcda14c63..3dc3f2fe9 100644 --- a/filter_plugins/oo_filters.py +++ b/filter_plugins/oo_filters.py @@ -697,6 +697,19 @@ class FilterModule(object): return matching_pods + @staticmethod + def oo_get_hosts_from_hostvars(hostvars, hosts): + """ Return a list of hosts from hostvars """ + retval = [] + for host in hosts: + try: + retval.append(hostvars[host]) + except errors.AnsibleError as _: + # host does not exist + pass + + return retval + def filters(self): """ returns a mapping of filters to methods """ return { @@ -724,4 +737,5 @@ class FilterModule(object): "oo_persistent_volume_claims": self.oo_persistent_volume_claims, "oo_31_rpm_rename_conversion": self.oo_31_rpm_rename_conversion, "oo_pods_match_component": self.oo_pods_match_component, + "oo_get_hosts_from_hostvars": self.oo_get_hosts_from_hostvars, } |