diff options
author | Jason DeTiberus <jdetiber@redhat.com> | 2015-05-22 13:13:17 -0400 |
---|---|---|
committer | Jason DeTiberus <jdetiber@redhat.com> | 2015-06-10 11:43:47 -0400 |
commit | 94a77cb1d81b6e4e316ae679890df4994816532f (patch) | |
tree | 3a77b836f726f2d972931ae777421888f67aa1ed /filter_plugins | |
parent | b57392ddd54bbff225ba83dd5a5bf40ea99344a4 (diff) | |
download | openshift-94a77cb1d81b6e4e316ae679890df4994816532f.tar.gz openshift-94a77cb1d81b6e4e316ae679890df4994816532f.tar.bz2 openshift-94a77cb1d81b6e4e316ae679890df4994816532f.tar.xz openshift-94a77cb1d81b6e4e316ae679890df4994816532f.zip |
Templatize configs and 0.5.2 changes
- Templatize node config
- Templatize master config
- Integrated sdn changes
- Updates for openshift_facts
- Added support for node, master and sdn related changes
- registry_url
- added identity provider facts
- Removed openshift_sdn_* roles
- Install httpd-tools if configuring htpasswd auth
- Remove references to external_id
- Setting external_id interferes with nodes associating with the generated
node object when pre-registering nodes.
- osc/oc and osadm/oadm binary detection in openshift_facts
Misc Changes:
- make non-errata puddle default for byo example
- comment out master in list of nodes in inventory/byo/hosts
- remove non-error errors from fluentd_* roles
- Use admin kubeconfig instead of openshift-client
Diffstat (limited to 'filter_plugins')
-rw-r--r-- | filter_plugins/oo_filters.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py index 476761715..b7248efaa 100644 --- a/filter_plugins/oo_filters.py +++ b/filter_plugins/oo_filters.py @@ -202,6 +202,26 @@ class FilterModule(object): ''' return string.split(separator) + @staticmethod + def oo_filter_list(data, filter_attr=None): + ''' This returns a list, which contains all items where filter_attr + evaluates to true + Ex: data = [ { a: 1, b: True }, + { a: 3, b: False }, + { a: 5, b: True } ] + filter_attr = 'b' + returns [ { a: 1, b: True }, + { a: 5, b: True } ] + ''' + if not issubclass(type(data), list): + raise errors.AnsibleFilterError("|failed expects to filter on a list") + + if not issubclass(type(filter_attr), str): + raise errors.AnsibleFilterError("|failed expects filter_attr is a str") + + # Gather up the values for the list of keys passed in + return [x for x in data if x[filter_attr]] + def filters(self): ''' returns a mapping of filters to methods ''' return { @@ -214,4 +234,5 @@ class FilterModule(object): "oo_ec2_volume_definition": self.oo_ec2_volume_definition, "oo_combine_key_value": self.oo_combine_key_value, "oo_split": self.oo_split, + "oo_filter_list": self.oo_filter_list } |