Comment 4 for bug 1832605

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

To add to #3.

Unsetting "LANG" is also necessary.

> /var/lib/juju/agents/unit-keystone-saml-mellon-1/.venv/lib/python3.6/site-packages/charmhelpers/core/hookenv.py(620)metadata()
    619 ipdb.set_trace()
--> 620 with open(os.path.join(charm_dir(), 'metadata.yaml')) as md:
    621 return yaml.safe_load(md)

ipdb> n
> /var/lib/juju/agents/unit-keystone-saml-mellon-1/.venv/lib/python3.6/site-packages/charmhelpers/core/hookenv.py(621)metadata()
    620 with open(os.path.join(charm_dir(), 'metadata.yaml')) as md:
--> 621 return yaml.safe_load(md)
    622

ipdb> md
<_io.TextIOWrapper name='/var/lib/juju/agents/unit-keystone-saml-mellon-1/charm/metadata.yaml' mode='r' encoding='ANSI_X3.4-1968'>
ipdb> os.path.join(charm_dir(), 'metadata.yaml')
'/var/lib/juju/agents/unit-keystone-saml-mellon-1/charm/metadata.yaml'

hexdump metadata.yaml | grep e2
0000000 6e22 6d61 2265 203a 6b22 7965 7473 6e6f
00000f0 6e20 6365 7365 6173 7972 6320 6e6f 6966
0000890 726f 5320 4d41 2d4c 656c 6576 206c 6e28
0000aa0 6574 6d72 e220 9c80 6973 6e67 6e69 2067 # <---- third column
0000ab0 6563 7472 6669 6369 7461 e265 9d80 6920
0000b20 6369 7461 6f69 2c6e 6e20 746f 7320 6769
0000b80 7420 6968 2073 6163 6573 2e29 4920 206e

In [1]: f = open('metadata.yaml', encoding='utf-8')

In [2]: content = f.read()

In [3]: print(content[2725])

In [4]: print(content[2725:2750])
“signing certificate” is

Not sure how those unicode quotation marks got there originally - we can replace them with ASCII ones.

Juju should really make sure locale settings are configured though to use UTF-8.