]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/barbican.py: fix year2021 problem 39010/head
authorMarcus Watts <mwatts@redhat.com>
Thu, 14 Jan 2021 20:41:49 +0000 (15:41 -0500)
committerMarcus Watts <mwatts@redhat.com>
Thu, 21 Jan 2021 18:31:27 +0000 (13:31 -0500)
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 <mwatts@redhat.com>
qa/tasks/barbican.py

index 5df8bad93dc6c8e4c5164a47cb798a433c429c91..cfa85e1ddd6ea9236915ed9813ed458b9b753c81 100644 (file)
@@ -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",