container list cannot handle correctly if container secrets have name contain non-ascii characters

Bug #1531751 reported by ting.wang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-barbicanclient
New
Undecided
ting.wang

Bug Description

if name of container secret contains non-ascii characters, like

MariaDB [barbican]> select * from container_secret;
+--------------------------------------+---------------------+---------------------+------------+---------+---------+--------+--------------------------------------+--------------------------------------+
| id | created_at | updated_at | deleted_at | deleted | status | name | container_id | secret_id |
+--------------------------------------+---------------------+---------------------+------------+---------+---------+--------+--------------------------------------+--------------------------------------+
| 846d6079-f191-41cc-a42d-efc2980ec5da | 2016-01-07 03:08:35 | 2016-01-07 03:08:35 | NULL | 0 | PENDING | 你好 | 5e7044e0-8b49-4c0c-b96d-65e0a2c9aded | 95f1c705-d860-4583-801c-94c39e561f82 |

你好 == \u4f60\u597d

then run:
barbican secret container list --debug

'ascii' codec can't encode characters in position 1747-1748: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 374, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/display.py", line 93, in run
    self.produce_output(parsed_args, column_names, data)
  File "/usr/lib/python2.7/site-packages/cliff/lister.py", line 56, in produce_output
    parsed_args,
  File "/usr/lib/python2.7/site-packages/cliff/formatters/table.py", line 60, in emit_list
    stdout.write(formatted)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 1747-1748: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/bin/barbican", line 10, in <module>
    sys.exit(main())
  File "/opt/stack/python-barbicanclient/barbicanclient/barbican.py", line 339, in main
    return barbican_app.run(argv)
  File "/opt/stack/python-barbicanclient/barbicanclient/barbican.py", line 334, in run
    return super(Barbican, self).run(argv)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 255, in run
    result = self.run_subcommand(remainder)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 374, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/display.py", line 93, in run
    self.produce_output(parsed_args, column_names, data)
  File "/usr/lib/python2.7/site-packages/cliff/lister.py", line 56, in produce_output
    parsed_args,
  File "/usr/lib/python2.7/site-packages/cliff/formatters/table.py", line 60, in emit_list
    stdout.write(formatted)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 1747-1748: ordinal not in range(128)

but curl -X GET can handle correctly:
curl -X GET http://localhost:9311/v1/containers/5e7044e0-8b49-4c0c-b96d-65e0a2c9aded -H "X-Auth-Token:"

{"status": "ACTIVE", "updated": "2016-01-07T03:08:34", "name": "noname", "consumers": [], "created": "2016-01-07T03:08:34", "container_ref": "http://192.168.0.194:9311/v1/containers/5e7044e0-8b49-4c0c-b96d-65e0a2c9aded", "creator_id": "41770d76c1754a3ca6821dc8763c7ffc", "secret_refs": [{"secret_ref": "http://192.168.0.194:9311/v1/secrets/95f1c705-d860-4583-801c-94c39e561f82", "name": "\u4f60\u597d"}], "type": "generic"}

So, we'd better fix it in barbicanclient

ting.wang (bx-wang)
Changed in python-barbicanclient:
assignee: nobody → tingwang (bx-wang)
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.