undercloud/upgrade: change ownership for ironic-dbsync.log

A change was done in puppet-ironic:
https://review.openstack.org/#/c/457478/

It broke TripleO upgrades because ironic-dbsync.log used to be owned by
root:root and now it's managed by ironic user in puppet-ironic, which is
good.

Because we want to support existing deployments, we need a way to handle
the new owership change, so let's do it in a upgrade task in
undercloud.py. Puppet will be able to run ironic-dbsync and we'll remove
this workaround after Pike release.

Change-Id: I325c30f49b765ef6413743491902e97735877321
(cherry picked from commit 4077ec823c)
This commit is contained in:
Emilien Macchi
2017-04-25 17:30:29 -04:00
parent 6790ae8b3d
commit bf9620651a
2 changed files with 21 additions and 4 deletions

View File

@@ -1432,13 +1432,21 @@ def install(instack_root, upgrade=False):
_validate_configuration()
instack_env = _generate_environment(instack_root)
_generate_init_data(instack_env)
# We didn't complete the M->N upgrades correctly with a
# `nova-manage db online_data_migrations` command before. This could
# cause the post-upgrade db sync to fail. Better be safe than sorry and
# run it before package upgrade.
if upgrade:
# We didn't complete the M->N upgrades correctly with a
# `nova-manage db online_data_migrations` command before. This
# could cause the post-upgrade db sync to fail. Better be safe
# than sorry and run it before package upgrade.
_run_command(['sudo', '/usr/bin/nova-manage', 'db',
'online_data_migrations'])
# Even if we backport https://review.openstack.org/#/c/457478/
# into stable branches of puppet-ironic, we still need a way
# to handle existing deployments.
# This task will fix ironic-dbsync.log ownership on existing
# deployments during an upgrade. It can be removed after we
# release Pike.
_run_command(['sudo', '/usr/bin/chown', 'ironic:ironic',
'/var/log/ironic/ironic-dbsync.log'])
if CONF.undercloud_update_packages:
_run_yum_clean_all(instack_env)
_run_yum_update(instack_env)

View File

@@ -0,0 +1,9 @@
---
upgrade:
- |
Undercloud upgrade will handle the change of ownership for ironic-dbsync.log
to become ironic:ironic instead of root:root.
Indeed, https://review.openstack.org/#/c/457478/ broke TripleO upgrades but
it's to fix a valid issue in the puppet-ironic module. We still want to handle
upgrades for existing deployments, that's why we manage the ownership change
in instack-undercloud.