From: Kefu Chai Date: Mon, 29 Jun 2026 01:36:12 +0000 (+0800) Subject: qa/cephfs: fix invalid escape sequence SyntaxWarnings X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1ccb7561823812430d8e780ae277cbca619d81b3;p=ceph.git qa/cephfs: fix invalid escape sequence SyntaxWarnings 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 --- diff --git a/qa/tasks/cephfs/filesystem.py b/qa/tasks/cephfs/filesystem.py index 0ff5a28475c..9c48134d0bf 100644 --- a/qa/tasks/cephfs/filesystem.py +++ b/qa/tasks/cephfs/filesystem.py @@ -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: diff --git a/qa/tasks/cephfs/fuse_mount.py b/qa/tasks/cephfs/fuse_mount.py index 9df5accd696..35e2644c8c5 100644 --- a/qa/tasks/cephfs/fuse_mount.py +++ b/qa/tasks/cephfs/fuse_mount.py @@ -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() diff --git a/qa/tasks/cephfs/mount.py b/qa/tasks/cephfs/mount.py index 26b848b477a..2f083caddce 100644 --- a/qa/tasks/cephfs/mount.py +++ b/qa/tasks/cephfs/mount.py @@ -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