From 3a87eddc7fb83c5cdbbc231f0fd2a94e92d958d7 Mon Sep 17 00:00:00 2001 From: Maru Newby Date: Thu, 25 Oct 2012 23:01:06 +0000 Subject: [PATCH] Added options to improve offline usage. * NOVA_ZIPBALL_URL can be set for a XS/XCP install to point to a non-standard zipball location. * PIP_USE_MIRRORS (default True) can be set to False to stop pip from attempting to use mirrors (useful for when using an offline eggproxy). Change-Id: I01a9944fe4c13c8cc8323a703f598bc498491b73 --- functions | 9 +++++++-- tools/xen/install_os_domU.sh | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/functions b/functions index dbe9d30a68..8008500467 100644 --- a/functions +++ b/functions @@ -7,6 +7,7 @@ # ``GLANCE_HOSTPORT`` # ``OFFLINE`` # ``PIP_DOWNLOAD_CACHE`` +# ``PIP_USE_MIRRORS`` # ``RECLONE`` # ``TRACK_DEPENDS`` # ``http_proxy``, ``https_proxy``, ``no_proxy`` @@ -578,7 +579,8 @@ function is_set() { # Wrapper for ``pip install`` to set cache and proxy environment variables -# Uses globals ``OFFLINE``, ``PIP_DOWNLOAD_CACHE``, ``TRACK_DEPENDES``, ``*_proxy` +# Uses globals ``OFFLINE``, ``PIP_DOWNLOAD_CACHE``, ``PIP_USE_MIRRORS``, +# ``TRACK_DEPENDS``, ``*_proxy` # pip_install package [package ...] function pip_install { [[ "$OFFLINE" = "True" || -z "$@" ]] && return @@ -597,11 +599,14 @@ function pip_install { CMD_PIP=/usr/bin/pip-python fi fi + if [[ "$PIP_USE_MIRRORS" != "False" ]]; then + PIP_MIRROR_OPT="--use-mirrors" + fi $SUDO_PIP PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE:-/var/cache/pip} \ HTTP_PROXY=$http_proxy \ HTTPS_PROXY=$https_proxy \ NO_PROXY=$no_proxy \ - $CMD_PIP install --use-mirrors $@ + $CMD_PIP install $PIP_MIRROR_OPT $@ } diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh index 0bb6ac8a18..c78c6f2e94 100755 --- a/tools/xen/install_os_domU.sh +++ b/tools/xen/install_os_domU.sh @@ -57,8 +57,8 @@ then fi # get nova -nova_zipball=$(echo $NOVA_REPO | sed "s:\.git$::;s:$:/zipball/$NOVA_BRANCH:g") -wget $nova_zipball -O nova-zipball --no-check-certificate +NOVA_ZIPBALL_URL=${NOVA_ZIPBALL_URL:-$(echo $NOVA_REPO | sed "s:\.git$::;s:$:/zipball/$NOVA_BRANCH:g")} +wget $NOVA_ZIPBALL_URL -O nova-zipball --no-check-certificate unzip -o nova-zipball -d ./nova # install xapi plugins