From: garciadeblas Date: Wed, 22 May 2019 16:00:54 +0000 (+0200) Subject: installer: VCA CA certificate as env var for LCM X-Git-Tag: v6.0.0~8^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F89%2F7489%2F2;p=osm%2Fdevops.git installer: VCA CA certificate as env var for LCM Change-Id: I741a430b069c2ec0f70939fbde266029f0199053 Signed-off-by: garciadeblas --- diff --git a/installers/docker/__lcm__.env b/installers/docker/__lcm__.env index ee19aff1..7341297b 100644 --- a/installers/docker/__lcm__.env +++ b/installers/docker/__lcm__.env @@ -1,3 +1,4 @@ OSMLCM_VCA_HOST=__JUJU_CONTROLLER_IP__ OSMLCM_VCA_SECRET=__JUJU_PASSWORD__ OSMLCM_VCA_PUBKEY=__JUJU_PUBKEY__ +OSMLCM_VCA_CACERT=__JUJU_CACERT__ diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index 3276b143..d9ad8adb 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -30,6 +30,7 @@ function usage(){ echo -e " -H use specific juju host controller IP" echo -e " -S use VCA/juju secret key" echo -e " -P use VCA/juju public key file" + echo -e " -C use VCA/juju CA certificate file" echo -e " --vimemu: additionally deploy the VIM emulator as a docker container" echo -e " --elk_stack: additionally deploy an ELK docker stack for event logging" echo -e " --pm_stack: additionally deploy a Prometheus+Grafana stack for performance monitoring (PM)" @@ -778,6 +779,12 @@ function generate_docker_env_files() { $WORKDIR_SUDO sed -i "s|OSMLCM_VCA_PUBKEY.*|OSMLCM_VCA_PUBKEY=$OSM_VCA_PUBKEY|g" $OSM_DOCKER_WORK_DIR/lcm.env fi + if ! grep -Fq "OSMLCM_VCA_CACERT" $OSM_DOCKER_WORK_DIR/lcm.env; then + echo "OSMLCM_VCA_CACERT=${OSM_VCA_CACERT}" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/lcm.env + else + $WORKDIR_SUDO sed -i "s|OSMLCM_VCA_CACERT.*|OSMLCM_VCA_CACERT=$OSM_VCA_CACERT|g" $OSM_DOCKER_WORK_DIR/lcm.env + fi + # RO MYSQL_ROOT_PASSWORD=$(generate_secret) if [ ! -f $OSM_DOCKER_WORK_DIR/ro-db.env ]; then @@ -1024,6 +1031,10 @@ function install_lightweight() { OSM_VCA_PUBKEY=$(cat $HOME/.local/share/juju/ssh/juju_id_rsa.pub) [ -z "$OSM_VCA_PUBKEY" ] && FATAL "Cannot obtain juju public key" fi + if [ -z "$OSM_VCA_CACERT" ]; then + OSM_VCA_CACERT=$(juju controllers --format json | jq -r '.controllers["osm"]["ca-cert"]') + [ -z "$OSM_VCA_CACERT" ] && FATAL "Cannot obtain juju CA certificate" + fi if [ -z "$OSM_DATABASE_COMMONKEY" ]; then OSM_DATABASE_COMMONKEY=$(generate_secret) [ -z "OSM_DATABASE_COMMONKEY" ] && FATAL "Cannot generate common db secret"