Disable all OPNFV Features
[functest.git] / functest / ci / add_proxy.sh
1 #!/bin/bash
2
3 set -e
4
5 pushd "${1:-/home/opnfv/functest/images}" > /dev/null
6
7 images=${images-"\
8 cloudify-manager-premium-4.0.1.qcow2 \
9 ubuntu-14.04-server-cloudimg-amd64-disk1.img \
10 ubuntu-16.04-server-cloudimg-amd64-disk1.img"}
11
12 add_proxy () {
13     cat << EOF >> "$1"
14 http_proxy=${http_proxy:-http://proxy:8080}
15 HTTP_PROXY=${http_proxy:-http://proxy:8080}
16 https_proxy=${https_proxy:-${http_proxy:-http://proxy:8080}}
17 HTTPS_PROXY=${https_proxy:-${http_proxy:-http://proxy:8080}}
18 ftp_proxy=${ftp_proxy:-${http_proxy:-http://proxy:8080}}
19 FTP_PROXY=${ftp_proxy:-${http_proxy:-http://proxy:8080}}
20 no_proxy=${no_proxy:-"10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"}
21 NO_PROXY=${no_proxy:-"10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"}
22 EOF
23 }
24
25 tmpdir=$(mktemp -d)
26 for image in $images; do
27     if [ ! -f "$image" ]; then
28         echo "skip ${image} ($(pwd)/${image} not found)"
29         continue
30     fi
31     guestmount -a "${image}" -i --rw "${tmpdir}"
32     add_proxy "${tmpdir}/etc/environment"
33     if [[ ${image} == *"cloudify-manager"* ]]; then
34         add_proxy "${tmpdir}/etc/sysconfig/cloudify-mgmtworker"
35         add_proxy "${tmpdir}/etc/sysconfig/cloudify-restservice"
36     fi
37     guestunmount "${tmpdir}"
38 done
39
40 rmdir "${tmpdir}"
41 popd > /dev/null