From a4651da344f6026b4f8129b04e4dddea3dd62cb0 Mon Sep 17 00:00:00 2001 From: nervo Date: Wed, 21 Oct 2020 14:30:00 +0200 Subject: [PATCH] [Telegraf] Missing dependency in filters --- CHANGELOG.md | 2 ++ filter_plugins/manala_telegraf.py | 16 +++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26d8032..8553864 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Fixed +- Missing dependency in filters ## [2.0.7] - 2020-10-20 ### Added diff --git a/filter_plugins/manala_telegraf.py b/filter_plugins/manala_telegraf.py index ba09c8e..25f046b 100644 --- a/filter_plugins/manala_telegraf.py +++ b/filter_plugins/manala_telegraf.py @@ -6,8 +6,16 @@ import re +""" +Config Encoder Filters +More information: https://github.com/jtyr/ansible-config_encoder_filters +""" + +try: + basestring +except NameError: + basestring = str -# See: https://github.com/jtyr/ansible-config_encoder_filters def _is_num(data): """Verify if data is either int or float. Could be replaced by: @@ -18,7 +26,6 @@ def _is_num(data): return isinstance(data, int) or isinstance(data, float) -# See: https://github.com/jtyr/ansible-config_encoder_filters def _escape(data, quote='"', format=None): """Escape special characters in a string.""" @@ -41,13 +48,11 @@ def _escape(data, quote='"', format=None): else: return data -# See: https://github.com/jtyr/ansible-config_encoder_filters def _str_is_int(data): """Verify if data is integer.""" return re.match(r"^[-+]?(0|[1-9][0-9]*)$", str(data)) -# See: https://github.com/jtyr/ansible-config_encoder_filters def _str_is_float(data): """Verify if data is float.""" @@ -55,19 +60,16 @@ def _str_is_float(data): r"^[-+]?(0|[1-9][0-9]*)(\.[0-9]*)?(e[-+]?[0-9]+)?$", str(data), flags=re.IGNORECASE) -# See: https://github.com/jtyr/ansible-config_encoder_filters def _str_is_num(data): """Verify if data is either integer or float.""" return _str_is_int(data) or _str_is_float(data) -# See: https://github.com/jtyr/ansible-config_encoder_filters def _str_is_bool(data): """Verify if data is boolean.""" return re.match(r"^(true|false)$", str(data), flags=re.IGNORECASE) -# See: https://github.com/jtyr/ansible-config_encoder_filters def encode_toml( data, convert_bools=False, convert_nums=False, first=True, quote='"', table_name="", table_type=None):