From 53c0be677699954e9cd5beb76165c034f777d6df Mon Sep 17 00:00:00 2001 From: Sreejith Punnapuzha Date: Thu, 23 Apr 2020 11:31:16 -0500 Subject: [PATCH] Add proxy support for pip3 package installation This commit adds proxy support for pip installation. if environment variable http_proxy is set, pip uses it for package installation else it will continue without proxy Change-Id: Iffa0f592853f3e05824263734410c64b5774ab33 Signed-off-by: Sreejith Punnapuzha --- tools/gate/00_setup.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/gate/00_setup.sh b/tools/gate/00_setup.sh index a7c21aa0d..963b94203 100755 --- a/tools/gate/00_setup.sh +++ b/tools/gate/00_setup.sh @@ -32,9 +32,13 @@ mkdir -p "$TMP_DIR" envsubst <"${AIRSHIPCTL_WS}/tools/gate/config_template.yaml" > "$PLAYBOOK_CONFIG" # use new version of ansible, Ubuntu has old one -sudo apt install software-properties-common python3-pip -sudo apt-get -y --no-install-recommends install docker.io make -sudo pip3 install ansible +sudo apt -y install software-properties-common python3-pip +sudo apt -y --no-install-recommends install docker.io make +if [[ -z "${http_proxy}" ]]; then + sudo pip3 install ansible +else + sudo pip3 --proxy "${http_proxy}" install ansible +fi echo "primary ansible_host=localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python3" > "$ANSIBLE_HOSTS" printf "[defaults]\nroles_path = %s/roles\n" "$AIRSHIPCTL_WS" > "$ANSIBLE_CFG"