summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Asselstine <mark.asselstine@windriver.com>2017-11-15 12:59:53 -0500
committerBruce Ashfield <bruce.ashfield@windriver.com>2017-11-15 15:53:38 -0500
commit3051160f23fe8e06e545859538c86ef3a3c39d7a (patch)
tree97f922e30173df31dda04f10cca3beea27652eb8
parent3d512115129e2cea97067d23cb72fea62b70dd39 (diff)
downloadmeta-cloud-services-3051160f23fe8e06e545859538c86ef3a3c39d7a.tar.gz
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 <mark.asselstine@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r--meta-openstack/classes/identity.bbclass11
-rw-r--r--meta-openstack/recipes-devtools/python/python-barbican_git.bb8
-rw-r--r--meta-openstack/recipes-devtools/python/python-ceilometer_git.bb24
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder_git.bb48
-rw-r--r--meta-openstack/recipes-devtools/python/python-glance_git.bb24
-rw-r--r--meta-openstack/recipes-devtools/python/python-heat_git.bb24
-rw-r--r--meta-openstack/recipes-devtools/python/python-keystone_git.bb50
-rw-r--r--meta-openstack/recipes-devtools/python/python-neutron_git.bb32
-rw-r--r--meta-openstack/recipes-devtools/python/python-nova_git.bb42
-rw-r--r--meta-openstack/recipes-devtools/python/python-rally_git.bb28
-rw-r--r--meta-openstack/recipes-devtools/python/python-swift_git.bb40
-rwxr-xr-xmeta-openstack/recipes-devtools/python/python-trove_git.bb45
-rw-r--r--meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend14
13 files changed, 185 insertions, 205 deletions
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 () {
163 163
164 postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True) 164 postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)
165 if not postinst: 165 if not postinst:
166 postinst = ' if [ "x$D" != "x" ]; then\n' + \ 166 postinst = ''
167 ' exit 1\n' + \ 167
168 ' fi\n' 168 # Only execute on target. Header.
169 postinst += ' if [ -z "$D" ]; then\n'
170
169 postinst += servicecreate_postinst_common_copy 171 postinst += servicecreate_postinst_common_copy
170 172
171 if d.getVar('USERCREATE_PARAM_%s' % pkg, True): 173 if d.getVar('USERCREATE_PARAM_%s' % pkg, True):
@@ -176,6 +178,9 @@ python populate_packages_append () {
176 servicecreate_postinst_service = servicecreate_postinst_service_copy.replace("SERVICECREATE_PARAM", servicecreate_param(d, pkg)) 178 servicecreate_postinst_service = servicecreate_postinst_service_copy.replace("SERVICECREATE_PARAM", servicecreate_param(d, pkg))
177 postinst += servicecreate_postinst_service 179 postinst += servicecreate_postinst_service
178 180
181 # Footer.
182 postinst += ' fi\n'
183
179 d.setVar('pkg_postinst_%s' % pkg, postinst) 184 d.setVar('pkg_postinst_%s' % pkg, postinst)
180 bb.debug(1, 'pkg_postinst_%s = %s' % (pkg, d.getVar('pkg_postinst_%s' % pkg, True))) 185 bb.debug(1, 'pkg_postinst_%s = %s' % (pkg, d.getVar('pkg_postinst_%s' % pkg, True)))
181} 186}
diff --git a/meta-openstack/recipes-devtools/python/python-barbican_git.bb b/meta-openstack/recipes-devtools/python/python-barbican_git.bb
index 0b3d768..579413c 100644
--- a/meta-openstack/recipes-devtools/python/python-barbican_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-barbican_git.bb
@@ -85,12 +85,10 @@ FILES_${SRCNAME} = "${sysconfdir}/${SRCNAME}/* \
85 85
86ALLOW_EMPTY_${SRCNAME}-setup = "1" 86ALLOW_EMPTY_${SRCNAME}-setup = "1"
87pkg_postinst_${SRCNAME}-setup () { 87pkg_postinst_${SRCNAME}-setup () {
88 if [ "x$D" != "x" ]; then 88 if [ -z "$D" ]; then
89 exit 1 89 chown -R barbican:barbican ${sysconfdir}/${SRCNAME}
90 chown -R barbican:barbican ${localstatedir}/lib/barbican
90 fi 91 fi
91
92 chown -R barbican:barbican ${sysconfdir}/${SRCNAME}
93 chown -R barbican:barbican ${localstatedir}/lib/barbican
94} 92}
95 93
96DEPENDS += " \ 94DEPENDS += " \
diff --git a/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb b/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb
index 5645626..4b01022 100644
--- a/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb
@@ -108,20 +108,18 @@ do_install_append() {
108} 108}
109 109
110pkg_postinst_${SRCNAME}-setup () { 110pkg_postinst_${SRCNAME}-setup () {
111 if [ "x$D" != "x" ]; then 111 if [ -z "$D" ]; then
112 exit 1 112 # This is to make sure postgres is configured and running
113 if ! pidof postmaster > /dev/null; then
114 /etc/init.d/postgresql-init
115 /etc/init.d/postgresql start
116 sleep 2
117 fi
118
119 mkdir /var/log/ceilometer
120 sudo -u postgres createdb ceilometer
121 ceilometer-dbsync
113 fi 122 fi
114
115 # This is to make sure postgres is configured and running
116 if ! pidof postmaster > /dev/null; then
117 /etc/init.d/postgresql-init
118 /etc/init.d/postgresql start
119 sleep 2
120 fi
121
122 mkdir /var/log/ceilometer
123 sudo -u postgres createdb ceilometer
124 ceilometer-dbsync
125} 123}
126 124
127inherit setuptools identity hosts update-rc.d default_configs monitor 125inherit setuptools identity hosts update-rc.d default_configs monitor
diff --git a/meta-openstack/recipes-devtools/python/python-cinder_git.bb b/meta-openstack/recipes-devtools/python/python-cinder_git.bb
index e70a3aa..9f70beb 100644
--- a/meta-openstack/recipes-devtools/python/python-cinder_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-cinder_git.bb
@@ -124,31 +124,29 @@ do_install_append() {
124} 124}
125 125
126pkg_postinst_${SRCNAME}-setup () { 126pkg_postinst_${SRCNAME}-setup () {
127 if [ "x$D" != "x" ]; then 127 if [ -z "$D" ]; then
128 exit 1 128 # This is to make sure postgres is configured and running
129 fi 129 if ! pidof postmaster > /dev/null; then
130 130 /etc/init.d/postgresql-init
131 # This is to make sure postgres is configured and running 131 /etc/init.d/postgresql start
132 if ! pidof postmaster > /dev/null; then 132 fi
133 /etc/init.d/postgresql-init 133
134 /etc/init.d/postgresql start 134 if [ ! -d /var/log/cinder ]; then
135 fi 135 mkdir /var/log/cinder
136 136 fi
137 if [ ! -d /var/log/cinder ]; then 137
138 mkdir /var/log/cinder 138 sudo -u postgres createdb cinder
139 fi 139 cinder-manage db sync
140 140
141 sudo -u postgres createdb cinder 141 # Create Cinder nfs_share config file with default nfs server
142 cinder-manage db sync 142 if [ ! -f /etc/cinder/nfs_shares ]; then
143 143 /bin/bash /etc/cinder/drivers/nfs_setup.sh
144 # Create Cinder nfs_share config file with default nfs server 144 fi
145 if [ ! -f /etc/cinder/nfs_shares ]; then 145
146 /bin/bash /etc/cinder/drivers/nfs_setup.sh 146 # Create Cinder glusterfs_share config file with default glusterfs server
147 fi 147 if [ ! -f /etc/cinder/glusterfs_shares ] && [ -f /usr/sbin/glusterfsd ]; then
148 148 /bin/bash /etc/cinder/drivers/glusterfs_setup.sh
149 # Create Cinder glusterfs_share config file with default glusterfs server 149 fi
150 if [ ! -f /etc/cinder/glusterfs_shares ] && [ -f /usr/sbin/glusterfsd ]; then
151 /bin/bash /etc/cinder/drivers/glusterfs_setup.sh
152 fi 150 fi
153} 151}
154 152
diff --git a/meta-openstack/recipes-devtools/python/python-glance_git.bb b/meta-openstack/recipes-devtools/python/python-glance_git.bb
index 27c33b9..4042f1b 100644
--- a/meta-openstack/recipes-devtools/python/python-glance_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-glance_git.bb
@@ -122,20 +122,18 @@ do_install_append() {
122} 122}
123 123
124pkg_postinst_${SRCNAME}-setup () { 124pkg_postinst_${SRCNAME}-setup () {
125 if [ "x$D" != "x" ]; then 125 if [ -z "$D" ]; then
126 exit 1 126 # This is to make sure postgres is configured and running
127 if ! pidof postmaster > /dev/null; then
128 /etc/init.d/postgresql-init
129 /etc/init.d/postgresql start
130 sleep 5
131 fi
132
133 mkdir /var/log/glance
134 sudo -u postgres createdb glance
135 glance-manage db_sync
127 fi 136 fi
128
129 # This is to make sure postgres is configured and running
130 if ! pidof postmaster > /dev/null; then
131 /etc/init.d/postgresql-init
132 /etc/init.d/postgresql start
133 sleep 5
134 fi
135
136 mkdir /var/log/glance
137 sudo -u postgres createdb glance
138 glance-manage db_sync
139} 137}
140 138
141PACKAGES += " ${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-api ${SRCNAME}-registry" 139PACKAGES += " ${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-api ${SRCNAME}-registry"
diff --git a/meta-openstack/recipes-devtools/python/python-heat_git.bb b/meta-openstack/recipes-devtools/python/python-heat_git.bb
index cccaf0a..2cf7ce4 100644
--- a/meta-openstack/recipes-devtools/python/python-heat_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-heat_git.bb
@@ -107,20 +107,18 @@ do_install_append() {
107} 107}
108 108
109pkg_postinst_${SRCNAME}-setup () { 109pkg_postinst_${SRCNAME}-setup () {
110 if [ "x$D" != "x" ]; then 110 if [ -z "$D" ]; then
111 exit 1 111 # This is to make sure postgres is configured and running
112 if ! pidof postmaster > /dev/null; then
113 /etc/init.d/postgresql-init
114 /etc/init.d/postgresql start
115 sleep 2
116 fi
117
118 mkdir /var/log/heat
119 sudo -u postgres createdb heat
120 heat-manage db_sync
112 fi 121 fi
113
114 # This is to make sure postgres is configured and running
115 if ! pidof postmaster > /dev/null; then
116 /etc/init.d/postgresql-init
117 /etc/init.d/postgresql start
118 sleep 2
119 fi
120
121 mkdir /var/log/heat
122 sudo -u postgres createdb heat
123 heat-manage db_sync
124} 122}
125 123
126inherit setuptools identity hosts update-rc.d default_configs monitor 124inherit setuptools identity hosts update-rc.d default_configs monitor
diff --git a/meta-openstack/recipes-devtools/python/python-keystone_git.bb b/meta-openstack/recipes-devtools/python/python-keystone_git.bb
index 79bd0c8..a26c9bf 100644
--- a/meta-openstack/recipes-devtools/python/python-keystone_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-keystone_git.bb
@@ -189,28 +189,26 @@ role_tree_dn = ou=Roles,${LDAP_DN} \
189 189
190pkg_postinst_${SRCNAME}-setup () { 190pkg_postinst_${SRCNAME}-setup () {
191 # python-keystone postinst start 191 # python-keystone postinst start
192 if [ "x$D" != "x" ]; then 192 if [ -z "$D" ]; then
193 exit 1 193 # This is to make sure postgres is configured and running
194 fi 194 if ! pidof postmaster > /dev/null; then
195 195 /etc/init.d/postgresql-init
196 # This is to make sure postgres is configured and running 196 /etc/init.d/postgresql start
197 if ! pidof postmaster > /dev/null; then 197 sleep 2
198 /etc/init.d/postgresql-init 198 fi
199 /etc/init.d/postgresql start 199
200 sleep 2 200 # This is to make sure keystone is configured and running
201 fi 201 PIDFILE="/var/run/keystone-all.pid"
202 202 if [ -z `cat $PIDFILE 2>/dev/null` ]; then
203 # This is to make sure keystone is configured and running 203 sudo -u postgres createdb keystone
204 PIDFILE="/var/run/keystone-all.pid" 204 keystone-manage db_sync
205 if [ -z `cat $PIDFILE 2>/dev/null` ]; then 205 keystone-manage pki_setup --keystone-user=root --keystone-group=daemon
206 sudo -u postgres createdb keystone 206
207 keystone-manage db_sync 207 if ${@bb.utils.contains('DISTRO_FEATURES', 'OpenLDAP', 'true', 'false', d)}; then
208 keystone-manage pki_setup --keystone-user=root --keystone-group=daemon 208 /etc/init.d/openldap start
209 209 fi
210 if ${@bb.utils.contains('DISTRO_FEATURES', 'OpenLDAP', 'true', 'false', d)}; then 210 /etc/init.d/keystone start
211 /etc/init.d/openldap start 211 fi
212 fi
213 /etc/init.d/keystone start
214 fi 212 fi
215} 213}
216 214
@@ -219,9 +217,11 @@ pkg_postinst_${SRCNAME}-setup () {
219KEYSTONE_TOKEN_FLUSH_TIME ??= "0 0 */2 * *" 217KEYSTONE_TOKEN_FLUSH_TIME ??= "0 0 */2 * *"
220 218
221pkg_postinst_${SRCNAME}-cronjobs () { 219pkg_postinst_${SRCNAME}-cronjobs () {
222 # By default keystone expired tokens are not automatic removed out of the 220 if [ -z "$D" ]; then
223 # database. So we create a cronjob for cleaning these expired tokens. 221 # By default keystone expired tokens are not automatic removed out of the
224 echo "${KEYSTONE_TOKEN_FLUSH_TIME} root /usr/bin/keystone-manage token_flush" >> /etc/crontab 222 # database. So we create a cronjob for cleaning these expired tokens.
223 echo "${KEYSTONE_TOKEN_FLUSH_TIME} root /usr/bin/keystone-manage token_flush" >> /etc/crontab
224 fi
225} 225}
226 226
227PACKAGES += " ${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-cronjobs" 227PACKAGES += " ${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-cronjobs"
diff --git a/meta-openstack/recipes-devtools/python/python-neutron_git.bb b/meta-openstack/recipes-devtools/python/python-neutron_git.bb
index 51c2ac4..c837401 100644
--- a/meta-openstack/recipes-devtools/python/python-neutron_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-neutron_git.bb
@@ -138,29 +138,25 @@ do_install_append() {
138} 138}
139 139
140pkg_postinst_${SRCNAME}-setup () { 140pkg_postinst_${SRCNAME}-setup () {
141 if [ "x$D" != "x" ]; then 141 if [ -z "$D" ]; then
142 exit 1 142 # This is to make sure postgres is configured and running
143 if ! pidof postmaster > /dev/null; then
144 /etc/init.d/postgresql-init
145 /etc/init.d/postgresql start
146 sleep 2
147 fi
148
149 sudo -u postgres createdb neutron
150 sudo neutron-db-manage --config-file /etc/neutron/neutron.conf \
151 --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head
143 fi 152 fi
144
145 # This is to make sure postgres is configured and running
146 if ! pidof postmaster > /dev/null; then
147 /etc/init.d/postgresql-init
148 /etc/init.d/postgresql start
149 sleep 2
150 fi
151
152 sudo -u postgres createdb neutron
153 sudo neutron-db-manage --config-file /etc/neutron/neutron.conf \
154 --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head
155} 153}
156 154
157pkg_postinst_${SRCNAME}-plugin-openvswitch-setup () { 155pkg_postinst_${SRCNAME}-plugin-openvswitch-setup () {
158 if [ "x$D" != "x" ]; then 156 if [ -z "$D" ]; then
159 exit 1 157 /etc/init.d/openvswitch-switch start
158 ovs-vsctl --no-wait -- --may-exist add-br br-int
160 fi 159 fi
161
162 /etc/init.d/openvswitch-switch start
163 ovs-vsctl --no-wait -- --may-exist add-br br-int
164} 160}
165 161
166ALLOW_EMPTY_${SRCNAME}-setup = "1" 162ALLOW_EMPTY_${SRCNAME}-setup = "1"
diff --git a/meta-openstack/recipes-devtools/python/python-nova_git.bb b/meta-openstack/recipes-devtools/python/python-nova_git.bb
index f3a6b86..7b560a7 100644
--- a/meta-openstack/recipes-devtools/python/python-nova_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-nova_git.bb
@@ -160,33 +160,29 @@ do_install_append() {
160} 160}
161 161
162pkg_postinst_${SRCNAME}-setup () { 162pkg_postinst_${SRCNAME}-setup () {
163 if [ "x$D" != "x" ]; then 163 if [ -z "$D" ]; then
164 exit 1 164 # This is to make sure postgres is configured and running
165 if ! pidof postmaster > /dev/null; then
166 /etc/init.d/postgresql-init
167 /etc/init.d/postgresql start
168 sleep 5
169 fi
170
171 sudo -u postgres createdb nova
172 sleep 2
173 nova-manage db sync
165 fi 174 fi
166
167 # This is to make sure postgres is configured and running
168 if ! pidof postmaster > /dev/null; then
169 /etc/init.d/postgresql-init
170 /etc/init.d/postgresql start
171 sleep 5
172 fi
173
174 sudo -u postgres createdb nova
175 sleep 2
176 nova-manage db sync
177} 175}
178 176
179pkg_postinst_${SRCNAME}-common () { 177pkg_postinst_${SRCNAME}-common () {
180 if [ "x$D" != "x" ]; then 178 if [ -z "$D" ]; then
181 exit 1 179 if [ -d /home/root ]; then
182 fi 180 echo "source /etc/nova/openrc" >> /home/root/.bashrc
183 181 echo "source /etc/nova/openrc" >> /home/root/.profile
184 if [ -d /home/root ]; then 182 else
185 echo "source /etc/nova/openrc" >> /home/root/.bashrc 183 echo "source /etc/nova/openrc" >> /root/.bashrc
186 echo "source /etc/nova/openrc" >> /home/root/.profile 184 echo "source /etc/nova/openrc" >> /root/.profile
187 else 185 fi
188 echo "source /etc/nova/openrc" >> /root/.bashrc
189 echo "source /etc/nova/openrc" >> /root/.profile
190 fi 186 fi
191} 187}
192 188
diff --git a/meta-openstack/recipes-devtools/python/python-rally_git.bb b/meta-openstack/recipes-devtools/python/python-rally_git.bb
index d29e7cb..31d4242 100644
--- a/meta-openstack/recipes-devtools/python/python-rally_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-rally_git.bb
@@ -63,22 +63,20 @@ do_install_append() {
63} 63}
64 64
65pkg_postinst_${SRCNAME}-setup () { 65pkg_postinst_${SRCNAME}-setup () {
66 if [ "x$D" != "x" ]; then 66 if [ -z "$D" ]; then
67 exit 1 67 # This is to make sure postgres is configured and running
68 if ! pidof postmaster > /dev/null; then
69 /etc/init.d/postgresql-init
70 /etc/init.d/postgresql start
71 fi
72
73 if [ ! -d /var/log/rally ]; then
74 mkdir /var/log/rally
75 fi
76
77 sudo -u postgres createdb rally
78 rally-manage db recreate
68 fi 79 fi
69
70 # This is to make sure postgres is configured and running
71 if ! pidof postmaster > /dev/null; then
72 /etc/init.d/postgresql-init
73 /etc/init.d/postgresql start
74 fi
75
76 if [ ! -d /var/log/rally ]; then
77 mkdir /var/log/rally
78 fi
79
80 sudo -u postgres createdb rally
81 rally-manage db recreate
82} 80}
83 81
84PACKAGES += "${SRCNAME}-tests ${SRCNAME}-api ${SRCNAME} ${SRCNAME}-setup" 82PACKAGES += "${SRCNAME}-tests ${SRCNAME}-api ${SRCNAME} ${SRCNAME}-setup"
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() {
109} 109}
110 110
111pkg_postinst_${SRCNAME}-setup () { 111pkg_postinst_${SRCNAME}-setup () {
112 if [ "x$D" != "x" ]; then 112 if [ -z "x$D" ]; then
113 exit 1 113 CLUSTER_CONF=/etc/swift/cluster.conf
114 SWIFT_SETUP='/bin/bash /etc/swift/swift_setup.sh'
115
116 for i in `seq 1 3`; do
117 BACKING_FILE=/etc/swift/swift_backing_$i
118 if [ "x${SWIFT_BACKING_FILE_SIZE}" != "x0G" ]; then
119 truncate -s ${SWIFT_BACKING_FILE_SIZE} $BACKING_FILE
120 sed "s:%SWIFT_BACKING_FILE_${i}%:$BACKING_FILE:g" -i $CLUSTER_CONF
121 else
122 sed "s:%SWIFT_BACKING_FILE_${i}%::g" -i $CLUSTER_CONF
123 fi
124 done
125
126 $SWIFT_SETUP createrings
127 $SWIFT_SETUP formatdevs
128 $SWIFT_SETUP mountdevs
129 $SWIFT_SETUP -i "${CONTROLLER_IP}" adddevs
130 $SWIFT_SETUP unmountdevs
114 fi 131 fi
115
116 CLUSTER_CONF=/etc/swift/cluster.conf
117 SWIFT_SETUP='/bin/bash /etc/swift/swift_setup.sh'
118
119 for i in `seq 1 3`; do
120 BACKING_FILE=/etc/swift/swift_backing_$i
121 if [ "x${SWIFT_BACKING_FILE_SIZE}" != "x0G" ]; then
122 truncate -s ${SWIFT_BACKING_FILE_SIZE} $BACKING_FILE
123 sed "s:%SWIFT_BACKING_FILE_${i}%:$BACKING_FILE:g" -i $CLUSTER_CONF
124 else
125 sed "s:%SWIFT_BACKING_FILE_${i}%::g" -i $CLUSTER_CONF
126 fi
127 done
128
129 $SWIFT_SETUP createrings
130 $SWIFT_SETUP formatdevs
131 $SWIFT_SETUP mountdevs
132 $SWIFT_SETUP -i "${CONTROLLER_IP}" adddevs
133 $SWIFT_SETUP unmountdevs
134} 132}
135 133
136PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup" 134PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup"
diff --git a/meta-openstack/recipes-devtools/python/python-trove_git.bb b/meta-openstack/recipes-devtools/python/python-trove_git.bb
index 830da92..b90e552 100755
--- a/meta-openstack/recipes-devtools/python/python-trove_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-trove_git.bb
@@ -146,30 +146,29 @@ do_install_append() {
146 146
147pkg_postinst_${SRCNAME}-setup () { 147pkg_postinst_${SRCNAME}-setup () {
148 # python-trove-setup postinst start 148 # python-trove-setup postinst start
149 if [ "x$D" != "x" ]; then 149 if [ -z "$D" ]; then
150 exit 1 150 source /etc/nova/openrc
151
152 # This is to make sure postgres is configured and running
153 if ! pidof postmaster > /dev/null; then
154 /etc/init.d/postgresql-init
155 /etc/init.d/postgresql start
156 sleep 5
157 fi
158
159 mkdir /var/log/trove
160 # Create database for trove.
161 sudo -u postgres createdb trove
162
163 # Create default trove database.
164 trove-manage db_sync
165 # Create new datastore.
166 trove-manage datastore_update "postgresql" ""
167 # Set up new version
168 trove-manage datastore_version_update "postgresql" "9.1" "postgresql" 1 "postgresql-server-9.1" 1
169 # Set new default version.
170 trove-manage datastore_update "postgresql" "9.1"
151 fi 171 fi
152 source /etc/nova/openrc
153
154 # This is to make sure postgres is configured and running
155 if ! pidof postmaster > /dev/null; then
156 /etc/init.d/postgresql-init
157 /etc/init.d/postgresql start
158 sleep 5
159 fi
160
161 mkdir /var/log/trove
162 # Create database for trove.
163 sudo -u postgres createdb trove
164
165 # Create default trove database.
166 trove-manage db_sync
167 # Create new datastore.
168 trove-manage datastore_update "postgresql" ""
169 # Set up new version
170 trove-manage datastore_version_update "postgresql" "9.1" "postgresql" 1 "postgresql-server-9.1" 1
171 # Set new default version.
172 trove-manage datastore_update "postgresql" "9.1"
173} 172}
174 173
175 174
diff --git a/meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend b/meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend
index 22dae71..b26054e 100644
--- a/meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend
+++ b/meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend
@@ -41,14 +41,12 @@ ALLOW_EMPTY_${PN}-setup = "1"
41 41
42pkg_postinst_${PN}-setup () { 42pkg_postinst_${PN}-setup () {
43 # postgres 9.2.4 postinst 43 # postgres 9.2.4 postinst
44 if [ "x$D" != "x" ]; then 44 if [ -z "$D" ]; then
45 exit 1 45 /etc/init.d/postgresql-init
46 fi 46 if [ $? -ne 0 ]; then
47 47 echo "[ERROR] postgres: unable to create admin account"
48 /etc/init.d/postgresql-init 48 exit 1
49 if [ $? -ne 0 ]; then 49 fi
50 echo "[ERROR] postgres: unable to create admin account"
51 exit 1
52 fi 50 fi
53} 51}
54 52