From: Andy Bavier Date: Mon, 7 Mar 2011 21:59:20 +0000 (-0500) Subject: Fix "permission denied to modify tag" error X-Git-Tag: sfa-1.0-15~2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=821312a785697f0beab750db854bb1f6595ab0df;p=sfa.git Fix "permission denied to modify tag" error The SFA should give an "Invalid RSpec: permission denied to modify tag" error when the user tries to modify a tag without the proper role. This fix prevents the error being generated when the tag value has not been changed. --- diff --git a/sfa/plc/network.py b/sfa/plc/network.py index 2a3e6ba2..d8f0c1dd 100644 --- a/sfa/plc/network.py +++ b/sfa/plc/network.py @@ -183,10 +183,14 @@ class Slice: # Update a slice tag if it exists, else add it def update_tag(self, tagname, value, node = None, role = "user"): + tag = self.get_tag(tagname, node) + if tag and tag.value == value: + return tag + tt = self.network.lookupTagType(tagname) if not tt.permit_update(role): raise InvalidRSpec("permission denied to modify '%s' tag" % tagname) - tag = self.get_tag(tagname, node) + if tag: tag.change(value) else: