From: montesmoreno Date: Tue, 28 Mar 2017 13:45:02 +0000 (+0200) Subject: minor change to avoid deleting a non existing element from dictionary X-Git-Tag: v2.0.0~33 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F87%2F1387%2F3;p=osm%2Fopenvim.git minor change to avoid deleting a non existing element from dictionary Change-Id: Iecdd1aceda92fe5ce1cd4891be5175791c6cfab4 Signed-off-by: montesmoreno --- 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: