[virt-tools-list] [virt-bootstrap] [PATCH v6 25/26] Use cache directory to store downloaded tar files

Radostin Stoyanov rstoyanov1 at gmail.com
Thu Aug 17 09:40:03 UTC 2017


---
 src/virtBootstrap/utils.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/virtBootstrap/utils.py b/src/virtBootstrap/utils.py
index f670919..d699778 100644
--- a/src/virtBootstrap/utils.py
+++ b/src/virtBootstrap/utils.py
@@ -47,11 +47,14 @@ DEF_BASE_IMAGE_SIZE = 5 * 1024 * 1024 * 1024
 
 if os.geteuid() == 0:
     LIBVIRT_CONN = "lxc:///"
-    DEFAULT_IMG_DIR = "/var/lib/virt-bootstrap/docker_images"
+    DEFAULT_IMG_DIR = "/var/cache/virt-bootstrap/docker_images"
 else:
     LIBVIRT_CONN = "qemu:///session"
-    DEFAULT_IMG_DIR = os.environ['HOME']
-    DEFAULT_IMG_DIR += "/.local/share/virt-bootstrap/docker_images"
+    if 'XDG_CACHE_HOME' in os.environ:
+        DEFAULT_IMG_DIR = os.environ['XDG_CACHE_HOME']
+    else:
+        DEFAULT_IMG_DIR = os.environ['HOME'] + '/.cache'
+    DEFAULT_IMG_DIR += '/virt-bootstrap/docker_images'
 
 # Set temporary directory
 tmp_dir = os.environ.get('VIRTBOOTSTRAP_TMPDIR', '/tmp')
-- 
2.13.5




More information about the virt-tools-list mailing list