Use the version of neutron-common to determine the OpenStack version
There are transient situations where the config option openstack-origin will hold the target OpenStack version, so it's not safe to be used to determine what packages should be installed in the unit, an accurate method is to use the version of the neutron-common package. Change-Id: I88693be390f66ba94626e52b949b5573532ea5d7 Closes-Bug: #1854538
This commit is contained in:
parent
288ab3a68d
commit
518ae9a01b
@ -332,9 +332,8 @@ def common_upgrade_charm_and_config_changed():
|
||||
config('openstack-origin')
|
||||
)
|
||||
status_set('maintenance', 'Installing apt packages')
|
||||
apt_install(filter_installed_packages(
|
||||
determine_packages(config('openstack-origin'))),
|
||||
fatal=True)
|
||||
pkgs = determine_packages(openstack_release=os_release('neutron-server'))
|
||||
apt_install(filter_installed_packages(pkgs), fatal=True)
|
||||
packages_removed = remove_old_packages()
|
||||
configure_https()
|
||||
update_nrpe_config()
|
||||
|
@ -387,9 +387,13 @@ def manage_plugin():
|
||||
return config('manage-neutron-plugin-legacy-mode')
|
||||
|
||||
|
||||
def determine_packages(source=None):
|
||||
def determine_packages(source=None, openstack_release=None):
|
||||
# currently all packages match service names
|
||||
release = get_os_codename_install_source(source)
|
||||
if openstack_release:
|
||||
release = openstack_release
|
||||
else:
|
||||
release = get_os_codename_install_source(source)
|
||||
|
||||
cmp_release = CompareOpenStackReleases(release)
|
||||
packages = deepcopy(BASE_PACKAGES)
|
||||
if cmp_release >= 'rocky':
|
||||
|
@ -156,6 +156,23 @@ class TestNeutronAPIUtils(CharmTestCase):
|
||||
expect.remove('python3-neutron-lbaas')
|
||||
self.assertEqual(sorted(pkg_list), sorted(expect))
|
||||
|
||||
def test_determine_packages_train_by_explicit_release(self):
|
||||
self.os_release.return_value = 'train'
|
||||
self.get_os_codename_install_source.return_value = 'train'
|
||||
pkg_list = nutils.determine_packages(openstack_release='train')
|
||||
expect = deepcopy(nutils.BASE_PACKAGES)
|
||||
expect.extend([
|
||||
'memcached',
|
||||
'neutron-server',
|
||||
'neutron-plugin-ml2',
|
||||
'python-networking-hyperv'
|
||||
])
|
||||
expect.extend(nutils.KILO_PACKAGES)
|
||||
expect = [p for p in expect if not p.startswith('python-')]
|
||||
expect.extend(nutils.PY3_PACKAGES)
|
||||
expect.remove('python3-neutron-lbaas')
|
||||
self.assertEqual(sorted(pkg_list), sorted(expect))
|
||||
|
||||
@patch.object(nutils.neutron_api_context, 'NeutronApiSDNContext')
|
||||
def test_determine_packages_noplugin(self, _NeutronApiSDNContext):
|
||||
self.os_release.return_value = 'havana'
|
||||
|
Loading…
Reference in New Issue
Block a user