+##
+# Copyright 2019 ETSI
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+##
+
OSMLCM_VCA_HOST=__JUJU_CONTROLLER_IP__
OSMLCM_VCA_SECRET=__JUJU_PASSWORD__
OSMLCM_VCA_PUBKEY=__JUJU_PUBKEY__
+OSMLCM_VCA_APIPROXY=__JUJU_APIPROXY__
+OSMLCM_VCA_CACERT=__JUJU_CACERT__
if ! grep -Fq "OSMLCM_VCA_PUBKEY" $OSM_DOCKER_WORK_DIR/lcm.env; then
echo "OSMLCM_VCA_PUBKEY=${OSM_VCA_PUBKEY}" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/lcm.env
else
- $WORKDIR_SUDO sed -i "s|OSMLCM_VCA_PUBKEY.*|OSMLCM_VCA_PUBKEY=$OSM_VCA_PUBKEY|g" $OSM_DOCKER_WORK_DIR/lcm.env
+ $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
+
+ if ! grep -Fq "OSMLCM_VCA_APIPROXY" $OSM_DOCKER_WORK_DIR/lcm.env; then
+ echo "OSMLCM_VCA_APIPROXY=${OSM_VCA_APIPROXY}" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/lcm.env
+ else
+ $WORKDIR_SUDO sed -i "s|OSMLCM_VCA_APIPROXY.*|OSMLCM_VCA_APIPROXY=${OSM_VCA_APIPROXY}|g" $OSM_DOCKER_WORK_DIR/lcm.env
fi
# RO
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_APIPROXY" ]; then
+ OSM_VCA_APIPROXY=$DEFAULT_IP
+ [ -z "$OSM_VCA_APIPROXY" ] && FATAL "Cannot obtain juju api proxy"
+ fi
+ juju_createproxy
+
+ if [ -z "$OSM_VCA_CACERT" ]; then
+ OSM_VCA_CACERT=$(juju controllers --format json | jq -r '.controllers["osm"]["ca-cert"]' | base64 | tr -d \\n)
+ [ -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"