From d42684ccde8f2dcd1fea0fc1f2ec7df6c89a0ce6 Mon Sep 17 00:00:00 2001 From: Mustapha Lansana Date: Wed, 30 Jul 2014 21:36:33 -0400 Subject: openstack: add support for openstackchef class to services Openstackchef enables us to recreate configuration files for services in an openstack installation. It does this by creating template file(s) out of configuration file(s) exposed to the class by services. The following services are inheriting the openstack class and then exposing a set of configuration files to the class. These services expose their configuration files to openstackchef by assigning them to the variable CHEF_SERVICES_CONF_FILES. The files are assumend to have been installed in the image directory under the service's WORKDIR. At build-time, openstackchef makes chef-solo templates out of the registered files. And at run-time, the deploychef package makes a call to chef-solo, which in-turn use the template files to recreate the registered configuration files. For legacy reasons, the string OPENSTACKCHEF_ENABLED is defined in openstackchef class, but it can be overwritten in a .bb, .class, .bbappend or local.conf file to an empty string when openstackchef support is not desired. This enables all of these services to be built without openstackchef support. In addition, it prevents the recipes from substituting the placeholders in their configuration files when inheriting openstackchef. Signed-off-by: Mustapha Lansana --- .../recipes-devtools/python/python-keystone_git.bb | 57 +++++++++++++--------- 1 file changed, 33 insertions(+), 24 deletions(-) (limited to 'meta-openstack/recipes-devtools/python/python-keystone_git.bb') diff --git a/meta-openstack/recipes-devtools/python/python-keystone_git.bb b/meta-openstack/recipes-devtools/python/python-keystone_git.bb index 49aa278..5e7fca1 100644 --- a/meta-openstack/recipes-devtools/python/python-keystone_git.bb +++ b/meta-openstack/recipes-devtools/python/python-keystone_git.bb @@ -22,7 +22,7 @@ PV="2014.2.b3+git${SRCPV}" S = "${WORKDIR}/git" -inherit setuptools update-rc.d identity hosts default_configs +inherit setuptools update-rc.d identity hosts default_configs openstackchef SERVICE_TOKEN = "password" TOKEN_FORMAT ?= "PKI" @@ -97,27 +97,36 @@ do_install_append() { ${KEYSTONE_CGI_DIR}/main cp -r ${S}/examples ${KEYSTONE_PACKAGE_DIR} - - sed -e "s:%SERVICE_TOKEN%:${SERVICE_TOKEN}:g" \ - -i ${KEYSTONE_CONF_DIR}/keystone.conf - sed -e "s:%DB_USER%:${DB_USER}:g" -i ${KEYSTONE_CONF_DIR}/keystone.conf - sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" \ - -i ${KEYSTONE_CONF_DIR}/keystone.conf - - sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" \ - -i ${KEYSTONE_CONF_DIR}/keystone.conf - sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" \ - -i ${KEYSTONE_CONF_DIR}/identity.sh - - sed -e "s:%TOKEN_FORMAT%:${TOKEN_FORMAT}:g" \ - -i ${KEYSTONE_CONF_DIR}/keystone.conf - + + if [ -z "${OPENSTACKCHEF_ENABLED}" ]; then + sed -e "s:%SERVICE_TOKEN%:${SERVICE_TOKEN}:g" \ + -i ${KEYSTONE_CONF_DIR}/keystone.conf + sed -e "s:%DB_USER%:${DB_USER}:g" -i ${KEYSTONE_CONF_DIR}/keystone.conf + sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" \ + -i ${KEYSTONE_CONF_DIR}/keystone.conf + + sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" \ + -i ${KEYSTONE_CONF_DIR}/keystone.conf + sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" \ + -i ${KEYSTONE_CONF_DIR}/identity.sh + + sed -e "s:%TOKEN_FORMAT%:${TOKEN_FORMAT}:g" \ + -i ${KEYSTONE_CONF_DIR}/keystone.conf + + sed -e "s/%ADMIN_PASSWORD%/${ADMIN_PASSWORD}/g" \ + -i ${D}${sysconfdir}/init.d/keystone + sed -e "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" \ + -i ${D}${sysconfdir}/init.d/keystone + sed -e "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" \ + -i ${D}${sysconfdir}/init.d/keystone + fi + sed "/# admin_endpoint = .*/a \ - public_endpoint = http://${CONTROLLER_IP}:8081/keystone/main/ " \ + public_endpoint = http://%CONTROLLER_IP%:8081/keystone/main/ " \ -i ${KEYSTONE_CONF_DIR}/keystone.conf sed "/# admin_endpoint = .*/a \ - admin_endpoint = http://${CONTROLLER_IP}:8081/keystone/admin/ " \ + admin_endpoint = http://%CONTROLLER_IP%:8081/keystone/admin/ " \ -i ${KEYSTONE_CONF_DIR}/keystone.conf if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; @@ -135,12 +144,6 @@ do_install_append() { cp run_tests.sh ${KEYSTONE_CONF_DIR} - sed -e "s/%ADMIN_PASSWORD%/${ADMIN_PASSWORD}/g" \ - -i ${D}${sysconfdir}/init.d/keystone - sed -e "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" \ - -i ${D}${sysconfdir}/init.d/keystone - sed -e "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" \ - -i ${D}${sysconfdir}/init.d/keystone if ${@base_contains('DISTRO_FEATURES', 'OpenLDAP', 'true', 'false', d)}; then @@ -187,6 +190,12 @@ role_tree_dn = ou=Roles,${LDAP_DN} \ fi } +CHEF_SERVICES_CONF_FILES := "\ + ${sysconfdir}/${SRCNAME}/keystone.conf \ + ${sysconfdir}/${SRCNAME}/identity.sh \ + ${sysconfdir}/init.d/keystone \ + " + pkg_postinst_${SRCNAME}-setup () { # python-keystone postinst start if [ "x$D" != "x" ]; then -- cgit v1.2.3-54-g00ecf