Fix reference before assignment error in the dhcp_rpc module

In patch [1] method get_network_info was refactored and that causes
NameError in the DHCP agent when there is "network object passed in
kwargs and there are subnets with segments in network. See related bug
for details.

[1] https://review.opendev.org/c/openstack/neutron/+/820190

Closes-Bug: #1958955
Change-Id: Iad8d85c79f8b11a24b1bb1ca44c776e909b610c3
This commit is contained in:
Slawek Kaplonski 2022-01-26 12:50:19 +01:00
parent 24c802711a
commit 1c1814aa6b
1 changed files with 1 additions and 1 deletions

View File

@ -182,12 +182,12 @@ class DhcpRpcCallback(object):
"""
enable_dhcp = kwargs.get('enable_dhcp', True)
network = kwargs.get('network')
host = kwargs.get('host')
plugin = directory.get_plugin()
if network:
ports = kwargs['ports']
else:
network_id = kwargs.get('network_id')
host = kwargs.get('host')
LOG.debug('Network %(network_id)s requested from '
'%(host)s', {'network_id': network_id,
'host': host})