From 9151f4a3966e7416b8449945e9b4735dd92b2a60 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Mon, 25 Oct 2021 11:12:14 +0000 Subject: [PATCH] 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 95c2801da855cada741693b0dc31192e7baa111c) --- neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py index 80197b4e517..96c4457d190 100644 --- a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py +++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py @@ -1909,7 +1909,7 @@ class OVNClient(object): dhcp_options = self._nb_idl.get_subnet_dhcp_options( subnet_id, with_ports=True) - if dhcp_options['subnet'] is not None: + if dhcp_options['subnet']: txn.add(self._nb_idl.delete_dhcp_options( dhcp_options['subnet']['uuid']))