From 42aa1ab4912acb2bec56d9cb0ad0cd9e3840c3db Mon Sep 17 00:00:00 2001 From: "Bala.FA" Date: Thu, 22 Sep 2011 14:52:20 +0530 Subject: Cleanup in delete_user_cifs_all.py Signed-off-by: Bala.FA --- .../src/gateway/delete_user_cifs_all.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/com.gluster.storage.management.gateway.scripts') diff --git a/src/com.gluster.storage.management.gateway.scripts/src/gateway/delete_user_cifs_all.py b/src/com.gluster.storage.management.gateway.scripts/src/gateway/delete_user_cifs_all.py index 3c68891c..cf49ed5c 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/gateway/delete_user_cifs_all.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/gateway/delete_user_cifs_all.py @@ -16,18 +16,12 @@ import Utils def removeUser(userName): - try: - fp = open(Globals.CIFS_USER_FILE) - content = fp.read() - fp.close() - except IOError, e: - Utils.log("failed to read file %s: %s" % (Globals.CIFS_USER_FILE, str(e))) - return False - + lines = Utils.readFile(Globals.CIFS_USER_FILE, lines=True) try: fp = open(Globals.CIFS_USER_FILE, "w") - lines = content.strip().split() for line in lines: + if not line.strip(): + continue if line.split(":")[1] == userName: continue fp.write("%s\n" % line) -- cgit