From: Marcus Watts Date: Thu, 14 Jan 2021 20:41:49 +0000 (-0500) Subject: qa/tasks/barbican.py: fix year2021 problem X-Git-Tag: v17.0.0~9^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F39010%2Fhead;p=ceph.git qa/tasks/barbican.py: fix year2021 problem The expiration timestamp was hard-coded as 2020-12-31T19:14:44.180394 which is now in the past. Instead, use a timestamp 90 minutes in the future. Fixes: https://tracker.ceph.com/issues/48919 Signed-off-by: Marcus Watts --- diff --git a/qa/tasks/barbican.py b/qa/tasks/barbican.py index 5df8bad93dc6..cfa85e1ddd6e 100644 --- a/qa/tasks/barbican.py +++ b/qa/tasks/barbican.py @@ -6,6 +6,8 @@ import contextlib import logging import http import json +import time +import math from urllib.parse import urlparse @@ -326,12 +328,16 @@ def create_secrets(ctx, config): token_resp.status < 300): raise Exception("Cannot authenticate user "+secret["username"]+" for secret creation") + expire = time.time() + 5400 # now + 90m + (expire_fract,dummy) = math.modf(expire) + expire_format = "%%FT%%T.%06d" % (round(expire_fract*1000000)) + expiration = time.strftime(expire_format, time.gmtime(expire)) token_id = token_resp.getheader('x-subject-token') key1_json = json.dumps( { "name": secret['name'], - "expiration": "2020-12-31T19:14:44.180394", + "expiration": expiration, "algorithm": "aes", "bit_length": 256, "mode": "cbc",