]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/cephfs: fix invalid escape sequence SyntaxWarnings 69795/head
authorKefu Chai <k.chai@proxmox.com>
Mon, 29 Jun 2026 01:36:12 +0000 (09:36 +0800)
committerKefu Chai <k.chai@proxmox.com>
Mon, 29 Jun 2026 01:36:12 +0000 (09:36 +0800)
python 3.12 warns on unrecognized escape sequences in string literals.
fuse_mount's admin-socket pyscript and mount's nft payload carry regex
and shell escapes (\., \d, \;) that are meant literally, so make those
strings raw. filesystem's get_mds_addr docstring had a stray \/ in the
example address, which is just a slash, so drop the backslash.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
qa/tasks/cephfs/filesystem.py
qa/tasks/cephfs/fuse_mount.py
qa/tasks/cephfs/mount.py

index 0ff5a28475c56d55db524390959b5586cb92fc1a..9c48134d0bf6ec68f0892547765727fc63679539 100644 (file)
@@ -192,7 +192,7 @@ class FSStatus(RunCephCmd):
 
     def get_mds_addr(self, name):
         """
-        Return the instance addr as a string, like "10.214.133.138:6807\/10825"
+        Return the instance addr as a string, like "10.214.133.138:6807/10825"
         """
         info = self.get_mds(name)
         if info:
index 9df5accd696097e94fff81e2809993146d1ebc69..35e2644c8c504e7b0b95983a3cecd570d9557312 100644 (file)
@@ -432,7 +432,7 @@ class FuseMountBase(CephFSMountBase):
         return ""
 
     def find_admin_socket(self):
-        pyscript = """
+        pyscript = r"""
 import glob
 import re
 import os
@@ -449,7 +449,7 @@ def _find_admin_socket(client_name):
             return files[0]
 
         for f in files:
-                pid = re.match(".*\.(\d+)\.asok$", f).group(1)
+                pid = re.match(r".*\.(\d+)\.asok$", f).group(1)
                 if os.path.exists("/proc/{{0}}".format(pid)):
                     with open("/proc/{{0}}/cmdline".format(pid), 'r') as proc_f:
                         contents = proc_f.read()
index 26b848b477ad34bffafe8fa95dff98248971ec32..2f083caddcea3f8dcfb71f58c61a4ef9c01c6f86 100644 (file)
@@ -306,7 +306,7 @@ class CephFSMountBase(object):
             # Setup the NAT
             gw = self._default_gateway()
 
-            self.run_shell_payload(f"""
+            self.run_shell_payload(rf"""
                 set -e
 
                 if command -v iptables >/dev/null 2>&1 && sudo iptables -t nat -A POSTROUTING -s {self.ceph_brx_net} -o {gw} -j MASQUERADE 2>/dev/null; then