Improve the way to deploy onap via proxy
[demo.git] / boot / aaf_install.sh
index af0ebbf..ab7bcf7 100644 (file)
@@ -7,6 +7,15 @@ CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
 MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
 CODE_REPO=$(cat /opt/config/remote_repo.txt)
+HTTP_PROXY=$(cat /opt/config/http_proxy.txt)
+HTTPS_PROXY=$(cat /opt/config/https_proxy.txt)
+
+if [ $HTTP_PROXY != " " ]
+then
+    export http_proxy=$HTTP_PROXY
+    export https_proxy=$HTTPS_PROXY
+fi
+
 
 # Add host name to /etc/host to avoid warnings in openstack images
 if [[ $CLOUD_ENV != "rackspace" ]]
@@ -55,6 +64,8 @@ apt-get install --allow-unauthenticated -y apt-transport-https ca-certificates w
 # Download scripts from Nexus
 unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip aaf_vm_init.sh > /opt/aaf_vm_init.sh
 unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip aaf_serv.sh > /opt/aaf_serv.sh
+unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh
+chmod +x /opt/imagetest.sh
 chmod +x /opt/aaf_vm_init.sh
 chmod +x /opt/aaf_serv.sh
 mv /opt/aaf_serv.sh /etc/init.d
@@ -84,6 +95,11 @@ echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker
 
 cp /lib/systemd/system/docker.service /etc/systemd/system
 sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service
+if [ $HTTP_PROXY != "no_proxy" ]
+then
+cd /opt
+./imagetest.sh
+fi
 service docker restart
 
 # DNS IP address configuration
@@ -194,22 +210,29 @@ under the License.
    | specification in this list marked as active will be used.
    |-->
   <proxies>
-    <!-- proxy
-     | Specification for one proxy, to be used in connecting to the network.
-     |
     <proxy>
       <id>optional</id>
       <active>true</active>
       <protocol>http</protocol>
       <username>proxyuser</username>
       <password>proxypass</password>
-      <host>proxy.host.net</host>
-      <port>80</port>
+      <host>$(cat /opt/config/http_proxy.txt | cut -d ':' -f1)</host>
+      <port>$(cat /opt/config/http_proxy.txt | cut -d ':' -f2)</port>
+      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
+    </proxy>
+    <proxy>
+      <id>optional</id>
+      <active>true</active>
+      <protocol>https</protocol>
+      <username>proxyuser</username>
+      <password>proxypass</password>
+      <host>$(cat /opt/config/https_proxy.txt | cut -d ':' -f1)</host>
+      <port>$(cat /opt/config/https_proxy.txt | cut -d ':' -f2)</port>
       <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
     </proxy>
-    -->
   </proxies>
 
+
   <!-- servers
    | This is a list of authentication profiles, keyed by the server-id used within the system.
    | Authentication profiles can be used whenever maven must make a connection to a remote server.