KeyError: 'name' in test network resources

Bug #1888866 reported by Stig Telfer
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Rally
Fix Released
Undecided
Unassigned

Bug Description

I see this exception on test startup:

2020-07-24 14:23:03.656 16238 CRITICAL rally [-] Unhandled error: KeyError: 'name'
2020-07-24 14:23:03.656 16238 ERROR rally Traceback (most recent call last):
2020-07-24 14:23:03.656 16238 ERROR rally File "/home/centos/.local/bin/rally", line 11, in <module>
2020-07-24 14:23:03.656 16238 ERROR rally sys.exit(main())
2020-07-24 14:23:03.656 16238 ERROR rally File "/home/centos/.local/lib/python3.6/site-packages/rally/cli/main.py", line 40, in main
2020-07-24 14:23:03.656 16238 ERROR rally return cliutils.run(sys.argv, categories)
2020-07-24 14:23:03.656 16238 ERROR rally File "/home/centos/.local/lib/python3.6/site-packages/rally/cli/cliutils.py", line 657, in run
2020-07-24 14:23:03.656 16238 ERROR rally ret = fn(*fn_args, **fn_kwargs)
2020-07-24 14:23:03.656 16238 ERROR rally File "<decorator-gen-92>", line 2, in start
2020-07-24 14:23:03.656 16238 ERROR rally File "/home/centos/.local/lib/python3.6/site-packages/rally/cli/envutils.py", line 135, in default_from_global
2020-07-24 14:23:03.656 16238 ERROR rally return f(*args, **kwargs)
2020-07-24 14:23:03.656 16238 ERROR rally File "<decorator-gen-91>", line 2, in start
2020-07-24 14:23:03.656 16238 ERROR rally File "/home/centos/.local/lib/python3.6/site-packages/rally/cli/envutils.py", line 135, in default_from_global
2020-07-24 14:23:03.656 16238 ERROR rally return f(*args, **kwargs)
2020-07-24 14:23:03.656 16238 ERROR rally File "<decorator-gen-90>", line 2, in start
2020-07-24 14:23:03.656 16238 ERROR rally File "/home/centos/.local/lib/python3.6/site-packages/rally/plugins/__init__.py", line 59, in ensure_plugins_are_loaded
2020-07-24 14:23:03.656 16238 ERROR rally return f(*args, **kwargs)
2020-07-24 14:23:03.656 16238 ERROR rally File "/home/centos/.local/lib/python3.6/site-packages/rally/cli/commands/verify.py", line 511, in start
2020-07-24 14:23:03.656 16238 ERROR rally tags=tags, **run_args)
2020-07-24 14:23:03.656 16238 ERROR rally File "/home/centos/.local/lib/python3.6/site-packages/rally/api.py", line 1037, in start
2020-07-24 14:23:03.656 16238 ERROR rally with vcontext.ContextManager(context):
2020-07-24 14:23:03.656 16238 ERROR rally File "/home/centos/.local/lib/python3.6/site-packages/rally/task/context.py", line 308, in __enter__
2020-07-24 14:23:03.656 16238 ERROR rally self.setup()
2020-07-24 14:23:03.656 16238 ERROR rally File "/home/centos/.local/lib/python3.6/site-packages/rally/task/context.py", line 253, in setup
2020-07-24 14:23:03.656 16238 ERROR rally ctx.setup()
2020-07-24 14:23:03.656 16238 ERROR rally File "/home/centos/.local/lib/python3.6/site-packages/rally_openstack/verification/tempest/context.py", line 108, in setup
2020-07-24 14:23:03.656 16238 ERROR rally helper_method=self._create_network_resources)
2020-07-24 14:23:03.656 16238 ERROR rally File "/home/centos/.local/lib/python3.6/site-packages/rally_openstack/verification/tempest/context.py", line 157, in _configure_option
2020-07-24 14:23:03.656 16238 ERROR rally value = res["name"] if "network" in option else res.id
2020-07-24 14:23:03.656 16238 ERROR rally KeyError: 'name'
2020-07-24 14:23:03.656 16238 ERROR rally

Here's the code:

154 if helper_method:
155 res = helper_method(*args, **kwargs)
156 if res:
157 import pdb; pdb.set_trace()
158 -> value = res["name"] if "network" in option else res.id
159 LOG.debug("Setting value '%s' to option '%s'." % (value, option))

The value of 'option' is 'fixed_network_name'

In this context, res has keys ['network', 'subnets', 'routers'] - it looks like the correct reference should be res["network"]["name"] (which appears to work when tested).

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to rally-openstack (master)

Reviewed: https://review.opendev.org/743044
Committed: https://git.openstack.org/cgit/openstack/rally-openstack/commit/?id=59493879491f5d37282789e26bab2ac13afe14f7
Submitter: Zuul
Branch: master

commit 59493879491f5d37282789e26bab2ac13afe14f7
Author: Stig Telfer <email address hidden>
Date: Sat Jul 25 21:14:59 2020 +0100

    Fix for KeyError during config preparation

    In this context, res has keys ['network', 'subnets', 'routers'] -
    it looks like the correct reference should be res["network"]["name"]

    Change-Id: I343a582c2ebed729cddebcb6ae8c660c29fec221
    Closes-Bug: 1888866

Changed in rally:
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.