diff options
author | Aaron Smith <aasmith@redhat.com> | 2017-11-08 18:51:22 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-11-08 18:51:23 +0000 |
commit | 79270d2c4435cc9a5cddf24dd20ed21df6e15f58 (patch) | |
tree | 40a08bca63a77769d464ae0e85d8876cf240bb21 /3rd_party/collectd-ves-app/ves_app/normalizer.py | |
parent | 301fb78df67c06021c8996eb77441581d92dbc14 (diff) | |
parent | 4ae8eca14448bac6be46fbbf22d2ddc5d8ae7028 (diff) |
Merge "VES: add new tag to strip extra dashes"
Diffstat (limited to '3rd_party/collectd-ves-app/ves_app/normalizer.py')
-rw-r--r-- | 3rd_party/collectd-ves-app/ves_app/normalizer.py | 11 |
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' |