unattended: Do not create a "unattended" dir

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.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2019-06-07 12:03:20 +02:00 committed by Cole Robinson
parent e58d765ae5
commit 98bd275969

View File

@ -8,6 +8,7 @@
import logging import logging
import os import os
import tempfile
import gi import gi
gi.require_version('Libosinfo', '1.0') 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): 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): if not os.path.exists(scratch):
os.makedirs(scratch, 0o751) os.makedirs(scratch, 0o751)