From 35b201ea42e07d38d755605a1ef61abaa4d0cc21 Mon Sep 17 00:00:00 2001 From: "Bala.FA" Date: Wed, 10 Aug 2011 15:48:30 +0530 Subject: create_volume_cifs.py ignores already existing mount directory and reload samba on success. Signed-off-by: Bala.FA --- .../src/create_volume_cifs.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/com.gluster.storage.management.gateway.scripts/src/create_volume_cifs.py b/src/com.gluster.storage.management.gateway.scripts/src/create_volume_cifs.py index 9da715e6..5a27ab87 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/create_volume_cifs.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/create_volume_cifs.py @@ -25,16 +25,22 @@ def main(): volumeMountDirName = "%s/%s" % (Globals.REEXPORT_DIR, volumeName) try: - os.mkdir(volumeMountDirName) + if not os.path.exists(volumeMountDirName): + os.mkdir(volumeMountDirName) except OSError, e: Utils.log("failed creating %s: %s\n" % (volumeMountDirName, str(e))) sys.stderr.write("Failed creating %s: %s\n" % (volumeMountDirName, str(e))) sys.exit(1) - if VolumeUtils.writeVolumeCifsConfiguration(volumeName, userList): - sys.exit(0) - sys.stderr.write("Unable to write volume cifs configuration\n") - sys.exit(2) + if not VolumeUtils.writeVolumeCifsConfiguration(volumeName, userList): + sys.stderr.write("Failed to write volume cifs configuration\n") + sys.exit(2) + + if Utils.runCommand("service smb reload") != 0: + Utils.log("Failed to reload smb service") + sys.stderr.write("Failed to reload smb service\n") + sys.exit(3) + sys.exit(0) if __name__ == "__main__": -- cgit