- for attribute in sliver_atrributes:
- name, value, node_id = attribute['tagname'], attribute['value'], attribute.get('node_id', None)
- api.plshell.AddSliceTag(api.plauth, slice['name'], name, value, node_id)
+ # remove stale attributes
+ for attribute in removed_slice_attributes:
+ try:
+ api.plshell.DeleteSliceTag(api.plauth, attribute['slice_tag_id'])
+ except Exception, e:
+ api.logger.warn('Failed to remove sliver attribute. name: %s, value: %s, node_id: %s\nCause:%s'\
+ % (name, value, node_id, str(e)))
+
+ # add requested_attributes
+ for attribute in requested_slice_attributes:
+ try:
+ name, value, node_id = attribute['name'], attribute['value'], attribute.get('node_id', None)
+ api.plshell.AddSliceTag(api.plauth, slice['name'], name, value, node_id)
+ except Exception, e:
+ api.logger.warn('Failed to add sliver attribute. name: %s, value: %s, node_id: %s\nCause:%s'\
+ % (name, value, node_id, str(e)))