aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2018-03-02 14:08:39 -0800
committerVictor Morales <victor.morales@intel.com>2018-03-02 14:14:02 -0800
commit96fe388aea872a5e4b7255422c44be24f77f646f (patch)
tree44d11190073bbac6c4c1d96005b4531c21c5e4c3
parent964af191e5d959ad855636cbab2dfa1350cbfa9e (diff)
Refactor install_docker_compose function
Usually this function is followed by a run command, this change ensure that docker-compose program is installed before its execution Change-Id: Ic68616a1db1e3c5bee516985c74f369a956d6775 Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: INT-436
-rwxr-xr-xbootstrap/vagrant-onap/lib/_onap_functions20
-rwxr-xr-xbootstrap/vagrant-onap/lib/commons5
-rwxr-xr-xbootstrap/vagrant-onap/lib/dcae3
-rwxr-xr-xbootstrap/vagrant-onap/lib/functions17
-rwxr-xr-xbootstrap/vagrant-onap/lib/multicloud4
-rwxr-xr-xbootstrap/vagrant-onap/lib/policy3
6 files changed, 31 insertions, 21 deletions
diff --git a/bootstrap/vagrant-onap/lib/_onap_functions b/bootstrap/vagrant-onap/lib/_onap_functions
index f68d6dbf0..c65e58958 100755
--- a/bootstrap/vagrant-onap/lib/_onap_functions
+++ b/bootstrap/vagrant-onap/lib/_onap_functions
@@ -2,14 +2,18 @@
# create_configuration_files() - Store credentials in files
function create_configuration_files {
- mkdir -p /opt/config
- echo $nexus_docker_repo > /opt/config/nexus_docker_repo.txt
- echo $nexus_username > /opt/config/nexus_username.txt
- echo $nexus_password > /opt/config/nexus_password.txt
- echo $openstack_username > /opt/config/openstack_username.txt
- echo $openstack_tenant_id > /opt/config/tenant_id.txt
- echo $dmaap_topic > /opt/config/dmaap_topic.txt
- echo $docker_version > /opt/config/docker_version.txt
+ local onap_config_folder="/opt/config"
+
+ mkdir -p $onap_config_folder
+ pushd $onap_config_folder
+ echo $nexus_docker_repo > nexus_docker_repo.txt
+ echo $nexus_username > nexus_username.txt
+ echo $nexus_password > nexus_password.txt
+ echo $openstack_username > openstack_username.txt
+ echo $openstack_tenant_id > tenant_id.txt
+ echo $dmaap_topic > dmaap_topic.txt
+ echo $docker_version > docker_version.txt
+ popd
}
# docker_openecomp_login() - Login to OpenECOMP Docker Hub
diff --git a/bootstrap/vagrant-onap/lib/commons b/bootstrap/vagrant-onap/lib/commons
index 5d0c69108..90f73d230 100755
--- a/bootstrap/vagrant-onap/lib/commons
+++ b/bootstrap/vagrant-onap/lib/commons
@@ -32,13 +32,16 @@ function is_package_installed {
source /etc/os-release || source /usr/lib/os-release
case ${ID,,} in
*suse)
+ CHECK_CMD="zypper search --match-exact --installed"
;;
ubuntu|debian)
- dpkg -s "$@" > /dev/null
+ CHECK_CMD="dpkg -l"
;;
rhel|centos|fedora)
+ CHECK_CMD="rpm -q"
;;
esac
+ ${CHECK_CMD} "$@" &> /dev/null
}
# install_packages() - Install a list of packages
diff --git a/bootstrap/vagrant-onap/lib/dcae b/bootstrap/vagrant-onap/lib/dcae
index d6ebd8200..25efddddc 100755
--- a/bootstrap/vagrant-onap/lib/dcae
+++ b/bootstrap/vagrant-onap/lib/dcae
@@ -58,13 +58,12 @@ function get_dcae_images {
# install_dcae() - Function that clones and installs the DCAE controller services from source code
function install_dcae {
- install_docker_compose
pushd ${src_folders[dcae]}/demo/startup/controller
if [[ "$build_image" == "True" ]]; then
dcae_image=`docker images | grep dcae-controller | awk '{print $1 ":" $2}'`
sed -i "s|DOCKER-REGISTRY/openecomp/dcae-controller:DCAE-VERSION|$dcae_image|g" docker-compose.yml
sed -i "s|MTU|$MTU|g" docker-compose.yml
- /opt/docker/docker-compose up -d
+ run_docker_compose .
else
bash init.sh
install_package make
diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions
index 435c62177..79a80c6b0 100755
--- a/bootstrap/vagrant-onap/lib/functions
+++ b/bootstrap/vagrant-onap/lib/functions
@@ -60,10 +60,6 @@ function clone_repo {
else
_git_timed clone ${repo_url}${repo} $dest_folder
fi
- else
- pushd $dest_folder
- _git_timed pull
- popd
fi
}
@@ -277,6 +273,16 @@ function run_docker_image {
docker run $@
}
+# run_docker_compose() - Ensures that docker compose is installed and run it in background
+function run_docker_compose {
+ local folder=$1
+
+ install_docker_compose
+ pushd $folder
+ /opt/docker/docker-compose up -d
+ popd
+}
+
# install_docker_compose() - Download and install docker-engine
function install_docker_compose {
local docker_compose_version=${1:-1.12.0}
@@ -401,7 +407,7 @@ EOF
echo "${dev_name}1 $mount_dir ext4 errors=remount-ro,noatime,barrier=0 0 1" >> /etc/fstab
}
-# add no_proxy values to environment, used for internal IPs generated at deploy time
+# add_no_proxy_value() - Add no_proxy values into environment file, used for internal IPs generated at deploy time
function add_no_proxy_value {
if [[ `grep "no_proxy" /etc/environment` ]]; then
sed -i.bak "s/^no_proxy.*$/&,$1/" /etc/environment
@@ -414,3 +420,4 @@ function add_no_proxy_value {
echo "NO_PROXY=$1" >> /etc/environment
fi
}
+
diff --git a/bootstrap/vagrant-onap/lib/multicloud b/bootstrap/vagrant-onap/lib/multicloud
index d2b09f2aa..ff6f9708c 100755
--- a/bootstrap/vagrant-onap/lib/multicloud
+++ b/bootstrap/vagrant-onap/lib/multicloud
@@ -25,9 +25,7 @@ function get_multicloud_images {
# install_multicloud() -
function install_multicloud {
- #pushd ${src_folders[multicloud]}/openstack/$openstack_release
- #/opt/docker/docker-compose up -d
- #popd
+ #run_docker_compose ${src_folders[multicloud]}/openstack/$openstack_release
if [[ "$build_image" == "True" ]]; then
multicloud-api --port 9003 --host 0.0.0.0 &
else
diff --git a/bootstrap/vagrant-onap/lib/policy b/bootstrap/vagrant-onap/lib/policy
index 0dac14dee..1e633bef1 100755
--- a/bootstrap/vagrant-onap/lib/policy
+++ b/bootstrap/vagrant-onap/lib/policy
@@ -31,8 +31,7 @@ function install_policy {
pushd ${src_folders[policy]}/docker
chmod +x config/drools/drools-tweaks.sh
echo $IP_ADDRESS > config/pe/ip_addr.txt
- install_docker_compose
- /opt/docker/docker-compose up -d
+ run_docker_compose .
popd
}