]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
script/ptl-tool: address datetime warning 69463/head
authorPatrick Donnelly <pdonnell@ibm.com>
Sun, 14 Jun 2026 15:17:27 +0000 (11:17 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Mon, 15 Jun 2026 20:25:23 +0000 (16:25 -0400)
    /home/runner/work/ceph/ceph/src/script/ptl-tool.py:1743: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
src/script/ptl-tool.py

index 762069ca3b5f90c54c62ef10ea3360a470c84354..a9bb69f953f9c2bdf5940fe5617c3fc1cadf9710 100755 (executable)
@@ -1629,7 +1629,7 @@ def manage_qa_tracker(args, R, session, branch, prs, tag, qa_tracker_description
                     log.error(f"Failed to post comment: {r.status_code} {r.text}")
 
     elif args.create_qa:
-        now_str = datetime.datetime.utcnow().strftime("%Y-%m-%d-%H:%M")
+        now_str = datetime.datetime.now(datetime.UTC).strftime("%Y-%m-%d-%H:%M")
         default_subject = f"{base} integration testing by {USER} started {now_str}"
         issue_kwargs['subject'] = args.qa_subject if args.qa_subject else default_subject
 
@@ -1740,7 +1740,7 @@ def build_branch(args):
         args.skip_conflict_check = True
 
     # Compute branch names now that integration flags and auto-detect have settled
-    branch = datetime.datetime.utcnow().strftime(args.branch).format(user=USER)
+    branch = datetime.datetime.now(datetime.UTC).strftime(args.branch).format(user=USER)
     if args.branch_release:
         branch = branch + "-" + args.branch_release
     if args.branch_append: