summaryrefslogtreecommitdiffstats
path: root/filter_plugins
diff options
context:
space:
mode:
authorMatt Woodson <mwoodson@redhat.com>2016-02-15 16:09:08 -0500
committerMatt Woodson <mwoodson@redhat.com>2016-02-15 16:09:08 -0500
commit012428e6bccd562b8ecff3c21a42d4a3b15e53b3 (patch)
tree2e814b8937d4403768025dd1a52a56705949bb6b /filter_plugins
parentabba5eeb468a994caca5194eaf217e7527262613 (diff)
downloadopenshift-012428e6bccd562b8ecff3c21a42d4a3b15e53b3.tar.gz
openshift-012428e6bccd562b8ecff3c21a42d4a3b15e53b3.tar.bz2
openshift-012428e6bccd562b8ecff3c21a42d4a3b15e53b3.tar.xz
openshift-012428e6bccd562b8ecff3c21a42d4a3b15e53b3.zip
oo_filter: added custom fitler to return hosts group info
Diffstat (limited to 'filter_plugins')
-rw-r--r--filter_plugins/oo_filters.py14
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,
}