From 829d4aaae24d44384854575b40a013b846994fcf Mon Sep 17 00:00:00 2001 From: "Bala.FA" Date: Thu, 22 Sep 2011 14:54:05 +0530 Subject: Cleanup in delete_volume_cifs_all.py Signed-off-by: Bala.FA --- .../src/gateway/delete_volume_cifs_all.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src') 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: -- cgit