From 05c16e2e35077260b21e286a8eb0948c085750c7 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 14 Oct 2015 15:33:20 -0400 Subject: [PATCH] Add openstack-health api server This commit adds the puppet config for running an openstack-health api instance. It'll use the subunit2sql trove db node as a data source. The puppet-openstack-health module is incorrectly named which is causing issues, a workaround to rename the repo is added to install_modules.sh. This is a temporary measure until the gerrit rename is completed. There is also a workaround in the apply test. Change-Id: I7e6d9664d087e7bdc21d92624991d0d5f86c0c99 --- install_modules.sh | 9 +++++- manifests/site.pp | 12 ++++++++ modules.env | 1 + .../manifests/openstack_health_api.pp | 30 +++++++++++++++++++ tools/apply-test.sh | 3 ++ 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 modules/openstack_project/manifests/openstack_health_api.pp diff --git a/install_modules.sh b/install_modules.sh index 4f42cf6723..9f40caa69c 100755 --- a/install_modules.sh +++ b/install_modules.sh @@ -89,7 +89,13 @@ for MOD in ${!SOURCE_MODULES[*]} ; do echo "Remote repos of the form repo.git are not supported: ${MOD}" exit 1 fi - MODULE_NAME=`echo $MOD | awk -F- '{print $NF}'` + # NOTE(mtreinish): hack around incorrectly named openstack-health, + # remove after the gerrit rename + if [[ `echo $MOD | grep -c 'openstack-health'` -eq 1 ]]; then + MODULE_NAME="openstack_health" + else + MODULE_NAME=`echo $MOD | awk -F- '{print $NF}'` + fi # set up git base command to use the correct path GIT_CMD_BASE="git --git-dir=${MODULE_PATH}/${MODULE_NAME}/.git --work-tree ${MODULE_PATH}/${MODULE_NAME}" # treat any occurrence of the module as a match @@ -107,6 +113,7 @@ for MOD in ${!SOURCE_MODULES[*]} ; do git clone $MOD "${MODULE_PATH}/${MODULE_NAME}" fi fi + # fetch the latest refs from the repo $GIT_CMD_BASE remote update # make sure the correct revision is installed, I have to use rev-list b/c rev-parse does not work with tags diff --git a/manifests/site.pp b/manifests/site.pp index 00b231f7f4..34708e2f50 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -133,6 +133,18 @@ node 'grafana.openstack.org' { } } +# Node-OS: trusty +node 'health.openstack.org' { + class { 'openstack_project::server': + iptables_public_tcp_ports => [80, 443], + sysadmins => hiera('sysadmins', []), + } + class { 'openstack_project::openstack_health_api': + subunit2sql_db_host => hiera('subunit2sql_db_host', 'localhost'), + } +} + + # Node-OS: precise node 'jenkins.openstack.org' { $group = "jenkins" diff --git a/modules.env b/modules.env index e3e2c4defa..591d27e80c 100644 --- a/modules.env +++ b/modules.env @@ -104,6 +104,7 @@ INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-mysql_backup"]=" INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-nodepool"]="origin/master" INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-odsreg"]="origin/master" INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-openafs"]="origin/master" +INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-openstack-health"]="origin/master" INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-openstackci"]="origin/master" INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-openstackid"]="origin/master" INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-os_client_config"]="origin/master" diff --git a/modules/openstack_project/manifests/openstack_health_api.pp b/modules/openstack_project/manifests/openstack_health_api.pp new file mode 100644 index 0000000000..91d4cd595f --- /dev/null +++ b/modules/openstack_project/manifests/openstack_health_api.pp @@ -0,0 +1,30 @@ +# Copyright 2013 Hewlett-Packard Development Company, L.P. +# +# 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. +# +# openstack-health api worker glue class. +# +class openstack_project::openstack_health_api ( + $subunit2sql_db_host = 'localhost', + $subunit2sql_db_user = 'query', + $subunit2sql_db_name = 'subunit2sql', + $subunit2sql_db_pass = 'query', + $hostname = $::fqdn, +) { + include 'openstack_health' + class { 'openstack_health::api': + db_uri => "mysql+pymysql://${subunit2sql_db_user}:${subunit2sql_db_pass}@${subunit2sql_db_host}/${subunit2sql_db_name}", + vhost_name => $hostname, + vhost_port => 80, + } +} diff --git a/tools/apply-test.sh b/tools/apply-test.sh index a946dad82c..2de7ad05ea 100755 --- a/tools/apply-test.sh +++ b/tools/apply-test.sh @@ -57,10 +57,13 @@ for MOD in ${!INTEGRATION_MODULES[*]}; do project_names+=" $project_scope/$repo_name" done +project_names+=" openstack-infra/puppet-openstack-health" + sudo -E /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \ git://git.openstack.org \ $project_names +sudo mv /etc/puppet/modules/openstack-health /etc/puppet/modules/openstack_health if [[ ! -d applytest ]] ; then mkdir applytest