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 --- meta-openstack/classes/identity.bbclass | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'meta-openstack/classes/identity.bbclass') diff --git a/meta-openstack/classes/identity.bbclass b/meta-openstack/classes/identity.bbclass index c4b1394..1f4f408 100644 --- a/meta-openstack/classes/identity.bbclass +++ b/meta-openstack/classes/identity.bbclass @@ -163,9 +163,11 @@ python populate_packages_append () { postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True) if not postinst: - postinst = ' if [ "x$D" != "x" ]; then\n' + \ - ' exit 1\n' + \ - ' fi\n' + postinst = '' + + # Only execute on target. Header. + postinst += ' if [ -z "$D" ]; then\n' + postinst += servicecreate_postinst_common_copy if d.getVar('USERCREATE_PARAM_%s' % pkg, True): @@ -176,6 +178,9 @@ python populate_packages_append () { servicecreate_postinst_service = servicecreate_postinst_service_copy.replace("SERVICECREATE_PARAM", servicecreate_param(d, pkg)) postinst += servicecreate_postinst_service + # Footer. + postinst += ' fi\n' + d.setVar('pkg_postinst_%s' % pkg, postinst) bb.debug(1, 'pkg_postinst_%s = %s' % (pkg, d.getVar('pkg_postinst_%s' % pkg, True))) } -- cgit v1.2.3-54-g00ecf