Fix manager.py launch python version to match installed payload

The manager.py helper is launched with either py2 or py3 depending on
the version of the payload.  However, it was using openstack-origin
rather than actually picking up the actual version of the installed
software.  This patch ensures that the manager.py is run with the
python version of the installed payload, which resolves a bug when
upgrading to rocky (which is the py2 to py3 transition of the payload).

Also fixes an os.execl() bug which changed behaviour from python2 to
python3.

Change-Id: I17255b84ca067886f866a5f8311dcab57fba6f14
Closes-bug: #1818988
This commit is contained in:
Alex Kavanagh 2019-03-07 14:11:31 +00:00
parent d1e3a7845d
commit 627ab761dd
3 changed files with 4 additions and 5 deletions

View File

@ -53,7 +53,8 @@ def openstack_upgrade():
if (do_action_openstack_upgrade('keystone',
do_openstack_upgrade,
register_configs())):
os.execl('./hooks/config-changed-postupgrade', '')
os.execl('./hooks/config-changed-postupgrade',
'config-changed-postupgrade')
if __name__ == '__main__':
openstack_upgrade()

View File

@ -1117,9 +1117,7 @@ class ManagerServer():
def _launch_manager(self):
script = os.path.abspath(os.path.join(os.path.dirname(__file__),
'manager.py'))
release = CompareOpenStackReleases(
get_os_codename_install_source(config('openstack-origin'))
)
release = CompareOpenStackReleases(os_release('keystone'))
# need to set the environment variable PYTHONPATH to include the
# payload's directory for the manager.py to find the various keystone
# clients

View File

@ -56,7 +56,7 @@ class TestKeystoneUpgradeActions(CharmTestCase):
self.assertTrue(self.do_openstack_upgrade.called)
self.os.execl.assert_called_with('./hooks/config-changed-postupgrade',
'')
'config-changed-postupgrade')
@patch.object(openstack_upgrade, 'register_configs')
@patch('charmhelpers.contrib.openstack.utils.config')