diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2017-10-04 15:00:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-04 15:00:21 -0700 |
commit | cb7505c0f76f8388b49b36550376fbae1654c04f (patch) | |
tree | 1182a2efab5b3d5e09008ccf74baf06b6fc9b061 /roles/openshift_sanitize_inventory/filter_plugins/openshift_sanitize_inventory.py | |
parent | 9929c67a7011027b1e9fc467d7ca0992a0329ab0 (diff) | |
parent | fb9f2062cae9744854f948285a79e1718a5837d1 (diff) | |
download | openshift-cb7505c0f76f8388b49b36550376fbae1654c04f.tar.gz openshift-cb7505c0f76f8388b49b36550376fbae1654c04f.tar.bz2 openshift-cb7505c0f76f8388b49b36550376fbae1654c04f.tar.xz openshift-cb7505c0f76f8388b49b36550376fbae1654c04f.zip |
Merge pull request #5566 from ewolinetz/bz1415297
Automatic merge from submit-queue.
Validate storage kinds aren't dynamic without dynamic provisioning enabled
Checking if any openshift_*_storage_kind variables are set to dynamic without enabling dynamic provisioning nor setting a cloud provider.
Addresses https://bugzilla.redhat.com/show_bug.cgi?id=1415297
Diffstat (limited to 'roles/openshift_sanitize_inventory/filter_plugins/openshift_sanitize_inventory.py')
-rw-r--r-- | roles/openshift_sanitize_inventory/filter_plugins/openshift_sanitize_inventory.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/roles/openshift_sanitize_inventory/filter_plugins/openshift_sanitize_inventory.py b/roles/openshift_sanitize_inventory/filter_plugins/openshift_sanitize_inventory.py new file mode 100644 index 000000000..72c47b8ee --- /dev/null +++ b/roles/openshift_sanitize_inventory/filter_plugins/openshift_sanitize_inventory.py @@ -0,0 +1,44 @@ +''' + Openshift Sanitize inventory class that provides useful filters used in Logging. +''' + + +import re + + +# This should be removed after map_from_pairs is no longer used in __deprecations_logging.yml +def map_from_pairs(source, delim="="): + ''' Returns a dict given the source and delim delimited ''' + if source == '': + return dict() + + return dict(item.split(delim) for item in source.split(",")) + + +def vars_with_pattern(source, pattern=""): + ''' Returns a list of variables whose name matches the given pattern ''' + if source == '': + return list() + + var_list = list() + + var_pattern = re.compile(pattern) + + for item in source: + if var_pattern.match(item): + var_list.append(item) + + return var_list + + +# pylint: disable=too-few-public-methods +class FilterModule(object): + ''' OpenShift Logging Filters ''' + + # pylint: disable=no-self-use, too-few-public-methods + def filters(self): + ''' Returns the names of the filters provided by this class ''' + return { + 'map_from_pairs': map_from_pairs, + 'vars_with_pattern': vars_with_pattern + } |