diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-09-10 06:12:44 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-09-12 12:03:39 +0200 |
commit | 96119d184f41470e63e58e4235569baf49f99253 (patch) | |
tree | 1fa14a4ef43d9a5a4491e8e9729cd775989fd914 | |
parent | 80888497f7f6f4abb93d0c9dc368cb2009f8fc3e (diff) |
Ease adding proxies in vms
It eases running VNFs behind proxies as they download packages.
Change-Id: I187078dab744c51188b9835417d1a29fad1b4bd6
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit d5fce8c12bc73c1b1547df2750563c271a3ab3f6)
-rw-r--r-- | functest/ci/add_proxy.sh | 41 | ||||
-rw-r--r-- | setup.cfg | 1 | ||||
-rw-r--r-- | tox.ini | 1 |
3 files changed, 43 insertions, 0 deletions
diff --git a/functest/ci/add_proxy.sh b/functest/ci/add_proxy.sh new file mode 100644 index 000000000..d19153811 --- /dev/null +++ b/functest/ci/add_proxy.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +set -e + +pushd "${1:-/home/opnfv/functest/images}" > /dev/null + +images=${images-"\ +cloudify-manager-premium-4.0.1.qcow2 \ +ubuntu-14.04-server-cloudimg-amd64-disk1.img \ +ubuntu-16.04-server-cloudimg-amd64-disk1.img"} + +add_proxy () { + cat << EOF >> "$1" +http_proxy=${http_proxy:-http://proxy:8080} +HTTP_PROXY=${http_proxy:-http://proxy:8080} +https_proxy=${https_proxy:-${http_proxy:-http://proxy:8080}} +HTTPS_PROXY=${https_proxy:-${http_proxy:-http://proxy:8080}} +ftp_proxy=${ftp_proxy:-${http_proxy:-http://proxy:8080}} +FTP_PROXY=${ftp_proxy:-${http_proxy:-http://proxy:8080}} +no_proxy=${no_proxy:-"10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"} +NO_PROXY=${no_proxy:-"10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"} +EOF +} + +tmpdir=$(mktemp -d) +for image in $images; do + if [ ! -f "$image" ]; then + echo "skip ${image} ($(pwd)/${image} not found)" + continue + fi + guestmount -a "${image}" -i --rw "${tmpdir}" + add_proxy "${tmpdir}/etc/environment" + if [[ ${image} == *"cloudify-manager"* ]]; then + add_proxy "${tmpdir}/etc/sysconfig/cloudify-mgmtworker" + add_proxy "${tmpdir}/etc/sysconfig/cloudify-restservice" + fi + guestunmount "${tmpdir}" +done + +rmdir "${tmpdir}" +popd > /dev/null @@ -6,6 +6,7 @@ home-page = https://wiki.opnfv.org/display/functest [files] packages = functest scripts = + functest/ci/add_proxy.sh functest/ci/convert_images.sh functest/ci/download_images.sh @@ -109,6 +109,7 @@ commands = nosetests {[testenv:py35]dirs} basepython = python2.7 files = functest/opnfv_tests/openstack/rally/scenario/support/instance_dd_test.sh + functest/ci/add_proxy.sh functest/ci/convert_images.sh functest/ci/download_images.sh build.sh |