TypeError: __init__() got an unexpected keyword argument 'id'

Bug #1662233 reported by Tin Lam
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-barbicanclient
Invalid
Undecided
Unassigned

Bug Description

When I execute: GET /v1/secrets, it returns some JSON like one below:

  {
    "secrets": [
      {
        "status": "ACTIVE",
        "secret_type": "opaque",
        "updated": "2017-01-31T23:00:45",
        "name": null,
        "algorithm": null,
        "created": "2017-01-31T22:58:00",
        "secret_ref": "http://URL/v1/secrets/2fe14a76-11bf-45da-8989-ef73fef4ce7d",
        "content_types": {
          "default": "application/octet-stream"
        },
        "creator_id": "16dd99387769405190a92a3964731c33",
        "mode": null,
        "bit_length": null,
        "id": "2fe14a76-11bf-45da-8989-ef73fef4ce7d",
        "expiration": null
      }, ...

Note that there is a field ``id``. In [1], that keyword ``id`` is passed into the
``__init__`` of ``Secret`` at [2], it is not detected, and an exception is thrown.

GET call to key-manager for http://URL:9311/v1/secrets?limit=10&offset=0 used request id req-35a01b6c-5a4d-4d7c-b30c-6abd92b750d8
Response status 200
__init__() got an unexpected keyword argument 'id'
Traceback (most recent call last):
  File "/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/cliff/app.py", line 400, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/cliff/display.py", line 112, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/barbicanclient/barbican_cli/secrets.py", line 122, in take_action
    algorithm=args.algorithm, mode=args.mode, bits=args.bit_length)
  File "/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/barbicanclient/secrets.py", line 583, in list
    for s in response.get('secrets', [])
TypeError: __init__() got an unexpected keyword argument 'id'
clean_up ListSecret: __init__() got an unexpected keyword argument 'id'
Traceback (most recent call last):
  File "/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/osc_lib/shell.py", line 135, in run
    ret_val = super(OpenStackShell, self).run(argv)
  File "/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/cliff/app.py", line 279, in run
    result = self.run_subcommand(remainder)
  File "/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/osc_lib/shell.py", line 180, in run_subcommand
    ret_value = super(OpenStackShell, self).run_subcommand(argv)
  File "/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/cliff/app.py", line 400, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/cliff/display.py", line 112, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/barbicanclient/barbican_cli/secrets.py", line 122, in take_action
    algorithm=args.algorithm, mode=args.mode, bits=args.bit_length)
  File "/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/barbicanclient/secrets.py", line 583, in list
    for s in response.get('secrets', [])
TypeError: __init__() got an unexpected keyword argument 'id'

[1] https://github.com/openstack/python-barbicanclient/blob/master/barbicanclient/secrets.py#L582-L583
[2] https://github.com/openstack/python-barbicanclient/blob/master/barbicanclient/secrets.py#L85-L90

Revision history for this message
Dave McCowan (dave-mccowan) wrote :

What version of Barbican are you using?

This should be fixed by:

This should be fixed by https://review.openstack.org/#q,I0524b7057016daa59ea0a506bdc50a71e9fc8f6a,n,z

Changed in python-barbicanclient:
status: New → Triaged
importance: Undecided → Low
status: Triaged → New
importance: Low → Undecided
Revision history for this message
Tin Lam (lamt) wrote :

$ barbican --version
WARNING:barbicanclient.barbican:This Barbican CLI interface has been deprecated and will be removed in the O release. Please use the openstack unified client instead.
barbican 4.2.0

Revision history for this message
Dave McCowan (dave-mccowan) wrote :

@Tin, that's the version of barbican client. What version of the barbican service are you running? If you're running from the latest source, then just update the code. This bug was fixed on 1/31/17.

Revision history for this message
Gage Hugo (gagehugo) wrote :

I ran into this issue today and I was on an old version of barbican. I updated and can confirm that this problem no longer exists.

Changed in python-barbicanclient:
status: New → Invalid
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.