[virt-bootstrap] [PATCH v6 21/26] Use env variable for temporary directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow the user to specify path for temprorary directory used by
virt-bootstrap using the `VIRTBOOTSTRAP_TMPDIR` env variable.
---
 src/virtBootstrap/utils.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/virtBootstrap/utils.py b/src/virtBootstrap/utils.py
index 4f8ae48..98664ea 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

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux