l3-agent network_update() can throw an excetion if router ex_gw_port is None
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Fix Released
|
Medium
|
Brian Haley |
Bug Description
I've seen this error a couple of times in downstream testing, but looks like it could be just as broken upstream:
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
2017-10-09 18:36:29.507 126916 ERROR oslo_messaging.
Since ri.ex_gw_port can be None, that can cause an exception when looking for ports we might have in that network. Here's an example if the port is None:
ports = itertools.
>>> import itertools
>>> foo = itertools.chain([], [None])
>>> port_belongs = lambda p: p['network_id'] == network_id
>>> any(port_belongs(p) for p in foo)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 1, in <genexpr>
File "<stdin>", line 1, in <lambda>
TypeError: 'NoneType' object has no attribute '__getitem__'
We need to check if it's None and use [] instead.
tags: | added: pike-backport-potential |
Fix proposed to branch: master /review. openstack. org/512382
Review: https:/