Skip to content

Commit

Permalink
Fix some update problems
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed May 23, 2018
1 parent 755dca0 commit 014c9a5
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions IM/InfrastructureInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,17 +306,16 @@ def update_radl(self, radl, deployed_vms):
"""

with self._lock:
# Add new networks only
for s in radl.systems + radl.networks + radl.ansible_hosts:
original_radl = self.radl.clone()
# Add new networks ad ansible_hosts only
for s in radl.networks + radl.ansible_hosts:
if not self.radl.add(s.clone(), "ignore"):
InfrastructureInfo.logger.warn(
"Ignoring the redefinition of %s %s" % (type(s), s.getId()))
InfrastructureInfo.logger.warn("Ignoring the redefinition of %s %s" % (type(s), s.getId()))

# Add or update configures
# Add or update configures and systems
for s in radl.configures + radl.systems:
self.radl.add(s.clone(), "replace")
InfrastructureInfo.logger.warn(
"(Re)definition of %s %s" % (type(s), s.getId()))
InfrastructureInfo.logger.warn("(Re)definition of %s %s" % (type(s), s.getId()))

# Append contextualize
self.radl.add(radl.contextualize)
Expand All @@ -335,7 +334,12 @@ def update_radl(self, radl, deployed_vms):
self.private_networks[private_net] = d.cloud_id

# Check the RADL
self.radl.check()
try:
self.radl.check()
except Exception as ex:
# If something is not correct restore the original one and raise the error
self.radl = original_radl
raise(ex)

def complete_radl(self, radl):
"""
Expand Down

0 comments on commit 014c9a5

Please sign in to comment.