From e78499849bb23f451fa7a55296a9d576449249e4 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 8 Aug 2010 18:33:31 +0200 Subject: [PATCH] [molecule.utils] add mkdtemp() --- molecule/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/molecule/utils.py b/molecule/utils.py index df1147f..2b28b70 100644 --- a/molecule/utils.py +++ b/molecule/utils.py @@ -119,6 +119,14 @@ def empty_dir(dest_dir): if os.path.isdir(el): os.rmdir(el) +def mkdtemp(suffix=''): + """ + Generate a reliable temporary directory inside /var/tmp starting with + "molecule". + """ + return tempfile.mkdtemp(prefix = "molecule", dir = "/var/tmp", + suffix = suffix) + # using subprocess.call to not care about wildcards def remove_path(path): """