[virt-tools-list] [virt-manager PATCH 1/3] unattended: Do not create a "unattended" dir

Fabiano Fidêncio fidencio at redhat.com
Fri Jun 7 10:03:20 UTC 2019


Let's just use mktemp() as done in several other places and avoid the
risk of having the content of the folder overwritten in case of parallel
installations.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 virtinst/unattended.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/virtinst/unattended.py b/virtinst/unattended.py
index 11de2fed..99907c1b 100644
--- a/virtinst/unattended.py
+++ b/virtinst/unattended.py
@@ -8,6 +8,7 @@
 
 import logging
 import os
+import tempfile
 
 import gi
 gi.require_version('Libosinfo', '1.0')
@@ -264,7 +265,7 @@ def prepare_install_script(guest, unattended_data, url=None, os_media=None):
 
 
 def generate_install_script(script):
-    scratch = os.path.join(util.get_cache_dir(), "unattended")
+    scratch = tempfile.mktemp(dir=util.get_cache_dir())
     if not os.path.exists(scratch):
         os.makedirs(scratch, 0o751)
 
-- 
2.21.0




More information about the virt-tools-list mailing list