diff options
author | Tomi Juvonen <tomi.juvonen@nokia.com> | 2018-12-21 12:43:57 +0200 |
---|---|---|
committer | Tomi Juvonen <tomi.juvonen@nokia.com> | 2019-03-26 15:53:28 +0200 |
commit | 73605c5c34b97ab56306bfa9af0f5888f3c7e46d (patch) | |
tree | 7175ebaec5ed949d32ee62b7ac412729b366446e /doctor_tests/installer/common | |
parent | 33293e9c23a21ad3228f46d2063f18c915eb2b79 (diff) |
Support Fenix as admin tool
If ADMIN_TOOL_TYPE=fenix we run maintenance testing using Fenix
instead of sample implementation. Testing will build Fenix
Docker container from latest master and make configuration
according to controller host.
JIRA: DOCTOR-131
Change-Id: I84c566b7afc3c4e488aeed63b5cf5c75046d1427
Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com>
Diffstat (limited to 'doctor_tests/installer/common')
-rw-r--r-- | doctor_tests/installer/common/set_fenix.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/doctor_tests/installer/common/set_fenix.sh b/doctor_tests/installer/common/set_fenix.sh new file mode 100644 index 00000000..a660af79 --- /dev/null +++ b/doctor_tests/installer/common/set_fenix.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +############################################################################## +# Copyright (c) 2018 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 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# Config files +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 "[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 + +# 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}'` + +# Fenix DB +[ `mysql -uroot -p$MYSQLPW -e "SELECT host, user FROM mysql.user;" | grep fenix | wc -l` -eq 0 ] && { + mysql -uroot -p$MYSQLPW -hlocalhost -e "CREATE USER 'fenix'@'localhost' IDENTIFIED BY 'fenix';" + mysql -uroot -p$MYSQLPW -hlocalhost -e "GRANT ALL PRIVILEGES ON fenix.* TO 'fenix'@'' identified by 'fenix';FLUSH PRIVILEGES;" +} +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 run --network host -d --name fenix -p 12347:12347 -ti fenix +if [ $? -eq 0 ]; then + echo "Fenix start: OK" +else + echo "Fenix start: FAILED" +fi +# To debug check log from fenix container +# docker exec -ti fenix tail -f /var/log/fenix-engine.log |