From adae8ca0e2d2a7a628c070ad420d6054f6dab77c Mon Sep 17 00:00:00 2001 From: "Bala.FA" Date: Thu, 22 Sep 2011 14:16:58 +0530 Subject: Cleanup in VolumeUtils.py Signed-off-by: Bala.FA --- .../src/backend/VolumeUtils.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/VolumeUtils.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/VolumeUtils.py index e5256178..5476e090 100644 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/VolumeUtils.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/VolumeUtils.py @@ -16,17 +16,13 @@ import Utils def readVolumeSmbConfFile(fileName=Globals.VOLUME_SMBCONF_FILE): entryList = [] - try: - fp = open(fileName) - for line in fp: - tokens = line.split("#")[0].strip().split(";")[0].strip().split("=") - if len(tokens) != 2: - continue - if tokens[0].strip().upper() == "INCLUDE": - entryList.append(tokens[1].strip()) - fp.close() - except IOError, e: - Utils.log("Failed to open file %s: %s" % (fileName, str(e))) + lines = Utils.readFile(fileName, lines=True) + for line in lines: + tokens = line.split("#")[0].strip().split(";")[0].strip().split("=") + if len(tokens) != 2: + continue + if tokens[0].strip().upper() == "INCLUDE": + entryList.append(tokens[1].strip()) return entryList -- cgit