From df44f6599b19decf680c9c453512fc06e6668a32 Mon Sep 17 00:00:00 2001 From: micafer Date: Mon, 4 Dec 2017 12:03:38 +0100 Subject: [PATCH] Implements #506 --- IM/connectors/OpenNebula.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/IM/connectors/OpenNebula.py b/IM/connectors/OpenNebula.py index 8bc98157a..733d8e53a 100644 --- a/IM/connectors/OpenNebula.py +++ b/IM/connectors/OpenNebula.py @@ -933,19 +933,16 @@ def get_networks_template(self, radl, sgs, auth_data): for public in [True, False]: i = 0 while system.getValue("net_interface." + str(i) + ".connection"): - network = system.getValue( - "net_interface." + str(i) + ".connection") + network = system.getValue("net_interface." + str(i) + ".connection") fixed_ip = system.getValue("net_interface." + str(i) + ".ip") # get the one network info - if nets[network]: + if network in nets and nets[network]: (net_name, net_id, is_public) = nets[network] radl.get_network_by_id(network).setValue('provider_id', str(net_name)) else: - self.log_error( - "No ONE network found for network: " + network) - raise Exception( - "No ONE network found for network: " + network) + self.log_error("No ONE network found for network: " + network) + raise Exception("No ONE network found for network: " + network) if public == is_public: if net_id is not None: