Fix multicloud build image process
[integration.git] / bootstrap / vagrant-onap / lib / multicloud
1 #!/bin/bash
2
3 source /var/onap/functions
4
5 openstack_release="newton"
6
7 # _build_multicloud_images() - Function that builds docker images from source code
8 function _build_multicloud_images {
9     install_docker
10     pushd ${src_folders[multicloud]}/openstack/$openstack_release
11     install_python_requirements .
12     python setup.py develop
13     #bash build_image.sh
14     popd
15 }
16
17 # get_multicloud_images() -
18 function get_multicloud_images {
19     if [[ "$build_image" == "True" ]]; then
20         _build_multicloud_images
21     else
22         pull_onap_image multicloud/openstack-$openstack_release
23     fi
24 }
25
26 # install_multicloud() - 
27 function install_multicloud {
28     #pushd ${src_folders[multicloud]}/openstack/$openstack_release
29     #/opt/docker/docker-compose up -d
30     #popd
31     if [[ "$build_image" == "True" ]]; then
32         multicloud-api --port 9003 --host 0.0.0.0 &
33     else
34         docker_id=`docker images | grep onap/multicloud/openstack-$openstack_release | grep latest |  awk '{print $3; exit}'`
35         docker run -d -p 0.0.0.0:9003:9003 $docker_id
36     fi
37 }
38
39 # init_multicloud() - Function that initialize Multi Cloud services
40 function init_multicloud {
41     if [[ "$clone_repo" == "True" ]]; then
42         clone_repos "multicloud"
43         if [[ "$compile_repo" == "True" ]]; then
44             compile_repos "multicloud"
45         fi
46     fi
47     if [[ "$skip_get_images" == "False" ]]; then
48         get_multicloud_images
49         if [[ "$skip_install" == "False" ]]; then
50             install_multicloud
51         fi
52     fi
53 }