Reduce the number of update_repo calls 55/22355/2
authorVictor Morales <victor.morales@intel.com>
Mon, 6 Nov 2017 19:51:37 +0000 (11:51 -0800)
committerVictor Morales <victor.morales@intel.com>
Mon, 6 Nov 2017 20:00:15 +0000 (12:00 -0800)
The update_repo function allows to fetch repository metadata. This
function can take some time during the initial provisioning time.
This change reduce the number of calls to that function.

Change-Id: I2a0b0f13f7a3e6b37f0c0316ae9730a3ed840238
Signed-off-by: Victor Morales <victor.morales@intel.com>
Issue-Id: INT-324

bootstrap/vagrant-onap/lib/commons
bootstrap/vagrant-onap/lib/functions
bootstrap/vagrant-onap/tests/_test_base
bootstrap/vagrant-onap/vagrant_utils/postinstall.sh

index ba7c761..2b01dc5 100755 (executable)
@@ -24,7 +24,6 @@ function is_package_installed {
 # install_packages() - Install a list of packages
 function install_packages {
     local package=$@
-    update_repos
     apt-get install -y -qq $package
 }
 
index 1a1b2aa..de6f9ee 100755 (executable)
@@ -75,6 +75,7 @@ function install_java {
     fi
     install_package software-properties-common
     add-apt-repository -y ppa:openjdk-r/ppa
+    update_repos
 
     # Remove Java 7
     uninstall_packages default-jre openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless
@@ -92,6 +93,7 @@ function install_maven {
     install_java
     install_package software-properties-common
     add-apt-repository -y ppa:andrei-pozolotin/maven3
+    update_repos
     install_package maven3
 
     # Remove Java 7
@@ -173,6 +175,7 @@ function install_docker {
         add-apt-repository \
         "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
         $(lsb_release -cs) stable"
+    update_repos
 
     install_package docker-ce
     _configure_docker_settings
index 7d0415a..78c7f8b 100644 (file)
@@ -1,11 +1,13 @@
 #!/bin/bash
 
 source /var/onap_tests/asserts
+source /var/onap/commons
 
 # main() - Starting point for Unit Tests
 function main {
     local covered_functions=("$@")
 
+    update_repos
     len=${#covered_functions[@]}
     echo "1..$len"
     for i in ${!covered_functions[@]}; do
index 7083f3d..748d1b5 100755 (executable)
@@ -6,6 +6,7 @@ fi
 
 source /var/onap/functions
 
+update_repos
 create_configuration_files
 install_dev_tools
 configure_bind