Check subnet in "_remove_subnet_dhcp_options"

Since [1], "get_subnet_dhcp_options" returns always a dictionary
in "subnet" instead of None. This patch checks not only that "subnet"
is None but also the dictionary is not empty.

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

Closes-Bug: #1948466

Change-Id: Ie93cf3e47e09b3e5051be1ffad512251775b0492
(cherry picked from commit 95c2801da8)
This commit is contained in:
Rodolfo Alonso Hernandez 2021-10-25 11:12:14 +00:00 committed by Slawek Kaplonski
parent 607dacdd18
commit 9151f4a396
1 changed files with 1 additions and 1 deletions

View File

@ -1909,7 +1909,7 @@ class OVNClient(object):
dhcp_options = self._nb_idl.get_subnet_dhcp_options( dhcp_options = self._nb_idl.get_subnet_dhcp_options(
subnet_id, with_ports=True) subnet_id, with_ports=True)
if dhcp_options['subnet'] is not None: if dhcp_options['subnet']:
txn.add(self._nb_idl.delete_dhcp_options( txn.add(self._nb_idl.delete_dhcp_options(
dhcp_options['subnet']['uuid'])) dhcp_options['subnet']['uuid']))