diff options
author | ewolinetz <ewolinet@redhat.com> | 2017-01-17 14:42:41 -0600 |
---|---|---|
committer | ewolinetz <ewolinet@redhat.com> | 2017-01-17 17:59:47 -0600 |
commit | 598b2652ac9bfe94622cbe6324d4f121bf996c70 (patch) | |
tree | 92a612b90a8ed659b79897816cabc5ec5c2bc568 /roles/openshift_logging/filter_plugins | |
parent | 427d4c235c58196f5745184c9d0b3e6bc2a92618 (diff) | |
download | openshift-598b2652ac9bfe94622cbe6324d4f121bf996c70.tar.gz openshift-598b2652ac9bfe94622cbe6324d4f121bf996c70.tar.bz2 openshift-598b2652ac9bfe94622cbe6324d4f121bf996c70.tar.xz openshift-598b2652ac9bfe94622cbe6324d4f121bf996c70.zip |
Addressing Travis errors
Diffstat (limited to 'roles/openshift_logging/filter_plugins')
-rw-r--r-- | roles/openshift_logging/filter_plugins/openshift_logging.py | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/roles/openshift_logging/filter_plugins/openshift_logging.py b/roles/openshift_logging/filter_plugins/openshift_logging.py index b42d5da5f..007be3ac0 100644 --- a/roles/openshift_logging/filter_plugins/openshift_logging.py +++ b/roles/openshift_logging/filter_plugins/openshift_logging.py @@ -1,28 +1,37 @@ -import random, string -import shutil -import sys -import StringIO +''' + Openshift Logging class that provides useful filters used in Logging +''' -def random_word(source_alpha,length): +import random + + +def random_word(source_alpha, length): + ''' Returns a random word given the source of characters to pick from and resulting length ''' return ''.join(random.choice(source_alpha) for i in range(length)) + def entry_from_named_pair(register_pairs, key): - from ansible.utils.display import Display + ''' Returns the entry in key given results provided by register_pairs ''' results = register_pairs.get("results") - if results == None: - raise RuntimeError("The dict argument does not have a 'results' entry. Must not have been created using 'register' in a loop") + if results is None: + raise RuntimeError("The dict argument does not have a 'results' entry. " + "Must not have been created using 'register' in a loop") for result in results: item = result.get("item") - if item != None: - name = item.get("name") + if item is not None: + name = item.get("name") if name == key: return result["content"] raise RuntimeError("There was no entry found in the dict that had an item with a name that matched {}".format(key)) + +# 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 { 'random_word': random_word, 'entry_from_named_pair': entry_from_named_pair, |