summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster
diff options
context:
space:
mode:
authorNigel Babu <nigelb@redhat.com>2018-05-03 19:40:45 +0530
committerNigel Babu <nigelb@redhat.com>2018-05-03 19:42:26 +0530
commit4445fe45268a6216fc6feb82268f51fa5bd2c6e0 (patch)
treef112e918b5688952d835d92122f349121a437a68 /glustolibs-gluster/glustolibs/gluster
parent2270f397413e4f7dae6ed1e831847096350f3acb (diff)
Fix a mistake in gluster_init lib
Also fix pylint errors while I'm fixing things in there Change-Id: I62904384a7b7a441b426003b18743f3d3a7f2dde
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/gluster_init.py48
1 files changed, 24 insertions, 24 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/gluster_init.py b/glustolibs-gluster/glustolibs/gluster/gluster_init.py
index 5d08acd..e59d36f 100644
--- a/glustolibs-gluster/glustolibs/gluster/gluster_init.py
+++ b/glustolibs-gluster/glustolibs/gluster/gluster_init.py
@@ -39,13 +39,13 @@ def start_glusterd(servers):
cmd = "pgrep glusterd || service glusterd start"
results = g.run_parallel(servers, cmd)
- rc = True
+ _rc = True
for server, ret_values in results.iteritems():
- retcode, out, err = ret_values
+ retcode, _, _ = ret_values
if retcode != 0:
g.log.error("Unable to start glusterd on server %s", server)
- rc = False
- if not rc:
+ _rc = False
+ if not _rc:
return False
return True
@@ -68,13 +68,13 @@ def stop_glusterd(servers):
cmd = "service glusterd stop"
results = g.run_parallel(servers, cmd)
- rc = True
+ _rc = True
for server, ret_values in results.iteritems():
- retcode, out, err = ret_values
+ retcode, _, _ = ret_values
if retcode != 0:
- g.log.error("Unable to start glusterd on server %s", server)
- rc = False
- if not rc:
+ g.log.error("Unable to stop glusterd on server %s", server)
+ _rc = False
+ if not _rc:
return False
return True
@@ -97,13 +97,13 @@ def restart_glusterd(servers):
cmd = "service glusterd restart"
results = g.run_parallel(servers, cmd)
- rc = True
+ _rc = True
for server, ret_values in results.iteritems():
- retcode, out, err = ret_values
+ retcode, _, _ = ret_values
if retcode != 0:
g.log.error("Unable to restart glusterd on server %s", server)
- rc = False
- if not rc:
+ _rc = False
+ if not _rc:
return False
return True
@@ -130,17 +130,17 @@ def is_glusterd_running(servers):
cmd1_results = g.run_parallel(servers, cmd1)
cmd2_results = g.run_parallel(servers, cmd2)
- rc = 0
+ _rc = 0
for server, ret_values in cmd1_results.iteritems():
- retcode, out, err = ret_values
+ retcode, _, _ = ret_values
if retcode != 0:
g.log.error("glusterd is not running on the server %s", server)
- rc = 1
+ _rc = 1
if cmd2_results[server][0] == 0:
g.log.error("PID of glusterd is alive and status is not "
"running")
- rc = -1
- return rc
+ _rc = -1
+ return _rc
# TODO: THIS IS NOT IMPLEMENTED YET. PLEASE DO THIS MANUALLY
@@ -194,15 +194,15 @@ def get_glusterd_pids(nodes):
nodes = [nodes]
cmd = "pidof glusterd"
- g.log.info("Executing cmd: %s on node %s" % (cmd, nodes))
+ g.log.info("Executing cmd: %s on node %s", cmd, nodes)
results = g.run_parallel(nodes, cmd)
for node in results:
- ret, out, err = results[node]
+ ret, out, _ = results[node]
if ret == 0:
if len(out.strip().split("\n")) == 1:
if not out.strip():
g.log.error("NO glusterd process found "
- "on node %s" % node)
+ "on node %s", node)
_rc = False
glusterd_pids[node] = ['-1']
else:
@@ -211,13 +211,13 @@ def get_glusterd_pids(nodes):
out.strip().split("\n"), node)
glusterd_pids[node] = (out.strip().split("\n"))
else:
- g.log.error("More than One glusterd process "
- "found on node %s" % node)
+ g.log.error("More than one glusterd process "
+ "found on node %s", node)
_rc = False
glusterd_pids[node] = out
else:
g.log.error("Not able to get glusterd process "
- "from node %s" % node)
+ "from node %s", node)
_rc = False
glusterd_pids[node] = ['-1']