diff options
author | Thierry ALLENO <thierry.alleno@orange.com> | 2019-07-05 16:42:11 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2019-07-10 20:08:12 +0200 |
commit | a101dc76e5e12b388d1837996f04767f9925fbbf (patch) | |
tree | 284df328fbe2d0702a7493657ee43ea4ac42288f | |
parent | 917af9e7c9c5f0395d2edcc4e5d51ed1ca294949 (diff) |
set proxies in ubuntu for juju_epc use case
Modification in add_proxy.sh in order to set proxy for juju_epc in various middleware(maven, subversion,...).
And add some control for modification of cloudify container.
Remove some trailing lines and define http_proxy using http_proxy_host and http_proxy_port.
Change-Id: I9d85387f107b1b050ee96bf0ee6df9ba662b0df4
Signed-off-by: Thierry ALLENO <thierry.alleno@orange.com>
(cherry picked from commit 16bd94efa559df105c28b90c891c84088b0c651e)
-rw-r--r-- | functest/ci/add_proxy.sh | 78 |
1 files changed, 66 insertions, 12 deletions
diff --git a/functest/ci/add_proxy.sh b/functest/ci/add_proxy.sh index f815ef09b..a3270b136 100644 --- a/functest/ci/add_proxy.sh +++ b/functest/ci/add_proxy.sh @@ -4,7 +4,10 @@ set -e pushd "${1:-/home/opnfv/functest/images}" > /dev/null -http_proxy=${http_proxy:-http://proxy:8080} +http_proxy_host=${http_proxy_host:-proxy} +http_proxy_port=${http_proxy_port:-8080} + +http_proxy=http://${http_proxy_host}:${http_proxy_port} https_proxy=${https_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"} @@ -33,6 +36,44 @@ Acquire::https::Proxy "${https_proxy}"; EOF } +add_proxy_juju_env () { + cat << EOF >> "$1" +export no_proxy="${no_proxy}"; +export NO_PROXY="${no_proxy}"; +EOF +} + +add_proxy_juju_systemd () { + cat << EOF >> "$1" +[Manager] +DefaultEnvironment="no_proxy='${no_proxy}'" "NO_PROXY='${no_proxy}'" +EOF +} + +add_proxy_maven () { + cat << EOF >> "$1" +<settings> + <proxies> + <proxy> + <id>example-proxy</id> + <active>true</active> + <protocol>http</protocol> + <host>"${http_proxy_host}"</host> + <port>"${http_proxy_port}"</port> + </proxy> + </proxies> +</settings> +EOF +} + +add_proxy_svn () { + cat << EOF >> "$1" +[global] +http-proxy-host = "${http_proxy_host}" +http-proxy-port = "${http_proxy_port}" +EOF +} + tmpdir=$(mktemp -d) for image in $images; do if [ ! -f "$image" ]; then @@ -43,20 +84,27 @@ for image in $images; do add_proxy "${tmpdir}/etc/environment" if [[ ${image} == "ubuntu"* ]]; then add_proxy_apt "${tmpdir}/etc/apt/apt.conf" + add_proxy_juju_env "${tmpdir}/etc/juju-proxy.conf" + add_proxy_juju_systemd "${tmpdir}/etc/juju-proxy-systemd.conf" + mkdir -p ${tmpdir}/root/.m2 + mkdir -p ${tmpdir}/root/.subversion + add_proxy_maven "${tmpdir}/root/.m2/settings.xml}" + add_proxy_svn "${tmpdir}/root/.subversion/servers}" fi guestunmount "${tmpdir}" done -sudo docker load -i cloudify-docker-manager-community-19.01.24.tar -dockerfile=${tmpdir}/Dockerfile -cat << EOF > $dockerfile +if [ -f cloudify-docker-manager-community-19.01.24.tar ]; then + sudo docker load -i cloudify-docker-manager-community-19.01.24.tar + dockerfile=${tmpdir}/Dockerfile + cat << EOF > $dockerfile FROM docker-cfy-manager:latest ENV HTTP_PROXY "${http_proxy}" ENV HTTPS_PROXY "${https_proxy}" ENV NO_PROXY "${no_proxy}" EOF -for f in /etc/sysconfig/cloudify-mgmtworker /etc/sysconfig/cloudify-restservice; do \ - cat << EOF >> $dockerfile + for f in /etc/sysconfig/cloudify-mgmtworker /etc/sysconfig/cloudify-restservice; do \ + cat << EOF >> $dockerfile RUN echo >> $f RUN echo "http_proxy=${http_proxy}" >> $f RUN echo "https_proxy=${https_proxy}" >> $f @@ -64,12 +112,18 @@ RUN echo "HTTP_PROXY=${http_proxy}" >> $f RUN echo "HTTPS_PROXY=${https_proxy}" >> $f RUN echo "no_proxy=${no_proxy}" >> $f EOF -done -sudo docker build -t docker-cfy-manager -f $dockerfile ${tmpdir} -sudo docker save \ - docker-cfy-manager > cloudify-docker-manager-community-19.01.24.tar -sudo docker rmi docker-cfy-manager + done + sudo docker build -t docker-cfy-manager -f $dockerfile ${tmpdir} + sudo docker save \ + docker-cfy-manager > cloudify-docker-manager-community-19.01.24.tar + sudo docker rmi docker-cfy-manager + + rm "${dockerfile}" +else + echo "skip cloudify-docker-manager-community-19.01.24.tar \ + ($(pwd)/cloudify-docker-manager-community-19.01.24.tar not found)" +fi -rm "${dockerfile}" rmdir "${tmpdir}" popd > /dev/null + |