diff options
Diffstat (limited to 'src/lib/Bcfg2/Client/Tools')
-rw-r--r-- | src/lib/Bcfg2/Client/Tools/POSIX/File.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/lib/Bcfg2/Client/Tools/POSIX/File.py b/src/lib/Bcfg2/Client/Tools/POSIX/File.py index 558d360b1..40aade818 100644 --- a/src/lib/Bcfg2/Client/Tools/POSIX/File.py +++ b/src/lib/Bcfg2/Client/Tools/POSIX/File.py @@ -107,16 +107,13 @@ class POSIXFile(POSIXTool): (os.path.dirname(entry.get('name')), err)) return False try: - try: - os.fdopen(newfd, 'w').write(filedata) - except (OSError, IOError): - err = sys.exc_info()[1] - self.logger.error("POSIX: Failed to open temp file %s for " - "writing %s: %s" % - (newfile, entry.get("name"), err)) - return False - finally: - os.close(newfd) + os.fdopen(newfd, 'w').write(filedata) + except (OSError, IOError): + err = sys.exc_info()[1] + self.logger.error("POSIX: Failed to open temp file %s for writing " + "%s: %s" % + (newfile, entry.get("name"), err)) + return False return newfile def _rename_tmpfile(self, newfile, entry): |