summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2008-01-11 10:36:25 +0000
committerMark McLoughlin <markmc@redhat.com>2008-01-11 10:36:25 +0000
commit8b3024080bacd79ab022efc9a2b8f8a1d0ea3728 (patch)
tree3700ceb99dbe9d7523fcf4e148bf1a3993a34095
parentae099fe006f7759e3cdf55690911adf1cf31bf6b (diff)
downloadfreeipa-8b3024080bacd79ab022efc9a2b8f8a1d0ea3728.tar.gz
freeipa-8b3024080bacd79ab022efc9a2b8f8a1d0ea3728.tar.xz
freeipa-8b3024080bacd79ab022efc9a2b8f8a1d0ea3728.zip
Use tempfile.mkdtemp() rather than hardcoded tmpdir
httpinstance.py currently uses a hardcoded /tmp/ipa temporary directory. Make it use tempfile.mkdtemp() instead. Signed-off-by: Mark McLoughlin <markmc@redhat.com>
-rw-r--r--ipa-server/ipaserver/httpinstance.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/ipa-server/ipaserver/httpinstance.py b/ipa-server/ipaserver/httpinstance.py
index 4f8946b45..beca3e83a 100644
--- a/ipa-server/ipaserver/httpinstance.py
+++ b/ipa-server/ipaserver/httpinstance.py
@@ -131,15 +131,10 @@ class HTTPInstance(service.Service):
shutil.copy(ds_ca.cacert_fname, "/usr/share/ipa/html/ca.crt")
os.chmod("/usr/share/ipa/html/ca.crt", 0444)
- try:
- shutil.rmtree("/tmp/ipa")
- except:
- pass
- os.mkdir("/tmp/ipa")
- shutil.copy("/usr/share/ipa/html/preferences.html", "/tmp/ipa")
-
+ tmpdir = tempfile.mkdtemp(prefix = "tmp-")
+ shutil.copy("/usr/share/ipa/html/preferences.html", tmpdir)
ca.run_signtool(["-k", "Signing-Cert",
"-Z", "/usr/share/ipa/html/configure.jar",
"-e", ".html",
- "/tmp/ipa"])
- shutil.rmtree("/tmp/ipa")
+ tmpdir])
+ shutil.rmtree(tmpdir)