summaryrefslogtreecommitdiffstats
path: root/filter_plugins
diff options
context:
space:
mode:
authorThomas Wiest <twiest@users.noreply.github.com>2015-04-20 17:25:57 -0400
committerThomas Wiest <twiest@users.noreply.github.com>2015-04-20 17:25:57 -0400
commit96dd0ab929b7f391eee9b23209aa377537114b72 (patch)
treed1f9aa5becd04097213fe56aa4982bd35830df10 /filter_plugins
parent0722304b2f9c94a2f70054e0a3c7feceaedb195c (diff)
parentdbb252bc04a6488c1fde05dbc325b246fd4a651e (diff)
downloadopenshift-96dd0ab929b7f391eee9b23209aa377537114b72.tar.gz
openshift-96dd0ab929b7f391eee9b23209aa377537114b72.tar.bz2
openshift-96dd0ab929b7f391eee9b23209aa377537114b72.tar.xz
openshift-96dd0ab929b7f391eee9b23209aa377537114b72.zip
Merge pull request #139 from detiber/configUpdatesMaster
Massive refactor, deployment-type support, config updates, reduce duplication
Diffstat (limited to 'filter_plugins')
-rw-r--r--filter_plugins/oo_filters.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index 1cf02218c..cf30cde9a 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -5,6 +5,7 @@
from ansible import errors, runner
import json
import pdb
+import re
def oo_pdb(arg):
''' This pops you into a pdb instance where arg is the data passed in from the filter.
@@ -101,6 +102,18 @@ def oo_prepend_strings_in_list(data, prepend):
retval = [prepend + s for s in data]
return retval
+def oo_get_deployment_type_from_groups(data):
+ ''' This takes a list of groups and returns the associated
+ deployment-type
+ '''
+ if not issubclass(type(data), list):
+ raise errors.AnsibleFilterError("|failed expects first param is a list")
+ regexp = re.compile('^tag_deployment-type[-_]')
+ matches = filter(regexp.match, data)
+ if len(matches) > 0:
+ return regexp.sub('', matches[0])
+ return "Unknown"
+
class FilterModule (object):
def filters(self):
return {
@@ -109,5 +122,6 @@ class FilterModule (object):
"oo_flatten": oo_flatten,
"oo_len": oo_len,
"oo_pdb": oo_pdb,
- "oo_prepend_strings_in_list": oo_prepend_strings_in_list
+ "oo_prepend_strings_in_list": oo_prepend_strings_in_list,
+ "oo_get_deployment_type_from_groups": oo_get_deployment_type_from_groups
}