Traceback (most recent call last):
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/site-packages/charms/reactive/__init__.py", line 73, in main
bus.dispatch(restricted=restricted_mode)
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/site-packages/charms/reactive/bus.py", line 382, in dispatch
_invoke(other_handlers)
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/site-packages/charms/reactive/bus.py", line 358, in _invoke
handler.invoke()
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/site-packages/charms/reactive/bus.py", line 180, in invoke
self._action(*args)
File "/var/lib/juju/agents/unit-foo-5/charm/reactive/telegraf.py", line 239, in configure_telegraf
if get_remote_unit_name() is None:
File "/var/lib/juju/agents/unit-foo-5/charm/reactive/telegraf.py", line 112, in get_remote_unit_name
unit = hookenv.principal_unit()
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/site-packages/charmhelpers/core/hookenv.py", line 223, in principal_unit
md = _metadata_unit(unit)
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/site-packages/charmhelpers/core/hookenv.py", line 546, in _metadata_unit
return yaml.safe_load(md)
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/site-packages/yaml/__init__.py", line 94, in safe_load
return load(stream, SafeLoader)
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/site-packages/yaml/__init__.py", line 70, in load
loader = Loader(stream)
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/site-packages/yaml/loader.py", line 24, in __init__
Reader.__init__(self, stream)
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/site-packages/yaml/reader.py", line 85, in __init__
self.determine_encoding()
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/site-packages/yaml/reader.py", line 124, in determine_encoding
self.update_raw()
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/site-packages/yaml/reader.py", line 178, in update_raw
data = self.stream.read(size)
File "/var/lib/juju/agents/unit-foo-5/.venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 694: ordinal not in range(128)
This is because the metadata file of a charm installed in the machine (elasticsearch, in this case) has a metadata.yaml encoded in UTF-8.
Hi,
I got the following traceback on a charm :
This is because the metadata file of a charm installed in the machine (elasticsearch, in this case) has a metadata.yaml encoded in UTF-8.
My charm isn't using the latest charm-helpers, but I can see that
yaml.safe_load()
is called the same way today : https://github.com/juju/charm-helpers/blob/master/charmhelpers/core/hookenv.py#L553Could we please handle this better ?
Thanks