Merge "Change from using chef to local config files"
[integration.git] / bootstrap / vagrant-onap / lib / policy
1 #!/bin/bash
2
3 source /var/onap/functions
4
5 # _build_policy_images() - Function that build Policy docker images from source code
6 function _build_policy_images {
7     compile_src ${src_folders[policy]}/docker
8     pushd ${src_folders[policy]}/docker
9     install_maven
10     mvn prepare-package
11     cp -r target/policy-pe/* policy-pe/
12     cp -r target/policy-drools/* policy-drools
13     install_docker
14     bash docker_verify.sh
15     popd
16 }
17
18 # get_policy_images() - Function that retrieves Policy docker images
19 function get_policy_images {
20     if [[ "$build_image" == "True" ]]; then
21         _build_policy_images
22     else
23         for image in db pe drools nexus; do
24             pull_onap_image policy/policy-$image onap/policy/policy-$image:latest
25         done
26     fi
27 }
28
29 # install_policy() - Function that clones and installs the Policy services from source code
30 function install_policy {
31     pushd ${src_folders[policy]}/docker
32     chmod +x config/drools/drools-tweaks.sh
33     echo $IP_ADDRESS > config/pe/ip_addr.txt
34     run_docker_compose .
35     popd
36 }
37
38 # init_policy() - Function that initialize Policy services
39 function init_policy {
40     if [[ "$clone_repo" == "True" ]]; then
41         clone_repos "policy"
42         if [[ "$compile_repo" == "True" ]]; then
43             compile_repos "policy"
44         fi
45     fi
46
47     if [[ "$skip_get_images" == "False" ]]; then
48         get_policy_images
49         if [[ "$skip_install" == "False" ]]; then
50             install_policy
51         fi
52     fi
53 }