diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/com.gluster.storage.management.gateway.scripts/src/common/Utils.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/com.gluster.storage.management.gateway.scripts/src/common/Utils.py b/src/com.gluster.storage.management.gateway.scripts/src/common/Utils.py index 874acaa8..9423c0af 100644 --- a/src/com.gluster.storage.management.gateway.scripts/src/common/Utils.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/common/Utils.py @@ -722,3 +722,17 @@ def readFile(fileName, lines=False): return [] else: return "" + + +def writeFile(fileName, content): + try: + fp = open(fileName, "w") + if isString(content): + fp.write(content) + elif type(content) == type([]): + fp.writelines(content) + fp.close() + return True + except IOError, e: + log("failed to write file %s: %s" % (fileName, str(e)) + return False |
