On Mon, Aug 28, 2017 at 03:44:42PM -0300, Felipe Reyes wrote:
> On Mon, Aug 28, 2017 at 06:25:17PM -0000, Corey Bryant wrote:
> > Hi Felipe
> >
> > Historically we've configured OpenStack services to use sqlite at
> > install time, and it makes sense to run the db sync commands in that
> > case. However, I'm not sure why we also run the db sync commands if
> > connection isn't defined (! grep -qE "^(sql_)?connection( )?=.*"
> > /etc/nova/nova.conf).
> >
> > We do this in a number of packages so I want to figure out why we do
> > that. We do the same in cinder, panko, aodh, nova, manila, to name a
> > few.
> >
> > What we don't want to do is to run the db sync commands for non-sqlite
> > db's. If not using sqlite we leave it up to the user or config mgmt
> > tooling.
>
> gotcha, then that's what that negation is meant for, the regexp needs to be tweaked a little bit to match only when "connection is config is set, but it's value contains sqlite"
- if ! grep -qE "^(sql_)?connection( )?=.*" /etc/nova/nova.conf || \
- grep -qE "^(sql_)?connection.*sqlite.*" /etc/nova/nova.conf
+ if grep -qE "^(sql_)?connection.*sqlite.*" /etc/nova/nova.conf
then
su -s /bin/sh -c 'nova-manage db sync' nova
fi
On Mon, Aug 28, 2017 at 03:44:42PM -0300, Felipe Reyes wrote: )?connection( )?=.*" nova.conf) .
> On Mon, Aug 28, 2017 at 06:25:17PM -0000, Corey Bryant wrote:
> > Hi Felipe
> >
> > Historically we've configured OpenStack services to use sqlite at
> > install time, and it makes sense to run the db sync commands in that
> > case. However, I'm not sure why we also run the db sync commands if
> > connection isn't defined (! grep -qE "^(sql_
> > /etc/nova/
> >
> > We do this in a number of packages so I want to figure out why we do
> > that. We do the same in cinder, panko, aodh, nova, manila, to name a
> > few.
> >
> > What we don't want to do is to run the db sync commands for non-sqlite
> > db's. If not using sqlite we leave it up to the user or config mgmt
> > tooling.
>
> gotcha, then that's what that negation is meant for, the regexp needs to be tweaked a little bit to match only when "connection is config is set, but it's value contains sqlite"
Dropping the first grep:
--- /var/lib/ dpkg/info/ nova-common. postinst 2017-06-19 08:12:49.000000000 +0000 common. postinst 2017-08-28 18:51:01.367912483 +0000 rootwrap. d rootwrap. d
+++ ./nova-
@@ -47,8 +47,7 @@
chown root:root /etc/nova/
chmod 0755 /etc/nova/
- if ! grep -qE "^(sql_ )?connection( )?=.*" /etc/nova/nova.conf || \ )?connection. *sqlite. *" /etc/nova/nova.conf )?connection. *sqlite. *" /etc/nova/nova.conf
- grep -qE "^(sql_
+ if grep -qE "^(sql_
then
su -s /bin/sh -c 'nova-manage db sync' nova
fi
Connection NOT defined:
root@juju- 675da2- mno-17: ~# bash -ex ./nova- common. postinst 675da2- mno-17: ~# bash -ex ./nova- common. postinst configure api-paste. ini rootwrap. conf rootwrap. d rootwrap. d )?connection. *sqlite. *' /etc/nova/nova.conf nova/nova. sqlite ']' nova/nova. sqlite nova/nova. sqlite 675da2- mno-17: ~# grep connection /etc/nova/nova.conf
+ '[' '' = configure ']'
root@juju-
+ '[' configure = configure ']'
+ getent group nova
+ getent passwd nova
+ '[' -z '' ']'
+ chown -R nova:nova /var/lib/nova/
+ chown -R nova:nova /etc/nova
+ chown -R nova:adm /var/log/nova
+ '[' -z '' ']'
+ chown -R nova:nova /var/lib/nova/
+ chmod 0640 /etc/nova/nova.conf
+ chmod 0640 /etc/nova/
+ chmod 0750 /etc/nova
+ chmod 0750 /var/log/nova
+ chown root:root /etc/nova/
+ chown root:root /etc/nova/
+ chmod 0755 /etc/nova/
+ grep -qE '^(sql_
+ '[' -e /var/lib/
+ chown nova:nova /var/lib/
+ chmod 0640 /var/lib/
root@juju-
Connection defined:
root@juju- 675da2- mno-17: ~# bash -ex ./nova- common. postinst configure api-paste. ini rootwrap. conf rootwrap. d rootwrap. d )?connection. *sqlite. *' /etc/nova/nova.conf nova/nova. sqlite ']' nova/nova. sqlite nova/nova. sqlite 675da2- mno-17: ~# grep connection /etc/nova/nova.conf /nova:XXXXXXXX@ 10.5.1. 33/nova
+ '[' configure = configure ']'
+ getent group nova
+ getent passwd nova
+ '[' -z '' ']'
+ chown -R nova:nova /var/lib/nova/
+ chown -R nova:nova /etc/nova
+ chown -R nova:adm /var/log/nova
+ '[' -z '' ']'
+ chown -R nova:nova /var/lib/nova/
+ chmod 0640 /etc/nova/nova.conf
+ chmod 0640 /etc/nova/
+ chmod 0750 /etc/nova
+ chmod 0750 /var/log/nova
+ chown root:root /etc/nova/
+ chown root:root /etc/nova/
+ chmod 0755 /etc/nova/
+ grep -qE '^(sql_
+ '[' -e /var/lib/
+ chown nova:nova /var/lib/
+ chmod 0640 /var/lib/
root@juju-
connection = mysql:/