From 3051160f23fe8e06e545859538c86ef3a3c39d7a Mon Sep 17 00:00:00 2001 From: Mark Asselstine Date: Wed, 15 Nov 2017 12:59:53 -0500 Subject: python-*: fixup postinst scripts Checking for "$D" and doing an "exit 1" now results in errors such as: [log_check] warning: %post(keystone-cronjobs-...) scriptlet failed, exit status 2 during image creation. Instead of escaping the script for "level-1" (image creation postinst) we wrap the "level-2" (first boot) postinst in an if statement. This also ensure the scriptlet in indentity.bbclass is less prone to behaving differently based on the postinsts defined in the classes which inherit 'identity'. Signed-off-by: Mark Asselstine Signed-off-by: Bruce Ashfield --- .../recipes-devtools/python/python-swift_git.bb | 40 ++++++++++------------ 1 file changed, 19 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 8552ea7..fc7c258 100644 --- a/meta-openstack/recipes-devtools/python/python-swift_git.bb +++ b/meta-openstack/recipes-devtools/python/python-swift_git.bb @@ -109,28 +109,26 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "x$D" ]; then + CLUSTER_CONF=/etc/swift/cluster.conf + SWIFT_SETUP='/bin/bash /etc/swift/swift_setup.sh' + + for i in `seq 1 3`; do + BACKING_FILE=/etc/swift/swift_backing_$i + if [ "x${SWIFT_BACKING_FILE_SIZE}" != "x0G" ]; then + truncate -s ${SWIFT_BACKING_FILE_SIZE} $BACKING_FILE + sed "s:%SWIFT_BACKING_FILE_${i}%:$BACKING_FILE:g" -i $CLUSTER_CONF + else + sed "s:%SWIFT_BACKING_FILE_${i}%::g" -i $CLUSTER_CONF + fi + done + + $SWIFT_SETUP createrings + $SWIFT_SETUP formatdevs + $SWIFT_SETUP mountdevs + $SWIFT_SETUP -i "${CONTROLLER_IP}" adddevs + $SWIFT_SETUP unmountdevs fi - - CLUSTER_CONF=/etc/swift/cluster.conf - SWIFT_SETUP='/bin/bash /etc/swift/swift_setup.sh' - - for i in `seq 1 3`; do - BACKING_FILE=/etc/swift/swift_backing_$i - if [ "x${SWIFT_BACKING_FILE_SIZE}" != "x0G" ]; then - truncate -s ${SWIFT_BACKING_FILE_SIZE} $BACKING_FILE - sed "s:%SWIFT_BACKING_FILE_${i}%:$BACKING_FILE:g" -i $CLUSTER_CONF - else - sed "s:%SWIFT_BACKING_FILE_${i}%::g" -i $CLUSTER_CONF - fi - done - - $SWIFT_SETUP createrings - $SWIFT_SETUP formatdevs - $SWIFT_SETUP mountdevs - $SWIFT_SETUP -i "${CONTROLLER_IP}" adddevs - $SWIFT_SETUP unmountdevs } PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup" -- cgit v1.2.3-54-g00ecf