[PATCH 3/5] Don't use hardcoded /tmp paths. (#1004404)

David Lehman dlehman at redhat.com
Mon Oct 14 17:44:21 UTC 2013


---
 blivet/__init__.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index 8f6e82a..d8c5c6f 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -53,6 +53,7 @@ import errno
 import sys
 import statvfs
 import copy
+import tempfile
 
 try:
     import nss.nss
@@ -168,12 +169,7 @@ def turnOnFilesystems(storage, mountOnly=False):
         try:
             storage.doIt()
         except FSResizeError as e:
-            if os.path.exists("/tmp/resize.out"):
-                details = open("/tmp/resize.out", "r").read()
-            else:
-                details = e.args[1]
-
-            if errorHandler.cb(e, e.args[0], details=details) == ERROR_RAISE:
+            if errorHandler.cb(e, e.args[0], details=e.args[1]) == ERROR_RAISE:
                 raise
         except Exception as e:
             raise
@@ -294,7 +290,7 @@ class Blivet(object):
         self.dasd = dasd.DASD()
 
         self._nextID = 0
-        self._dumpFile = "/tmp/storage.state"
+        self._dumpFile = "%s/storage.state" % tempfile.gettempdir()
 
         # these will both be empty until our reset method gets called
         self.devicetree = DeviceTree(conf=self.config,
-- 
1.8.1.4



More information about the anaconda-patches mailing list