rest_server: fix token release
resource.usage_token_put() works on the Token instance, and not the uuid string. So we first need to look-up the Token instance for the client-provided UUID string, and then we can call usage_token_put()
This commit is contained in:
parent
6544151ff9
commit
425f84f552
|
@ -71,10 +71,14 @@ class PwrMgmtRestServer:
|
|||
set_headers(request)
|
||||
return json.dumps(token.to_dict())
|
||||
|
||||
@app.route('/api/v1/resource/<resrc>/token/<token>/release', methods=['GET'])
|
||||
def token_release(self, request, resrc, token):
|
||||
@app.route('/api/v1/resource/<resrc>/token/<token_uuid>/release', methods=['GET'])
|
||||
def token_release(self, request, resrc, token_uuid):
|
||||
resource = self.resources[resrc]
|
||||
# find token within resource
|
||||
token = resource.usage_token_find(token_uuid)
|
||||
if not token:
|
||||
request.setResponseCode(404)
|
||||
return
|
||||
resource.usage_token_put(token)
|
||||
#set_headers(request)
|
||||
request.setResponseCode(200)
|
||||
|
|
Loading…
Reference in New Issue