From b1fac2224bc7f1d42abc29fd8884663604aa0d4e Mon Sep 17 00:00:00 2001 From: Marcus Watts Date: Thu, 14 Jan 2021 15:41:49 -0500 Subject: [PATCH] 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 --- qa/tasks/barbican.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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", -- 2.47.3