registration-relation-changed fails on bionic due to python2 vs python3 string handling

Bug #1800667 reported by Dmitrii Shcherbakov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
landscape-client-charm
Fix Released
Undecided
Dmitrii Shcherbakov

Bug Description

1) deploy landscape 18.03 via charms
2) deploy landscape-client on bionic ubuntu system
3) configure landscape with a registration key and config that on the client side

The charm fails with "TypeError: write() argument must be str, not bytes" which is a python2 vs python3 string handling error.

which is triggered by

file.write(base64.b64decode(certificate))

bundle:
http://paste.ubuntu.com/p/wxDKfbYPnp/

unit-landscape-server-0: 17:24:08 DEBUG unit.landscape-server/0.registration-relation-changed == landscape-async-frontend ==
unit-landscape-server-0: 17:24:10 DEBUG unit.landscape-server/0.registration-relation-changed == landscape-job-handler ==
unit-landscape-server-0: 17:24:13 DEBUG unit.landscape-server/0.registration-relation-changed == landscape-msgserver ==
unit-landscape-server-0: 17:24:17 DEBUG unit.landscape-server/0.registration-relation-changed == landscape-pingserver ==
unit-landscape-server-0: 17:24:21 DEBUG unit.landscape-server/0.registration-relation-changed == landscape-api ==
unit-landscape-client-0: 17:24:21 INFO juju.worker.uniter awaiting error resolution for "relation-changed" hook
unit-landscape-client-0: 17:24:22 INFO unit.landscape-client/0.juju-log registration:8: In config-changed for landscape-client/0
unit-landscape-client-0: 17:24:22 DEBUG unit.landscape-client/0.registration-relation-changed Traceback (most recent call last):
unit-landscape-client-0: 17:24:22 DEBUG unit.landscape-client/0.registration-relation-changed File "/var/lib/juju/agents/unit-landscape-client-0/charm/hooks/hooks.py", line 223, in <module>
unit-landscape-client-0: 17:24:22 DEBUG unit.landscape-client/0.registration-relation-changed sys.exit(hooks.execute(sys.argv[1:]))
unit-landscape-client-0: 17:24:22 DEBUG unit.landscape-client/0.registration-relation-changed File "/var/lib/juju/agents/unit-landscape-client-0/charm/hooks/charmhelpers/core/hookenv.py", line 731, in execute
unit-landscape-client-0: 17:24:22 DEBUG unit.landscape-client/0.registration-relation-changed self._hooks[hook_name]()
unit-landscape-client-0: 17:24:22 DEBUG unit.landscape-client/0.registration-relation-changed File "/var/lib/juju/agents/unit-landscape-client-0/charm/hooks/hooks.py", line 38, in registration_relation
unit-landscape-client-0: 17:24:22 DEBUG unit.landscape-client/0.registration-relation-changed landscape_broker=landscape_broker)
unit-landscape-client-0: 17:24:22 DEBUG unit.landscape-client/0.registration-relation-changed File "/var/lib/juju/agents/unit-landscape-client-0/charm/hooks/hooks.py", line 74, in config_changed
unit-landscape-client-0: 17:24:22 DEBUG unit.landscape-client/0.registration-relation-changed _write_certificate(relation_data["ssl-public-key"][7:], CERT_FILE)
unit-landscape-client-0: 17:24:22 DEBUG unit.landscape-client/0.registration-relation-changed File "/var/lib/juju/agents/unit-landscape-client-0/charm/hooks/hooks.py", line 218, in _write_certificate
unit-landscape-client-0: 17:24:22 DEBUG unit.landscape-client/0.registration-relation-changed file.write(base64.b64decode(certificate))
unit-landscape-client-0: 17:24:22 DEBUG unit.landscape-client/0.registration-relation-changed TypeError: write() argument must be str, not bytes
unit-landscape-client-0: 17:24:22 ERROR juju.worker.uniter.operation hook "registration-relation-changed" failed: exit status 1

Tags: cpe-onsite

Related branches

Changed in landscape-client-charm:
status: New → In Progress
assignee: nobody → Dmitrii Shcherbakov (dmitriis)
Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

Fixed in charm rev 31.

Changed in landscape-client-charm:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.