Skip to content

Commit

Permalink
Merge branch 'tkt823-delete' into release-2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
ahelsing committed May 19, 2015
2 parents 43c66c4 + 1e9b09d commit 5b5eb0e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ gcf 2.9:
* Results from all calls are combined into a single return message and structure.
* APIv2 results will be keyed by AM URL and have the value of True or False usually, but sometimes a struct.
* This is useful when a circuit was reserved using `-V3` and some AMs spoke APIv2 only.
* Fix handling of return when tried to delete at an AM with no resources. (#823)
* scs.py now honors `--timeout` to set the SSL connection timeout. (#785)
* For `--fixedEndpoint` calls, avoid adding the fake interface to links
with no stitching path, such as for a LAN within a single AM. (#790)
Expand Down
10 changes: 9 additions & 1 deletion src/gcf/omnilib/stitch/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -3978,7 +3978,7 @@ def deleteReservation(self, opts, slicename):
omniargs = ['-V%d' % self.api_version,'--raise-error-on-v2-amapi-error', '-o', '-a', self.url, opName, slicename]

# Raw omni call results, for returning
text = None
text = ""
result = None

self.logger.info("Doing %s at %s...", opName, self)
Expand Down Expand Up @@ -4050,13 +4050,21 @@ def deleteReservation(self, opts, slicename):
val = ""
if ae.returnstruct.has_key("value"):
val = ae.returnstruct["value"]
#self.logger.debug("%s at %s gave code %d, output: '%s', value: '%s'", opName, self, code, msg, val)
if code == 12 and (amcode == 12 or amcode is None):
# This counts as success
self.logger.info(" ... but this error means there was nothing to delete")
noError = True
if self.nick:
text = "Success: Nothing to delete at %s" % self.nick
else:
text = "Success: Nothing to delete at %s" % self.urn
else:
text = "Failed to %s at %s: code %d: %s %s" % (opName, self, code, msg, val)
except Exception, e2:
# Failed to parse the error code.
self.logger.debug("Failed to parse return code out of error doing %s at %s: parsing %s gave %s", opName, self, ae, e2)
text = "Unknown error doing %s at %s: %s" % (opName, self, e)
if not noError:
self.logger.error("Failed to %s at %s: %s", opName, self, e)
raise StitchingError(e) # FIXME: Right way to re-raise?
Expand Down
18 changes: 11 additions & 7 deletions src/gcf/omnilib/stitchhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2042,15 +2042,19 @@ def deleteAllReservations(self, launcher):
try:
(text, result) = am.deleteReservation(self.opts, self.slicename)
self.logger.info("Deleted reservation at %s.", am)
if retText != "":
retText += "\n %s" % text
else:
retText = text
if text is not None and text.strip() != "":
if retText != "":
retText += "\n %s" % text
else:
retText = text
if am.api_version < 3 or not isinstance(result, dict):
if not (isinstance(result, tuple) and isinstance(result[0], list)):
# Some kind of error
self.logger.debug("Struct result from delete or deletesliver unknown from %s: %s", am, result)
retStruct[am.url] = result
if result is None and text.startswith("Success"):
retStruct[am.url] = True
else:
# Some kind of error
self.logger.debug("Struct result from delete or deletesliver unknown from %s: %s", am, result)
retStruct[am.url] = result
else:
(succ, fail) = result
# FIXME: Do the handler_utils tricks for comparing URLs?
Expand Down

0 comments on commit 5b5eb0e

Please sign in to comment.