Getting cluster config fails with encoding error (base64)

Bug #1812816 reported by Yannic Ahrens on 2019-01-22
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

When I run try to retrieve the configuration of a Kubernetes cluster spawned by Magnum I receive a TypeError.

''openstack --debug coe cluster config <cluster>'' returns the following traceback:

Traceback (most recent call last):
  File "/home/yannic/Envs/os-dev/local/lib/python3.6/site-packages/cliff/", line 401, in run_subcommand
 result =
  File "/home/yannic/Envs/os-dev/local/lib/python3.6/site-packages/osc_lib/command/", line 41, in run
 return super(Command, self).run(parsed_args)
  File "/home/yannic/Envs/os-dev/local/lib/python3.6/site-packages/cliff/", line 184, in run
 return_code = self.take_action(parsed_args) or 0
  File "/home/yannic/Envs/os-dev/local/lib/python3.6/site-packages/magnumclient/osc/v1/", line 353, in take_action
  File "/home/yannic/Envs/os-dev/local/lib/python3.6/site-packages/magnumclient/common/", line 167, in config_cluster
 force, certs)
  File "/home/yannic/Envs/os-dev/local/lib/python3.6/site-packages/magnumclient/common/", line 217, in _config_cluster_kubernetes
 'key': base64.b64encode(certs['key']),
  File "/home/yannic/Envs/os-dev/lib/python3.6/", line 58, in b64encode
 encoded = binascii.b2a_base64(s, newline=False)
TypeError: a bytes-like object is required, not 'str'

I figure that replacing the offending statements (e.g. 'key': base64.b64encode(certs['key'])) with the corresponding oslo functionality (oslo_serialization.base64.encode_as_text) resolves the problem.

* Platform: Ubuntu 18.10
* Python 3.6.7
* python-magnumclient: 2.11 (reproducible with upstream master)

Spyros Trigazis (strigazi) wrote :

Can you move this to storyboard? I'll make this launchpad account non writable as the magnum one.

this seems to be an issue only in python3.6 I was able to reproduce.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers