[virt-tools-list] [virt-bootstrap] [PATCH v7 21/26] Use environment variable for temporary directory
Radostin Stoyanov
rstoyanov1 at gmail.com
Sat Aug 26 20:42:10 UTC 2017
Allow the user to specify path for temporary directory used by
virt-bootstrap using the `VIRTBOOTSTRAP_TMPDIR` environment variable.
---
src/virtBootstrap/utils.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/virtBootstrap/utils.py b/src/virtBootstrap/utils.py
index d5da5c1..489592c 100644
--- a/src/virtBootstrap/utils.py
+++ b/src/virtBootstrap/utils.py
@@ -52,6 +52,12 @@ else:
DEFAULT_IMG_DIR = os.environ['HOME']
DEFAULT_IMG_DIR += "/.local/share/virt-bootstrap/docker_images"
+# Set temporary directory
+tmp_dir = os.environ.get('VIRTBOOTSTRAP_TMPDIR', '/tmp')
+if not os.path.exists(tmp_dir):
+ os.makedirs(tmp_dir)
+tempfile.tempdir = tmp_dir
+
class BuildImage(object):
"""
--
2.13.5
More information about the virt-tools-list
mailing list