From 275b199fa96ef23eeacb5974c7d32c09c2ac2987 Mon Sep 17 00:00:00 2001 From: montesmoreno Date: Tue, 28 Mar 2017 15:45:02 +0200 Subject: [PATCH] minor change to avoid deleting a non existing element from dictionary Change-Id: Iecdd1aceda92fe5ce1cd4891be5175791c6cfab4 Signed-off-by: montesmoreno --- ovim.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ovim.py b/ovim.py index f896adc..3166972 100644 --- a/ovim.py +++ b/ovim.py @@ -900,9 +900,12 @@ class ovim(): port_data['switch_mac'] = port_mapping_data[0]['switch_mac'] # remove from compute_node, region and pci of_port_data to adapt to 'ports' structure - del port_data['compute_node'] - del port_data['region'] - del port_data['pci'] + if 'region' in port_data: + del port_data['region'] + if 'pci' in port_data: + del port_data['pci'] + if 'compute_node' in port_data: + del port_data['compute_node'] result, uuid = self.db.new_row('ports', port_data, True, True) if result > 0: -- 2.25.1