python-*: fixup postinst scripts
PATCH 1/1 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'.
--- meta-openstack/classes/identity.bbclass | 11 +++-- .../recipes-devtools/python/python-barbican_git.bb | 8 ++-- .../python/python-ceilometer_git.bb | 24 +++++------ .../recipes-devtools/python/python-cinder_git.bb | 48 ++++++++++----------- .../recipes-devtools/python/python-glance_git.bb | 24 +++++------ .../recipes-devtools/python/python-heat_git.bb | 24 +++++------ .../recipes-devtools/python/python-keystone_git.bb | 50 +++++++++++----------- .../recipes-devtools/python/python-neutron_git.bb | 32 ++++++-------- .../recipes-devtools/python/python-nova_git.bb | 42 ++++++++---------- .../recipes-devtools/python/python-rally_git.bb | 28 ++++++------ .../recipes-devtools/python/python-swift_git.bb | 40 ++++++++--------- .../recipes-devtools/python/python-trove_git.bb | 45 ++++++++++--------- .../postgresql/postgresql_9.%.bbappend | 14 +++--- 13 files changed, 185 insertions(+), 205 deletions(-)
meta-openstack/classes/identity.bbclass +8 -3
@@ -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))) }
meta-openstack/recipes-devtools/python/python-barbican_git.bb +3 -5
@@ -85,12 +85,10 @@ FILES_${SRCNAME} = "${sysconfdir}/${SRCNAME}/* \ ALLOW_EMPTY_${SRCNAME}-setup = "1" pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + chown -R barbican:barbican ${sysconfdir}/${SRCNAME} + chown -R barbican:barbican ${localstatedir}/lib/barbican fi - - chown -R barbican:barbican ${sysconfdir}/${SRCNAME} - chown -R barbican:barbican ${localstatedir}/lib/barbican } DEPENDS += " \
meta-openstack/recipes-devtools/python/python-ceilometer_git.bb +11 -13
@@ -108,20 +108,18 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + sleep 2 + fi + + mkdir /var/log/ceilometer + sudo -u postgres createdb ceilometer + ceilometer-dbsync fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - sleep 2 - fi - - mkdir /var/log/ceilometer - sudo -u postgres createdb ceilometer - ceilometer-dbsync } inherit setuptools identity hosts update-rc.d default_configs monitor
meta-openstack/recipes-devtools/python/python-cinder_git.bb +23 -25
54 lines not on this page · raw message
meta-openstack/recipes-devtools/python/python-glance_git.bb +11 -13
@@ -122,20 +122,18 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + sleep 5 + fi + + mkdir /var/log/glance + sudo -u postgres createdb glance + glance-manage db_sync fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - sleep 5 - fi - - mkdir /var/log/glance - sudo -u postgres createdb glance - glance-manage db_sync } PACKAGES += " ${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-api ${SRCNAME}-registry"
meta-openstack/recipes-devtools/python/python-heat_git.bb +11 -13
@@ -107,20 +107,18 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + sleep 2 + fi + + mkdir /var/log/heat + sudo -u postgres createdb heat + heat-manage db_sync fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - sleep 2 - fi - - mkdir /var/log/heat - sudo -u postgres createdb heat - heat-manage db_sync } inherit setuptools identity hosts update-rc.d default_configs monitor
meta-openstack/recipes-devtools/python/python-keystone_git.bb +25 -25
62 lines not on this page · raw message
meta-openstack/recipes-devtools/python/python-neutron_git.bb +14 -18
@@ -138,29 +138,25 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + sleep 2 + fi + + sudo -u postgres createdb neutron + sudo neutron-db-manage --config-file /etc/neutron/neutron.conf \ + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - sleep 2 - fi - - sudo -u postgres createdb neutron - sudo neutron-db-manage --config-file /etc/neutron/neutron.conf \ - --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head } pkg_postinst_${SRCNAME}-plugin-openvswitch-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + /etc/init.d/openvswitch-switch start + ovs-vsctl --no-wait -- --may-exist add-br br-int fi - - /etc/init.d/openvswitch-switch start - ovs-vsctl --no-wait -- --may-exist add-br br-int } ALLOW_EMPTY_${SRCNAME}-setup = "1"
meta-openstack/recipes-devtools/python/python-nova_git.bb +19 -23
52 lines not on this page · raw message
meta-openstack/recipes-devtools/python/python-rally_git.bb +13 -15
@@ -63,22 +63,20 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + fi + + if [ ! -d /var/log/rally ]; then + mkdir /var/log/rally + fi + + sudo -u postgres createdb rally + rally-manage db recreate fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - fi - - if [ ! -d /var/log/rally ]; then - mkdir /var/log/rally - fi - - sudo -u postgres createdb rally - rally-manage db recreate } PACKAGES += "${SRCNAME}-tests ${SRCNAME}-api ${SRCNAME} ${SRCNAME}-setup"
meta-openstack/recipes-devtools/python/python-swift_git.bb +19 -21
@@ -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"
meta-openstack/recipes-devtools/python/python-trove_git.bb +22 -23
52 lines not on this page · raw message
meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend +6 -8
@@ -41,14 +41,12 @@ ALLOW_EMPTY_${PN}-setup = "1" pkg_postinst_${PN}-setup () { # postgres 9.2.4 postinst - if [ "x$D" != "x" ]; then - exit 1 - fi - - /etc/init.d/postgresql-init - if [ $? -ne 0 ]; then - echo "[ERROR] postgres: unable to create admin account" - exit 1 + if [ -z "$D" ]; then + /etc/init.d/postgresql-init + if [ $? -ne 0 ]; then + echo "[ERROR] postgres: unable to create admin account" + exit 1 + fi fi }
Signature · 1 line
2.7.4
Damn. Missed the [m-c-s] in the subject. Ignore this and I have resent for [m-c-s].
Quoted 598 lines · Mark Asselstine
Checking for "$D" and doing an "exit 1" now results in errors such as:
[
log_check] warning: %post(keystone-cronjobs-...) scriptlet failed, exit status 2during 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 <[email protected]>--- meta-openstack/classes/identity.bbclass | 11 +++-- .../recipes-devtools/python/python-barbican_git.bb | 8 ++-- .../python/python-ceilometer_git.bb | 24 +++++------ .../recipes-devtools/python/python-cinder_git.bb | 48 ++++++++++----------- .../recipes-devtools/python/python-glance_git.bb | 24 +++++------ .../recipes-devtools/python/python-heat_git.bb | 24 +++++------ .../recipes-devtools/python/python-keystone_git.bb | 50 +++++++++++----------- .../recipes-devtools/python/python-neutron_git.bb | 32 ++++++-------- .../recipes-devtools/python/python-nova_git.bb | 42 ++++++++---------- .../recipes-devtools/python/python-rally_git.bb | 28 ++++++------ .../recipes-devtools/python/python-swift_git.bb | 40 ++++++++--------- .../recipes-devtools/python/python-trove_git.bb | 45 ++++++++++--------- .../postgresql/postgresql_9.%.bbappend | 14 +++--- 13 files changed, 185 insertions(+), 205 deletions(-)meta-openstack/classes/identity.bbclass +8
-3@@ -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))) }meta-openstack/recipes-devtools/python/python-barbican_git.bb +3
-5@@ -85,12 +85,10 @@ FILES_${SRCNAME} = "${sysconfdir}/${SRCNAME}/* \ ALLOW_EMPTY_${SRCNAME}-setup = "1" pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + chown -R barbican:barbican ${sysconfdir}/${SRCNAME} + chown -R barbican:barbican ${localstatedir}/lib/barbican fi - - chown -R barbican:barbican ${sysconfdir}/${SRCNAME} - chown -R barbican:barbican ${localstatedir}/lib/barbican } DEPENDS += " \meta-openstack/recipes-devtools/python/python-ceilometer_git.bb +11
-13@@ -108,20 +108,18 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + sleep 2 + fi + + mkdir /var/log/ceilometer + sudo -u postgres createdb ceilometer + ceilometer-dbsync fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - sleep 2 - fi - - mkdir /var/log/ceilometer - sudo -u postgres createdb ceilometer - ceilometer-dbsync } inherit setuptools identity hosts update-rc.d default_configs monitormeta-openstack/recipes-devtools/python/python-cinder_git.bb +23
-25@@ -124,31 +124,29 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 - fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - fi - - if [ ! -d /var/log/cinder ]; then - mkdir /var/log/cinder - fi - - sudo -u postgres createdb cinder - cinder-manage db sync - - # Create Cinder nfs_share config file with default nfs server - if [ ! -f /etc/cinder/nfs_shares ]; then - /bin/bash /etc/cinder/drivers/nfs_setup.sh - fi - - # Create Cinder glusterfs_share config file with default glusterfs server - if [ ! -f /etc/cinder/glusterfs_shares ] && [ -f /usr/sbin/glusterfsd ]; then - /bin/bash /etc/cinder/drivers/glusterfs_setup.sh + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + fi + + if [ ! -d /var/log/cinder ]; then + mkdir /var/log/cinder + fi + + sudo -u postgres createdb cinder + cinder-manage db sync + + # Create Cinder nfs_share config file with default nfs server + if [ ! -f /etc/cinder/nfs_shares ]; then + /bin/bash /etc/cinder/drivers/nfs_setup.sh + fi + + # Create Cinder glusterfs_share config file with default glusterfs server + if [ ! -f /etc/cinder/glusterfs_shares ] && [ -f /usr/sbin/glusterfsd ]; then + /bin/bash /etc/cinder/drivers/glusterfs_setup.sh + fi fi }meta-openstack/recipes-devtools/python/python-glance_git.bb +11
-13@@ -122,20 +122,18 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + sleep 5 + fi + + mkdir /var/log/glance + sudo -u postgres createdb glance + glance-manage db_sync fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - sleep 5 - fi - - mkdir /var/log/glance - sudo -u postgres createdb glance - glance-manage db_sync } PACKAGES += " ${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-api ${SRCNAME}-registry"meta-openstack/recipes-devtools/python/python-heat_git.bb +11
-13@@ -107,20 +107,18 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + sleep 2 + fi + + mkdir /var/log/heat + sudo -u postgres createdb heat + heat-manage db_sync fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - sleep 2 - fi - - mkdir /var/log/heat - sudo -u postgres createdb heat - heat-manage db_sync } inherit setuptools identity hosts update-rc.d default_configs monitormeta-openstack/recipes-devtools/python/python-keystone_git.bb +25
-25@@ -189,28 +189,26 @@ role_tree_dn = ou=Roles,${LDAP_DN} \ pkg_postinst_${SRCNAME}-setup () { # python-keystone postinst start - if [ "x$D" != "x" ]; then - exit 1 - fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - sleep 2 - fi - - # This is to make sure keystone is configured and running - PIDFILE="/var/run/keystone-all.pid" - if [ -z `cat $PIDFILE 2>/dev/null` ]; then - sudo -u postgres createdb keystone - keystone-manage db_sync - keystone-manage pki_setup --keystone-user=root --keystone-group=daemon - - if ${@bb.utils.contains('DISTRO_FEATURES', 'OpenLDAP', 'true', 'false', d)}; then - /etc/init.d/openldap start - fi - /etc/init.d/keystone start + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + sleep 2 + fi + + # This is to make sure keystone is configured and running + PIDFILE="/var/run/keystone-all.pid" + if [ -z `cat $PIDFILE 2>/dev/null` ]; then + sudo -u postgres createdb keystone + keystone-manage db_sync + keystone-manage pki_setup --keystone-user=root --keystone-group=daemon + + if ${@bb.utils.contains('DISTRO_FEATURES', 'OpenLDAP', 'true', 'false', d)}; then + /etc/init.d/openldap start + fi + /etc/init.d/keystone start + fi fi }@@ -219,9 +217,11 @@ pkg_postinst_${SRCNAME}-setup () { KEYSTONE_TOKEN_FLUSH_TIME ??= "0 0 */2 * *" pkg_postinst_${SRCNAME}-cronjobs () { - # By default keystone expired tokens are not automatic removed out of the - # database. So we create a cronjob for cleaning these expired tokens. - echo "${KEYSTONE_TOKEN_FLUSH_TIME} root /usr/bin/keystone-manage token_flush" >> /etc/crontab + if [ -z "$D" ]; then + # By default keystone expired tokens are not automatic removed out of the + # database. So we create a cronjob for cleaning these expired tokens. + echo "${KEYSTONE_TOKEN_FLUSH_TIME} root /usr/bin/keystone-manage token_flush" >> /etc/crontab + fi } PACKAGES += " ${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-cronjobs"meta-openstack/recipes-devtools/python/python-neutron_git.bb +14
-18@@ -138,29 +138,25 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + sleep 2 + fi + + sudo -u postgres createdb neutron + sudo neutron-db-manage --config-file /etc/neutron/neutron.conf \ + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - sleep 2 - fi - - sudo -u postgres createdb neutron - sudo neutron-db-manage --config-file /etc/neutron/neutron.conf \ - --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head } pkg_postinst_${SRCNAME}-plugin-openvswitch-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + /etc/init.d/openvswitch-switch start + ovs-vsctl --no-wait -- --may-exist add-br br-int fi - - /etc/init.d/openvswitch-switch start - ovs-vsctl --no-wait -- --may-exist add-br br-int } ALLOW_EMPTY_${SRCNAME}-setup = "1"meta-openstack/recipes-devtools/python/python-nova_git.bb +19
-23@@ -160,33 +160,29 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + sleep 5 + fi + + sudo -u postgres createdb nova + sleep 2 + nova-manage db sync fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - sleep 5 - fi - - sudo -u postgres createdb nova - sleep 2 - nova-manage db sync } pkg_postinst_${SRCNAME}-common () { - if [ "x$D" != "x" ]; then - exit 1 - fi - - if [ -d /home/root ]; then - echo "source /etc/nova/openrc" >> /home/root/.bashrc - echo "source /etc/nova/openrc" >> /home/root/.profile - else - echo "source /etc/nova/openrc" >> /root/.bashrc - echo "source /etc/nova/openrc" >> /root/.profile + if [ -z "$D" ]; then + if [ -d /home/root ]; then + echo "source /etc/nova/openrc" >> /home/root/.bashrc + echo "source /etc/nova/openrc" >> /home/root/.profile + else + echo "source /etc/nova/openrc" >> /root/.bashrc + echo "source /etc/nova/openrc" >> /root/.profile + fi fi }meta-openstack/recipes-devtools/python/python-rally_git.bb +13
-15@@ -63,22 +63,20 @@ do_install_append() { } pkg_postinst_${SRCNAME}-setup () { - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + fi + + if [ ! -d /var/log/rally ]; then + mkdir /var/log/rally + fi + + sudo -u postgres createdb rally + rally-manage db recreate fi - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - fi - - if [ ! -d /var/log/rally ]; then - mkdir /var/log/rally - fi - - sudo -u postgres createdb rally - rally-manage db recreate } PACKAGES += "${SRCNAME}-tests ${SRCNAME}-api ${SRCNAME} ${SRCNAME}-setup"meta-openstack/recipes-devtools/python/python-swift_git.bb +19
-21@@ -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"meta-openstack/recipes-devtools/python/python-trove_git.bb +22
-23@@ -146,30 +146,29 @@ do_install_append() { pkg_postinst_${SRCNAME}-setup () { # python-trove-setup postinst start - if [ "x$D" != "x" ]; then - exit 1 + if [ -z "$D" ]; then + source /etc/nova/openrc + + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + /etc/init.d/postgresql-init + /etc/init.d/postgresql start + sleep 5 + fi + + mkdir /var/log/trove + # Create database for trove. + sudo -u postgres createdb trove + + # Create default trove database. + trove-manage db_sync + # Create new datastore. + trove-manage datastore_update "postgresql" "" + # Set up new version + trove-manage datastore_version_update "postgresql" "9.1" "postgresql" 1 "postgresql-server-9.1" 1 + # Set new default version. + trove-manage datastore_update "postgresql" "9.1" fi - source /etc/nova/openrc - - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - /etc/init.d/postgresql-init - /etc/init.d/postgresql start - sleep 5 - fi - - mkdir /var/log/trove - # Create database for trove. - sudo -u postgres createdb trove - - # Create default trove database. - trove-manage db_sync - # Create new datastore. - trove-manage datastore_update "postgresql" "" - # Set up new version - trove-manage datastore_version_update "postgresql" "9.1" "postgresql" 1 "postgresql-server-9.1" 1 - # Set new default version. - trove-manage datastore_update "postgresql" "9.1" }meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend +6
-9@@ -41,14 +41,12 @@ ALLOW_EMPTY_${PN}-setup = "1" pkg_postinst_${PN}-setup () { # postgres 9.2.4 postinst - if [ "x$D" != "x" ]; then - exit 1 - fi - - /etc/init.d/postgresql-init - if [ $? -ne 0 ]; then - echo "[ERROR] postgres: unable to create admin account" - exit 1 + if [ -z "$D" ]; then + /etc/init.d/postgresql-init + if [ $? -ne 0 ]; then + echo "[ERROR] postgres: unable to create admin account" + exit 1 + fi fi } --2.7.4
--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization