summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitalii Koriakov <vkoriako@redhat.com>2018-10-26 13:18:28 +0300
committerNigel Babu <nigelb@redhat.com>2018-10-29 09:57:30 +0000
commitc10083a0166969ec5474fd8a92cfd35cf0536ffe (patch)
tree7dd33882f6581988f22a6ec8a0d5934d029b4605
parent3d5274169cac77566e6fb1fb2a53d01ca4af1d13 (diff)
Using a raw strings for fixing flake warnings
Change-Id: Ie134790ea05919a4b396657c11cbc3fc7a7fc529 Signed-off-by: Vitalii Koriakov <vkoriako@redhat.com>
-rwxr-xr-x[-rw-r--r--]glustolibs-gluster/glustolibs/gluster/bitrot_ops.py2
-rwxr-xr-x[-rw-r--r--]glustolibs-gluster/glustolibs/gluster/glusterfile.py2
-rwxr-xr-x[-rw-r--r--]glustolibs-gluster/glustolibs/gluster/heal_libs.py2
-rw-r--r--glustolibs-gluster/glustolibs/gluster/heal_ops.py2
-rwxr-xr-x[-rw-r--r--]glustolibs-gluster/glustolibs/gluster/lib_utils.py4
-rwxr-xr-x[-rw-r--r--]glustolibs-gluster/glustolibs/gluster/mount_ops.py21
-rw-r--r--glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py2
-rwxr-xr-x[-rw-r--r--]glustolibs-gluster/glustolibs/gluster/quota_libs.py2
-rwxr-xr-x[-rw-r--r--]glustolibs-io/glustolibs/io/utils.py4
-rwxr-xr-x[-rw-r--r--]tests/functional/nfs_ganesha/test_nfs_ganesha_volume_exports.py4
10 files changed, 21 insertions, 24 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/bitrot_ops.py b/glustolibs-gluster/glustolibs/gluster/bitrot_ops.py
index cab205c..bbfcd93 100644..100755
--- a/glustolibs-gluster/glustolibs/gluster/bitrot_ops.py
+++ b/glustolibs-gluster/glustolibs/gluster/bitrot_ops.py
@@ -566,7 +566,7 @@ def get_scrub_status(mnode, volname):
temp_list = re.findall(regex, info, re.S)
corrupt_list = []
for node in temp_list:
- tmp_reg = ('Node: (\S+)\n.*Error count.*'
+ tmp_reg = (r'Node: (\S+)\n.*Error count.*'
'Corrupted object.*?:(.*)\n=.*')
m = re.search(tmp_reg, node, re.S)
if m is None:
diff --git a/glustolibs-gluster/glustolibs/gluster/glusterfile.py b/glustolibs-gluster/glustolibs/gluster/glusterfile.py
index 9b9b57f..2f1c45e 100644..100755
--- a/glustolibs-gluster/glustolibs/gluster/glusterfile.py
+++ b/glustolibs-gluster/glustolibs/gluster/glusterfile.py
@@ -366,7 +366,7 @@ def get_pathinfo(host, fqpath):
"""
pathinfo = {}
pathinfo['raw'] = get_fattr(host, fqpath, 'trusted.glusterfs.pathinfo')
- pathinfo['brickdir_paths'] = re.findall(".*?POSIX.*?:(\S+)\>",
+ pathinfo['brickdir_paths'] = re.findall(r".*?POSIX.*?:(\S+)\>",
pathinfo['raw'])
return pathinfo
diff --git a/glustolibs-gluster/glustolibs/gluster/heal_libs.py b/glustolibs-gluster/glustolibs/gluster/heal_libs.py
index e71835d..e4f2b2f 100644..100755
--- a/glustolibs-gluster/glustolibs/gluster/heal_libs.py
+++ b/glustolibs-gluster/glustolibs/gluster/heal_libs.py
@@ -343,7 +343,7 @@ def get_self_heal_daemon_pid(nodes):
_rc = True
if isinstance(nodes, str):
nodes = [nodes]
- cmd = "pgrep -f glustershd | grep -v ^$$\$"
+ cmd = r"pgrep -f glustershd | grep -v ^$$\$"
g.log.info("Executing cmd: %s on node %s" % (cmd, nodes))
results = g.run_parallel(nodes, cmd)
for node in results:
diff --git a/glustolibs-gluster/glustolibs/gluster/heal_ops.py b/glustolibs-gluster/glustolibs/gluster/heal_ops.py
index daae9a3..c200f5c 100644
--- a/glustolibs-gluster/glustolibs/gluster/heal_ops.py
+++ b/glustolibs-gluster/glustolibs/gluster/heal_ops.py
@@ -184,7 +184,7 @@ def heal_info_summary(mnode, volname):
The third element 'err' is of type 'str' and is the stderr value
of the command execution.
"""
- cmd = ("gluster volume heal %s info | grep 'entries\|Brick\|Status'" %
+ cmd = (r"gluster volume heal %s info | grep 'entries\|Brick\|Status'" %
volname)
return g.run(mnode, cmd)
diff --git a/glustolibs-gluster/glustolibs/gluster/lib_utils.py b/glustolibs-gluster/glustolibs/gluster/lib_utils.py
index 682152f..44ac6e3 100644..100755
--- a/glustolibs-gluster/glustolibs/gluster/lib_utils.py
+++ b/glustolibs-gluster/glustolibs/gluster/lib_utils.py
@@ -247,7 +247,7 @@ def get_pathinfo(mnode, filename, volname):
umount_volume(mnode, mount_point)
g.run(mnode, "rm -rf " + mount_point)
- return re.findall(".*?POSIX.*?:(\S+)\>", pathinfo)
+ return re.findall(r".*?POSIX.*?:(\S+)\>", pathinfo)
def list_files(mnode, dir_path, parse_str="", user="root"):
@@ -815,7 +815,7 @@ def is_core_file_created(nodes, testrun_timestamp,
g.log.info("checking core file created or not")
for file1 in dir_list:
if (re.search(r'\bcore\.[\S]+\b', file1)):
- file_path_list = re.split('[\s]+', cmd)
+ file_path_list = re.split(r'[\s]+', cmd)
file_path = file_path_list[1] + '/' + file1
time_cmd = 'stat ' + '-c ' + '%X ' + file_path
ret, file_timestamp, _ = g.run(node, time_cmd)
diff --git a/glustolibs-gluster/glustolibs/gluster/mount_ops.py b/glustolibs-gluster/glustolibs/gluster/mount_ops.py
index 637af24..cc63d05 100644..100755
--- a/glustolibs-gluster/glustolibs/gluster/mount_ops.py
+++ b/glustolibs-gluster/glustolibs/gluster/mount_ops.py
@@ -251,18 +251,15 @@ def is_mounted(volname, mpoint, mserver, mclient, mtype, user='root'):
if mtype == "smb":
if mpoint == "*":
return False
- else:
- cmd = powershell("net use %s" % mpoint)
- ret, out, err = g.run(mclient, cmd, user)
- if ret != 0:
- return False
- else:
- expected_output = ("Remote name \\\%s\gluster-%s" %
- (mserver, volname))
- if expected_output in out:
- return True
- else:
- return False
+ cmd = powershell("net use %s" % mpoint)
+ ret, out, err = g.run(mclient, cmd, user)
+ if ret != 0:
+ return False
+ expected_output = (r"\\\%s\gluster-%s" %
+ (mserver, volname))
+ if "Remote name" in out and expected_output in out:
+ return True
+ return False
else:
ret, _, _ = g.run(mclient, "mount | grep %s | grep %s | grep \"%s\""
% (volname, mpoint, mserver), user)
diff --git a/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py b/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py
index 390a6b9..fd7d8f4 100644
--- a/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py
+++ b/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py
@@ -105,7 +105,7 @@ class NfsGaneshaClusterSetupClass(GlusterBaseClass):
ganesha_ha_contents = fh.read()
g.rpyc_close_connection(
host=cls.servers_in_nfs_ganesha_cluster[0], user="root")
- servers_in_existing_cluster = re.findall('VIP_(.*)\=.*',
+ servers_in_existing_cluster = re.findall(r'VIP_(.*)\=.*',
ganesha_ha_contents)
ret = teardown_nfs_ganesha_cluster(
diff --git a/glustolibs-gluster/glustolibs/gluster/quota_libs.py b/glustolibs-gluster/glustolibs/gluster/quota_libs.py
index 6cb7701..5da4d86 100644..100755
--- a/glustolibs-gluster/glustolibs/gluster/quota_libs.py
+++ b/glustolibs-gluster/glustolibs/gluster/quota_libs.py
@@ -99,7 +99,7 @@ def quota_fetch_daemon_pid(nodes):
_rc = True
if isinstance(nodes, str):
nodes = [nodes]
- cmd = "pgrep -f quotad | grep -v ^$$\$"
+ cmd = r"pgrep -f quotad | grep -v ^$$\$"
g.log.info("Executing cmd: %s on node %s" % (cmd, nodes))
results = g.run_parallel(nodes, cmd)
for node in results:
diff --git a/glustolibs-io/glustolibs/io/utils.py b/glustolibs-io/glustolibs/io/utils.py
index 8b9a9e1..8584e2a 100644..100755
--- a/glustolibs-io/glustolibs/io/utils.py
+++ b/glustolibs-io/glustolibs/io/utils.py
@@ -149,7 +149,7 @@ def list_all_files_and_dirs_mounts(mounts):
mounts = [mounts]
ignore_dirs_list = [".trashcan"]
- ignore_dirs = "\|".join(ignore_dirs_list)
+ ignore_dirs = r"\|".join(ignore_dirs_list)
g.log.info("Start Listing mounts files and dirs")
all_mounts_procs = []
@@ -349,7 +349,7 @@ def cleanup_mounts(mounts):
# Check if mount points are empty
ignore_dirs_list = [".trashcan"]
- ignore_dirs = "\|".join(ignore_dirs_list)
+ ignore_dirs = r"\|".join(ignore_dirs_list)
all_mounts_procs = []
for mount_obj in mounts:
cmd = ("find %s -mindepth 1 | grep -ve '%s'" %
diff --git a/tests/functional/nfs_ganesha/test_nfs_ganesha_volume_exports.py b/tests/functional/nfs_ganesha/test_nfs_ganesha_volume_exports.py
index ead84db..65d7bc6 100644..100755
--- a/tests/functional/nfs_ganesha/test_nfs_ganesha_volume_exports.py
+++ b/tests/functional/nfs_ganesha/test_nfs_ganesha_volume_exports.py
@@ -463,7 +463,7 @@ class TestNfsGaneshaSubDirExportsWithIO(NfsGaneshaIOBaseClass):
export_file = ("/var/run/gluster/shared_storage/nfs-ganesha/exports/"
"export.%s.conf" % self.volname)
- cmd = ("sed -i s/'Path = .*'/'Path = \"\/%s\";'/g %s"
+ cmd = (r"sed -i s/'Path = .*'/'Path = \"\/%s\";'/g %s"
% (re.escape(self.mounts[0].volname), export_file))
ret, _, _ = g.run(self.mnode, cmd)
self.assertEqual(ret, 0, ("Unable to change Path info to %s in %s"
@@ -477,7 +477,7 @@ class TestNfsGaneshaSubDirExportsWithIO(NfsGaneshaIOBaseClass):
% ("/" + self.mounts[0].volname,
export_file)))
- cmd = ("sed -i s/'Pseudo=.*'/'Pseudo=\"\/%s\";'/g %s"
+ cmd = (r"sed -i s/'Pseudo=.*'/'Pseudo=\"\/%s\";'/g %s"
% (re.escape(self.mounts[0].volname), export_file))
ret, _, _ = g.run(self.mnode, cmd)
self.assertEqual(ret, 0, ("Unable to change pseudo Path info to "