diff options
author | Bala.FA <bala@gluster.com> | 2011-09-22 14:48:55 +0530 |
---|---|---|
committer | Tim <timothyasir@gluster.com> | 2011-09-23 13:58:03 +0530 |
commit | 550323273d6d64a3eb9fc66b5027c995f497f1df (patch) | |
tree | 3ddb8e61fb990543b17e62d414a378050099776b /src/com.gluster.storage.management.gateway.scripts | |
parent | 562882f58ff56472eba9e8663def40a6b6e2a19a (diff) |
Cleanup in create_volume_cifs_all.py
Signed-off-by: Bala.FA <bala@gluster.com>
Diffstat (limited to 'src/com.gluster.storage.management.gateway.scripts')
-rwxr-xr-x | src/com.gluster.storage.management.gateway.scripts/src/gateway/create_volume_cifs_all.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/com.gluster.storage.management.gateway.scripts/src/gateway/create_volume_cifs_all.py b/src/com.gluster.storage.management.gateway.scripts/src/gateway/create_volume_cifs_all.py index 59e74bed..7186283c 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/gateway/create_volume_cifs_all.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/gateway/create_volume_cifs_all.py @@ -16,18 +16,13 @@ import Utils def addVolumeCifsConf(volumeName, userList): - try: - fp = open(Globals.CIFS_VOLUME_FILE) - content = fp.read() - fp.close() - except IOError, e: - Utils.log("failed to read file %s: %s" % (Globals.CIFS_VOLUME_FILE, str(e))) - content = "" - + lines = Utils.readFile(Globals.CIFS_VOLUME_FILE, lines=True) try: fp = open(Globals.CIFS_VOLUME_FILE, "w") - for line in content.split(): - if line.split(":")[0] != volumeName: + for line in lines: + if not line.strip(): + continue + if line.strip().split(":")[0] != volumeName: fp.write("%s\n" % line) fp.write("%s:%s\n" % (volumeName, ":".join(userList))) fp.close() |