Allow unicode for metadata keys in publisher
I encountered a bug whith the following configuration in monasca_field_definitions.yaml: metadata: cpu: - flavor_id: flavor["id"] - flavor_name: flavor["name"] The problem was in _get_value_metadata_for_key(): sometimes keys from ceilometer samples can be unicode. Change-Id: I8914c2238f3a450393f07e6309f57451c8c45cf2
This commit is contained in:
parent
4a2c73685f
commit
cdedb90ed8
|
@ -19,6 +19,7 @@ import datetime
|
||||||
from jsonpath_rw_ext import parser
|
from jsonpath_rw_ext import parser
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
import six
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from ceilometer.ceilosca_mapping.ceilosca_mapping import (
|
from ceilometer.ceilosca_mapping.ceilosca_mapping import (
|
||||||
|
@ -125,7 +126,8 @@ class MonascaDataFilter(object):
|
||||||
if len(val_matches) > 0:
|
if len(val_matches) > 0:
|
||||||
# resolve the find to the first match and get value
|
# resolve the find to the first match and get value
|
||||||
val = val_matches[0].value
|
val = val_matches[0].value
|
||||||
if not isinstance(val, str) and not isinstance(val, int):
|
if not isinstance(val, (str, six.text_type)) \
|
||||||
|
and not isinstance(val, int):
|
||||||
# Don't support lists or dicts or ...
|
# Don't support lists or dicts or ...
|
||||||
raise CeiloscaMappingDefinitionException(
|
raise CeiloscaMappingDefinitionException(
|
||||||
"Metadata format mismatch, value "
|
"Metadata format mismatch, value "
|
||||||
|
|
Loading…
Reference in New Issue