summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSri Vignesh <sselvan@redhat.com>2020-01-07 16:25:39 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2020-01-07 12:31:25 +0000
commit3de3cde07ee9968c9ef9e5aa5fc9d3846ef6d49c (patch)
tree568ff784e43a06ce664bb313f24944dd96e1c372
parent24f2f1ca2c9213b4d848863d0db6dcd3804f24b8 (diff)
[py2to3] Fix file gluster_init.py
- Use 'list' object type in comparisons instead of 'str'. Because it is differently treated in py2 and py3. Example: # In py2 isinstance(u'foo', str) is False # In py3 isinstance(u'foo', str) is True Change-Id: Ic0a5c1469e9951ee9b2472714004b05e2c5fdc94 Signed-off-by: Sri Vignesh <sselvan@redhat.com>
-rw-r--r--glustolibs-gluster/glustolibs/gluster/gluster_init.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/gluster_init.py b/glustolibs-gluster/glustolibs/gluster/gluster_init.py
index 10812c289..7467479b4 100644
--- a/glustolibs-gluster/glustolibs/gluster/gluster_init.py
+++ b/glustolibs-gluster/glustolibs/gluster/gluster_init.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2015-2016 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2015-2020 Red Hat, Inc. <http://www.redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ def start_glusterd(servers):
bool : True if starting glusterd is successful on all servers.
False otherwise.
"""
- if isinstance(servers, str):
+ if not isinstance(servers, list):
servers = [servers]
cmd = "pgrep glusterd || service glusterd start"
@@ -62,7 +62,7 @@ def stop_glusterd(servers):
bool : True if stopping glusterd is successful on all servers.
False otherwise.
"""
- if isinstance(servers, str):
+ if not isinstance(servers, list):
servers = [servers]
cmd = "service glusterd stop"
@@ -91,7 +91,7 @@ def restart_glusterd(servers):
bool : True if restarting glusterd is successful on all servers.
False otherwise.
"""
- if isinstance(servers, str):
+ if not isinstance(servers, list):
servers = [servers]
cmd = "service glusterd restart"
@@ -122,7 +122,7 @@ def is_glusterd_running(servers):
-1 : if glusterd not running and PID is alive
"""
- if isinstance(servers, str):
+ if not isinstance(servers, list):
servers = [servers]
cmd1 = "service glusterd status"
@@ -157,7 +157,7 @@ def env_setup_servers(servers):
False otherwise.
"""
- if isinstance(servers, str):
+ if not isinstance(servers, list):
servers = [servers]
g.log.info("The function isn't implemented fully")
@@ -175,7 +175,7 @@ def get_glusterd_pids(nodes):
return the process id's in dictionary format
Args:
- nodes ( str|list ) : Node/Nodes of the cluster
+ nodes (str|list) : Node(s) of the cluster
Returns:
tuple : Tuple containing two elements (ret, gluster_pids).
@@ -190,7 +190,7 @@ def get_glusterd_pids(nodes):
"""
glusterd_pids = {}
_rc = True
- if isinstance(nodes, str):
+ if not isinstance(nodes, list):
nodes = [nodes]
cmd = "pidof glusterd"