Comment 3 for bug 2066214

Revision history for this message
Martin Kopec (mkopec) wrote :

btw, there is a bug in listing of keypairs if --prefix is passed

client.list_keypairs here: https://opendev.org/openstack/tempest/src/commit/6618aa253e04b8879ae6d721a48ee4851543ba4a/tempest/cmd/cleanup_service.py#L294

returns something like this:

[{'keypair': {'name': 'my_test', 'public_key': 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL4FIBThf0PJRMrGFRYoItoGoUEoS7eZ15aBB2N5SB0G',
'fingerprint': '9d:21:43:71:d5:c1:32:7a:9c:25:95:17:42:5f:2a:e4'}}, {'keypair': {'name': 'my_test_2', 'public_key': 'ssh-ed25519
AAAAC3NzaC1lZDI1NTE5AAAAIPrH86oiqlP+i/bCs5BxiwT6WI7k9wUEzDnFPoMtDSY9', 'fingerprint': '7a:51:78:fc:f9:dd:ce:da:e5:b9:db:6d:58:82:8d:d3'}}]

it's a list with dicts containing {'keypair': <details in a dict>} .. and therefore it fails couple lines below on this line: https://opendev.org/openstack/tempest/src/commit/6618aa253e04b8879ae6d721a48ee4851543ba4a/tempest/cmd/cleanup_service.py#L297

with:

Traceback (most recent call last):
  File "/home/ubuntu/tempest2/.tox/py310/lib/python3.10/site-packages/tempest/cmd/cleanup.py", line 155, in take_action
    self._cleanup()
  File "/home/ubuntu/tempest2/.tox/py310/lib/python3.10/site-packages/tempest/cmd/cleanup.py", line 255, in _cleanup
    svc.run()
  File "/home/ubuntu/tempest2/.tox/py310/lib/python3.10/site-packages/tempest/cmd/cleanup_service.py", line 150, in run
    self.dry_run()
  File "/home/ubuntu/tempest2/.tox/py310/lib/python3.10/site-packages/tempest/cmd/cleanup_service.py", line 323, in dry_run
    keypairs = self.list()
  File "/home/ubuntu/tempest2/.tox/py310/lib/python3.10/site-packages/tempest/cmd/cleanup_service.py", line 298, in list
    keypairs = self._filter_by_prefix(keypairs['keypair'])
TypeError: list indices must be integers or slices, not str