summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBala.FA <bala@gluster.com>2011-09-22 14:54:05 +0530
committerTim <timothyasir@gluster.com>2011-09-23 13:58:03 +0530
commit829d4aaae24d44384854575b40a013b846994fcf (patch)
tree99609301d7c1ea3a35f5d7455a9cebedebc44221 /src
parent42aa1ab4912acb2bec56d9cb0ad0cd9e3840c3db (diff)
Cleanup in delete_volume_cifs_all.py
Signed-off-by: Bala.FA <bala@gluster.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com.gluster.storage.management.gateway.scripts/src/gateway/delete_volume_cifs_all.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/com.gluster.storage.management.gateway.scripts/src/gateway/delete_volume_cifs_all.py b/src/com.gluster.storage.management.gateway.scripts/src/gateway/delete_volume_cifs_all.py
index 3456b92d..71a7612b 100755
--- a/src/com.gluster.storage.management.gateway.scripts/src/gateway/delete_volume_cifs_all.py
+++ b/src/com.gluster.storage.management.gateway.scripts/src/gateway/delete_volume_cifs_all.py
@@ -16,18 +16,13 @@ import Utils
def removeVolumeCifsConf(volumeName):
- 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.close()
except IOError, e: