]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: use raw string during `re.sub`
authorMichael Fritch <mfritch@suse.com>
Thu, 12 Dec 2019 15:10:44 +0000 (08:10 -0700)
committerMichael Fritch <mfritch@suse.com>
Thu, 12 Dec 2019 15:10:44 +0000 (08:10 -0700)
cephadm:198: DeprecationWarning: invalid escape sequence \s
  nice_conf = re.sub('\n(\s)+', '\n', raw_conf)

Signed-off-by: Michael Fritch <mfritch@suse.com>
src/cephadm/cephadm

index f0eaf407a0c55e7bcceedc6ec508aeb084341fc0..6c87501c9a0ab220d99173359b26f01c25a8989c 100755 (executable)
@@ -195,14 +195,14 @@ def read_config(fn):
     if fn:
         with open(fn, 'r') as f:
             raw_conf = f.read()
-        nice_conf = re.sub('\n(\s)+', '\n', raw_conf)
+        nice_conf = re.sub(r'\n(\s)+', r'\n', raw_conf)
         s_io = StringIO(nice_conf)
         if sys.version_info >= (3, 2):
             cp.read_file(s_io)
         else:
             cp.readfp(s_io)
 
-     return cp
+    return cp
 
 def pathify(p):
     # type: (str) -> str