]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/barbican.py: fix year2021 problem 40385/head
authorMarcus Watts <mwatts@redhat.com>
Thu, 14 Jan 2021 20:41:49 +0000 (15:41 -0500)
committersinguliere <singuliere@autistici.org>
Wed, 24 Mar 2021 20:39:11 +0000 (21:39 +0100)
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>
(cherry picked from commit b1fac2224bc7f1d42abc29fd8884663604aa0d4e)

qa/tasks/barbican.py

index 46b036ef4ced680dc80421721ec1ad45fb0183fa..03f58c5c7a34a186888da7135f53840ae2b9c499 100644 (file)
@@ -8,6 +8,8 @@ import six
 from six.moves import http_client
 from six.moves.urllib.parse import urlparse
 import json
+import time
+import math
 
 from teuthology import misc as teuthology
 from teuthology import contextutil
@@ -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",