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-swift_git.bb | 50 +++++++++++++--------- 1 file changed, 29 insertions(+), 21 deletions(-) (limited to 'meta-openstack/recipes-devtools/python/python-swift_git.bb') diff --git a/meta-openstack/recipes-devtools/python/python-swift_git.bb b/meta-openstack/recipes-devtools/python/python-swift_git.bb index b00788f..bac992a 100644 --- a/meta-openstack/recipes-devtools/python/python-swift_git.bb +++ b/meta-openstack/recipes-devtools/python/python-swift_git.bb @@ -20,7 +20,7 @@ SRCREV="d4da726f6f45187dc053578f11246d6b36679142" PV="2.1.0+git${SRCPV}" S = "${WORKDIR}/git" -inherit setuptools python-dir update-rc.d hosts identity +inherit setuptools python-dir update-rc.d hosts identity openstackchef # The size of the backing file (in Gigabytes) of loopback devices # which are used for setting up Swift storage devices. The value @@ -82,31 +82,39 @@ do_install_append() { sed 's/^# swift_dir =.*/swift_dir = \/etc\/swift/' -i ${SWIFT_CONF_DIR}/object-server.conf sed 's/^# devices =.*/devices = \/etc\/swift\/node/' -i ${SWIFT_CONF_DIR}/object-server.conf sed 's/^# mount_check =.*/mount_check = false/' -i ${SWIFT_CONF_DIR}/object-server.conf - - sed "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${SWIFT_CONF_DIR}/proxy-server.conf - sed "s/%SERVICE_USER%/${SRCNAME}/g" -i ${SWIFT_CONF_DIR}/proxy-server.conf - sed "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/proxy-server.conf - - sed "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${SWIFT_CONF_DIR}/dispersion.conf - sed "s/%SERVICE_USER%/${SRCNAME}/g" -i ${SWIFT_CONF_DIR}/dispersion.conf - sed "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/dispersion.conf - - sed "s/%ADMIN_TENANT_NAME%/admin/g" -i ${SWIFT_CONF_DIR}/test.conf - sed "s/%ADMIN_USER%/admin/g" -i ${SWIFT_CONF_DIR}/test.conf - sed "s/%ADMIN_PASSWORD%/${ADMIN_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/test.conf - sed "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${SWIFT_CONF_DIR}/test.conf - sed "s/%SERVICE_USER%/${SRCNAME}/g" -i ${SWIFT_CONF_DIR}/test.conf - sed "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/test.conf - sed "s/%DEMO_USER%/demo/g" -i ${SWIFT_CONF_DIR}/test.conf - sed "s/%DEMO_PASSWORD%/${ADMIN_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/test.conf - + if [ -z "${OPENSTACKCHEF_ENABLED}" ]; then + sed "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${SWIFT_CONF_DIR}/proxy-server.conf + sed "s/%SERVICE_USER%/${SRCNAME}/g" -i ${SWIFT_CONF_DIR}/proxy-server.conf + sed "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/proxy-server.conf + + sed "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${SWIFT_CONF_DIR}/dispersion.conf + sed "s/%SERVICE_USER%/${SRCNAME}/g" -i ${SWIFT_CONF_DIR}/dispersion.conf + sed "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/dispersion.conf + + sed "s/%ADMIN_TENANT_NAME%/admin/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%ADMIN_USER%/admin/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%ADMIN_PASSWORD%/${ADMIN_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%SERVICE_USER%/${SRCNAME}/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%DEMO_USER%/demo/g" -i ${SWIFT_CONF_DIR}/test.conf + sed "s/%DEMO_PASSWORD%/${ADMIN_PASSWORD}/g" -i ${SWIFT_CONF_DIR}/test.conf + + sed "s/%SWIFT_BACKING_FILE_SIZE%/${SWIFT_BACKING_FILE_SIZE}/g" -i ${D}${sysconfdir}/init.d/swift + sed "s/%CONTROLLER_IP%/${CONTROLLER_IP}/g" -i ${D}${sysconfdir}/init.d/swift + fi cp -r test ${D}/${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/ grep -rl '^from test' ${D}/${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/test | xargs sed 's/^from test/from swift\.test/g' -i - sed "s/%SWIFT_BACKING_FILE_SIZE%/${SWIFT_BACKING_FILE_SIZE}/g" -i ${D}${sysconfdir}/init.d/swift - sed "s/%CONTROLLER_IP%/${CONTROLLER_IP}/g" -i ${D}${sysconfdir}/init.d/swift } +CHEF_SERVICES_CONF_FILES := " \ + ${sysconfdir}/${SRCNAME}/test.conf \ + ${sysconfdir}/${SRCNAME}/dispersion.conf \ + ${sysconfdir}/${SRCNAME}/proxy-server.conf \ + ${sysconfdir}/init.d/swift \ + " + pkg_postinst_${SRCNAME}-setup () { if [ "x$D" != "x" ]; then exit 1 -- cgit v1.2.3-54-g00ecf