summaryrefslogtreecommitdiffstats
path: root/doctor_tests/installer/common/set_fenix.sh
diff options
context:
space:
mode:
authorTomi Juvonen <tomi.juvonen@nokia.com>2019-11-07 13:09:45 +0200
committerTomi Juvonen <tomi.juvonen@nokia.com>2019-11-19 06:58:07 +0000
commita0528f67abe01f0bb4be3565cfef4fd049afa1fa (patch)
tree04b542e405e951067a8a65b09ce8a0e6ebf7e09b /doctor_tests/installer/common/set_fenix.sh
parente961ab783887a9c44d2a321df646f1c49f83b299 (diff)
Maintenance support for latest Fenix, python3 and Fuel
JIRA: DOCTOR-134 Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com> Change-Id: I51a93637f30b0eece2075a8277616fb97a1b230e
Diffstat (limited to 'doctor_tests/installer/common/set_fenix.sh')
-rw-r--r--doctor_tests/installer/common/set_fenix.sh82
1 files changed, 65 insertions, 17 deletions
diff --git a/doctor_tests/installer/common/set_fenix.sh b/doctor_tests/installer/common/set_fenix.sh
index a660af79..aac376cd 100644
--- a/doctor_tests/installer/common/set_fenix.sh
+++ b/doctor_tests/installer/common/set_fenix.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
##############################################################################
-# Copyright (c) 2018 Nokia Corporation and others.
+# Copyright (c) 2019 Nokia Corporation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -10,18 +10,74 @@
##############################################################################
# Config files
+docker -v >/dev/null || {
+echo "Fenix needs docker to be installed..."
+ver=`grep "UBUNTU_CODENAME" /etc/os-release | cut -d '=' -f 2`
+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $ver stable"
+apt install apt-transport-https ca-certificates curl software-properties-common
+apt update
+apt-cache policy docker-ce
+apt-get install -y docker-ce docker-ce-cli containerd.io
+dpkg -r --force-depends golang-docker-credential-helpers
+}
+
+docker ps | grep fenix >/dev/null && {
+REMOTE=`docker exec -ti fenix git rev-parse origin/master`
+LOCAL=`docker exec -ti fenix git rev-parse @`
+if [ $LOCAL = $REMOTE ]; then
+ echo "Fenix start: Already running latest"
+ exit 0
+else
+ echo "Fenix container needs to be recreated..."
+ # Remove previous container
+ for img in `docker image list | grep "^fenix" | awk '{print $1}'`; do
+ for dock in `docker ps --all -f "ancestor=$img" | grep "$img" | awk '{print $1}'`; do
+ docker stop $dock; docker rm $dock;
+ done;
+ docker image rm $img;
+ done
+fi
+} || echo "Fenix container needs to be created..."
+
+cp /root/keystonercv3 .
+
+transport=`grep -m1 "^transport" /etc/nova/nova.conf`
+. keystonercv3
+
echo "[DEFAULT]" > fenix.conf
-echo "[DEFAULT]" > fenix-api.conf
echo "port = 12347" >> fenix.conf
-echo "port = 12347" >> fenix-api.conf
-grep -m1 "^transport" /var/lib/config-data/puppet-generated/nova/etc/nova/nova.conf >> fenix.conf
-grep -m1 "^transport" /var/lib/config-data/puppet-generated/nova/etc/nova/nova.conf >> fenix-api.conf
+echo $transport >> fenix.conf
+
echo "[database]" >> fenix.conf
-MYSQLIP=`grep -m1 "^connection=mysql" /var/lib/config-data/puppet-generated/nova/etc/nova/nova.conf | sed -e "s/.*@//;s/\/.*//"`
-echo "connection=mysql+pymysql://fenix:fenix@$MYSQLIP/fenix?read_default_group=tripleo&read_default_file=/etc/my.cnf.d/tripleo.cnf" >> fenix.conf
+MYSQLIP=`grep -m1 "^connection" /etc/nova/nova.conf | sed -e "s/.*@//;s/\/.*//"`
+echo "connection = mysql+pymysql://fenix:fenix@$MYSQLIP/fenix" >> fenix.conf
+
+echo "[service_user]" >> fenix.conf
+echo "os_auth_url = $OS_AUTH_URL" >> fenix.conf
+echo "os_username = $OS_USERNAME" >> fenix.conf
+echo "os_password = $OS_PASSWORD" >> fenix.conf
+echo "os_user_domain_name = $OS_USER_DOMAIN_NAME" >> fenix.conf
+echo "os_project_name = $OS_PROJECT_NAME" >> fenix.conf
+echo "os_project_domain_name = $OS_PROJECT_DOMAIN_NAME" >> fenix.conf
+
+echo "[DEFAULT]" > fenix-api.conf
+echo "port = 12347" >> fenix-api.conf
+echo $transport >> fenix-api.conf
+
+echo "[keystone_authtoken]" >> fenix-api.conf
+echo "auth_url = $OS_AUTH_URL" >> fenix-api.conf
+echo "auth_type = password" >> fenix-api.conf
+echo "project_domain_name = $OS_PROJECT_DOMAIN_NAME" >> fenix-api.conf
+echo "project_name = $OS_PROJECT_NAME" >> fenix-api.conf
+echo "user_domain_name = $OS_PROJECT_DOMAIN_NAME" >> fenix-api.conf
+echo "password = $OS_PASSWORD" >> fenix-api.conf
+echo "username = $OS_USERNAME" >> fenix-api.conf
+echo "cafile = /opt/stack/data/ca-bundle.pem" >> fenix-api.conf
# Mysql pw
-MYSQLPW=`cat /var/lib/config-data/mysql/etc/puppet/hieradata/service_configs.json | grep mysql | grep root_password | awk -F": " '{print $2}' | awk -F"\"" '{print $2}'`
+# MYSQLPW=`cat /var/lib/config-data/mysql/etc/puppet/hieradata/service_configs.json | grep mysql | grep root_password | awk -F": " '{print $2}' | awk -F"\"" '{print $2}'`
+MYSQLPW=root
# Fenix DB
[ `mysql -uroot -p$MYSQLPW -e "SELECT host, user FROM mysql.user;" | grep fenix | wc -l` -eq 0 ] && {
@@ -31,17 +87,9 @@ MYSQLPW=`cat /var/lib/config-data/mysql/etc/puppet/hieradata/service_configs.jso
mysql -ufenix -pfenix -hlocalhost -e "DROP DATABASE IF EXISTS fenix;"
mysql -ufenix -pfenix -hlocalhost -e "CREATE DATABASE fenix CHARACTER SET utf8;"
-# Remove previous container
-for img in `docker image list | grep "^fenix" | awk '{print $1}'`; do
- for dock in `docker ps --all -f "ancestor=$img" | grep "$img" | awk '{print $1}'`; do
- docker stop $dock; docker rm $dock;
- done;
- docker image rm $img;
-done
-
# Build Fenix container and run it
chmod 700 run
-docker build --build-arg OPENSTACK=master --build-arg BRANCH=master --network host /home/heat-admin -t fenix | tail -1
+docker build --build-arg OPENSTACK=master --build-arg BRANCH=master --network host $PWD -t fenix | tail -1
docker run --network host -d --name fenix -p 12347:12347 -ti fenix
if [ $? -eq 0 ]; then
echo "Fenix start: OK"