summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2018-06-20 14:12:22 -0400
committerJonathan Holloway <jholloway@redhat.com>2018-06-21 06:56:00 +0000
commit9917bb904e6e8e392b4857e73320e834854d16b8 (patch)
tree2445af268e5855cd99622e0cecd108f6550b63e4 /glustolibs-gluster/glustolibs/gluster
parentfb7cfdaee1c401352e8746de56c39d28c25bffaa (diff)
geo-rep: Set passwd for the given user
The API to set passwd for the given user and group in all the slave nodes. Change-Id: I69dc150c598c9101be825f159f037f4ad43706ed Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py b/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py
index e87090d..3e9978b 100644
--- a/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py
+++ b/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py
@@ -123,6 +123,37 @@ def georep_geoaccount(servers, groupname, groupaccount):
return True
+def georep_geoaccount_setpasswd(servers, groupname, groupaccount, passwd):
+ """ Creates a user account with which the geo-rep session can be securely
+ set up
+
+ Args:
+ servers (list): list of nodes on which cmd is to be executed
+ groupname (str): Specifies a groupname
+ groupaccount (str): Specifies the user account to set up geo-rep
+ passwd (str): Specifies password for they groupaccount
+
+ Returns:
+ bool : True if password set is successful on all servers.
+ False otherwise.
+
+ """
+ cmd = "echo %s:%s | chpasswd" % (groupaccount, passwd)
+ results = g.run_parallel(servers, cmd)
+
+ _rc = True
+ for server, ret_value in results.iteritems():
+ retcode, _, err = ret_value
+ if retcode != 0:
+ g.log.error("Unable to set passwd for user %s on %s",
+ groupaccount, server)
+ _rc = False
+ if not _rc:
+ return False
+
+ return True
+
+
def georep_mountbroker_setup(mnode, groupname, directory):
""" Sets up mountbroker root directory and group