]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
task/ssh_keys: fix invalid escape sequence '\w'
authorKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Sun, 4 Aug 2024 22:46:19 +0000 (00:46 +0200)
committerKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Sun, 4 Aug 2024 23:05:11 +0000 (01:05 +0200)
Fix syntax warning message:

    <unknown>:68: SyntaxWarning: invalid escape sequence '\w'
    teuthology/task/ssh_keys.py:57: SyntaxWarning: invalid escape sequence '\w'
      match = re.match('[\w-]+ {key} \S+@\S+'.format(key=re.escape(ssh_key)), line_to_test)
    teuthology/task/ssh_keys.py:68: SyntaxWarning: invalid escape sequence '\w'
      match = re.match('[\w-]+ \S+ {username}@\S+'.format(username=username), line_to_test)

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@clyso.com>
teuthology/task/ssh_keys.py

index 9c899e8fa9ac825c6a5bba50a6542f431c17c7b9..0f497ebe9060de3429139a942baffe2c3894d1ab 100644 (file)
@@ -54,7 +54,7 @@ def particular_ssh_key_test(line_to_test, ssh_key):
     """
     Check the validity of the ssh_key
     """
-    match = re.match('[\w-]+ {key} \S+@\S+'.format(key=re.escape(ssh_key)), line_to_test)
+    match = re.match(r'[\w-]+ {key} \S+@\S+'.format(key=re.escape(ssh_key)), line_to_test)
 
     if match:
         return False
@@ -65,7 +65,7 @@ def ssh_keys_user_line_test(line_to_test, username ):
     """
     Check the validity of the username
     """
-    match = re.match('[\w-]+ \S+ {username}@\S+'.format(username=username), line_to_test)
+    match = re.match(r'[\w-]+ \S+ {username}@\S+'.format(username=username), line_to_test)
 
     if match:
         return False