diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 4c98c3b4..a32ef3c3 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -113,7 +113,8 @@ def writeYumConf(cachedir=None, repo=None, extrarepos=[], mirrorlist=[]): return None tmpdir = tempfile.gettempdir() - (f, yumconf) = tempfile.mkstemp(prefix='yum.conf', dir=tmpdir) + (fd, yumconf) = tempfile.mkstemp(prefix='yum.conf', dir=tmpdir) + f = os.fdopen(fd, 'w') f.write("[main]\n") f.write("cachedir=%s\n" % (cachedir,)) @@ -146,6 +147,7 @@ def writeYumConf(cachedir=None, repo=None, extrarepos=[], mirrorlist=[]): n += 1 f.close() + fd.close() return yumconf def getBuildArch(yumconf=None):