From 0bc1b9ee967c360c3c7c1b0752d9ef241ae0ca61 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Thu, 7 Jul 2011 13:19:50 -0400 Subject: [PATCH] catch and log execptions when adding sliver attributes(tags) fails --- sfa/plc/aggregate.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/sfa/plc/aggregate.py b/sfa/plc/aggregate.py index 76a93ed5..1cd19338 100644 --- a/sfa/plc/aggregate.py +++ b/sfa/plc/aggregate.py @@ -99,19 +99,22 @@ class Aggregate: slivers = [] tags = self.api.plshell.GetSliceTags(self.api.plauth, slice['slice_tag_ids']) for node_id in slice['node_ids']: - sliver = {} - sliver['hostname'] = self.nodes[node_id]['hostname'] - sliver['tags'] = [] - slivers.append(sliver) - for tag in tags: - # if tag isn't bound to a node then it applies to all slivers - # and belongs in the tag - if not tag['node_id']: - rspec.add_default_sliver_attribute(tag['tagname'], tag['value'], self.api.hrn) - else: - tag_host = self.nodes[tag['node_id']]['hostname'] - if tag_host == sliver['hostname']: - sliver['tags'].append(tag) + try: + sliver = {} + sliver['hostname'] = self.nodes[node_id]['hostname'] + sliver['tags'] = [] + slivers.append(sliver) + for tag in tags: + # if tag isn't bound to a node then it applies to all slivers + # and belongs in the tag + if not tag['node_id']: + rspec.add_default_sliver_attribute(tag['tagname'], tag['value'], self.api.hrn) + else: + tag_host = self.nodes[tag['node_id']]['hostname'] + if tag_host == sliver['hostname']: + sliver['tags'].append(tag) + except: + self.api.logger.log_exc('unable to add sliver %s to node %s' % (slice['name'], node_id)) rspec.add_slivers(slivers, sliver_urn=slice_xrn) return rspec.toxml(cleanup=True) -- 2.47.0