summaryrefslogtreecommitdiffstats
path: root/3rd_party/collectd-ves-app/ves_app/normalizer.py
diff options
context:
space:
mode:
Diffstat (limited to '3rd_party/collectd-ves-app/ves_app/normalizer.py')
-rw-r--r--3rd_party/collectd-ves-app/ves_app/normalizer.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/3rd_party/collectd-ves-app/ves_app/normalizer.py b/3rd_party/collectd-ves-app/ves_app/normalizer.py
index ddaad617..84de5e33 100644
--- a/3rd_party/collectd-ves-app/ves_app/normalizer.py
+++ b/3rd_party/collectd-ves-app/ves_app/normalizer.py
@@ -288,7 +288,7 @@ class Item(yaml.YAMLObject):
def format_node(cls, mapping, metric):
if mapping.tag in [
'tag:yaml.org,2002:str', Bytes2Kibibytes.yaml_tag,
- Number.yaml_tag]:
+ Number.yaml_tag, StripExtraDash.yaml_tag]:
return yaml.ScalarNode(mapping.tag, mapping.value.format(**metric))
elif mapping.tag == 'tag:yaml.org,2002:map':
values = []
@@ -459,6 +459,15 @@ class Number(yaml.YAMLObject):
return float(node.value)
+class StripExtraDash(yaml.YAMLObject):
+ """Class to process StripExtraDash tag"""
+ yaml_tag = u'!StripExtraDash'
+
+ @classmethod
+ def from_yaml(cls, loader, node):
+ return '-'.join([ x for x in node.value.split('-') if len(x) > 0])
+
+
class MapValue(yaml.YAMLObject):
"""Class to process MapValue tag"""
yaml_tag = u'!MapValue'