fix in juju commands to run as part of lxd group
[osm/devops.git] / installers / full_install_osm.sh
index df07d56..f0627c7 100755 (executable)
@@ -548,7 +548,7 @@ function install_juju() {
     sudo snap install juju --classic
     sudo dpkg-reconfigure -p medium lxd
     sg lxd -c "juju bootstrap --bootstrap-series=xenial localhost osm"
-    [ $(juju status |grep "osm" |wc -l) -eq 1 ] || FATAL "Juju installation failed"
+    [ $(sg lxd -c "juju status" |grep "osm" |wc -l) -eq 1 ] || FATAL "Juju installation failed"
     echo "Finished installation of juju"
 }
 
@@ -581,9 +581,16 @@ EONG
     echo "Finished generation of docker images"
 }
 
+function generate_config_log_folders() {
+    echo "Generating config and log folders"
+    sudo mkdir -p /etc/osm
+    sudo mkdir -p /var/log/osm
+    echo "Finished generation of config and log folders"
+}
+
 function generate_docker_env_files() {
     echo "Generating docker env files"
-    OSMLCM_VCA_HOST=`juju show-controller|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
+    OSMLCM_VCA_HOST=`sg lxd -c "juju show-controller"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
     OSMLCM_VCA_SECRET=`grep password ${HOME}/.local/share/juju/accounts.yaml |awk '{print $2}'`
     MYSQL_ROOT_PASSWORD=`date +%s | sha256sum | base64 | head -c 32`
     echo "OSMLCM_VCA_HOST=${OSMLCM_VCA_HOST}" |sudo tee ${OSM_DEVOPS}/installers/docker/lcm.env
@@ -652,7 +659,7 @@ function deploy_elk() {
 
 function deploy_perfmon() {
     echo "Generating osm/kafka-exporter docker image"
-    sg docker -c "docker build ${OSM_DEVOPS}/installers/docker/osm_metrics/kafka-exporter -f ${OSM_DEVOPS}/installers/docker/osm_metrics/kafka-exporter/Dockerfile -t osm/kafka-exporter || ! echo 'cannot build kafka-exporter docker image' >&2"
+    sg docker -c "docker build ${OSM_DEVOPS}/installers/docker/osm_metrics/kafka-exporter -f ${OSM_DEVOPS}/installers/docker/osm_metrics/kafka-exporter/Dockerfile -t osm/kafka-exporter --no-cache || ! echo 'cannot build kafka-exporter docker image' >&2"
     echo "Finished generation of osm/kafka-exporter docker image"
     echo "Deploying PM stack (Kafka exporter + Prometheus + Grafana)"
     sg docker -c "docker stack deploy -c ${OSM_DEVOPS}/installers/docker/osm_metrics/docker-compose.yml osm_metrics"
@@ -707,7 +714,7 @@ function install_vimemu() {
     git clone https://osm.etsi.org/gerrit/osm/vim-emu.git $EMUTEMPDIR
     # build vim-emu docker
     echo "Building vim-emu Docker container..."
-    sudo docker build -t vim-emu-img -f $EMUTEMPDIR/Dockerfile $EMUTEMPDIR/
+    sudo docker build -t vim-emu-img -f $EMUTEMPDIR/Dockerfile --no-cache $EMUTEMPDIR/
     # start vim-emu container as daemon
     echo "Starting vim-emu Docker container 'vim-emu' ..."
     if [ -n "$INSTALL_LIGHTWEIGHT" ]; then