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

Cedric Bosdonnat cbosdonnat at suse.com
Sat Aug 19 13:40:29 UTC 2017


On Thu, 2017-08-17 at 10:40 +0100, Radostin Stoyanov wrote:
> ---
>  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')
ACK

--
Cedric




More information about the virt-tools-list mailing list