From eb0931591c392dcb70115de1732522bcd6d3e7a0 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 25 Oct 2023 14:19:39 -0400 Subject: [PATCH] Drop use of get_os_version_codename_swift Swift payload upgrades to wallaby or later currently fail because this code is unable to determine the version for wallaby+. For example: FATAL ERROR: Could not derive swift version for codename: wallaby We stopped maintaining the SWIFT_CODENAMES and PACKAGE_CODENAMES as of wallaby because the openstack-release package was introduced in wallaby. We could update the SWIFT_CODENAMES map, but really this map no longer needs to be used. There was a time when the same swift package version existed in two different OpenStack releases, but that is no longer the case [1]. Therefore we can use the same comparison used for OpenStack packages which essentially checks current release (based on the openstack-release package) vs the installation source release. [1] Current swift versions in Ubuntu are: 2.32.0 bobcat 2.31.1 antelope 2.30.1 zed 2.29.2 yoga 2.28.1 xena 2.27.0 wallaby 2.26.0 victoria 2.25.2 ussuri Closes-Bug: #2040606 (cherry picked from commit b604d56223772c36f934c199abb849d5d020fdc8) --- charmhelpers/contrib/openstack/utils.py | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/charmhelpers/contrib/openstack/utils.py b/charmhelpers/contrib/openstack/utils.py index 61e7c7653..4c13dde4e 100644 --- a/charmhelpers/contrib/openstack/utils.py +++ b/charmhelpers/contrib/openstack/utils.py @@ -409,16 +409,6 @@ def get_os_version_codename(codename, version_map=OPENSTACK_CODENAMES): error_out(e) -def get_os_version_codename_swift(codename): - '''Determine OpenStack version number of swift from codename.''' - for k, v in six.iteritems(SWIFT_CODENAMES): - if k == codename: - return v[-1] - e = 'Could not derive swift version for '\ - 'codename: %s' % codename - error_out(e) - - def get_swift_codename(version): '''Determine OpenStack codename that corresponds to swift version.''' codenames = [k for k, v in six.iteritems(SWIFT_CODENAMES) if version in v] @@ -843,14 +833,10 @@ def openstack_upgrade_available(package): if not cur_vers: # The package has not been installed yet do not attempt upgrade return False - if "swift" in package: - codename = get_os_codename_install_source(src) - avail_vers = get_os_version_codename_swift(codename) - else: - try: - avail_vers = get_os_version_install_source(src) - except Exception: - avail_vers = cur_vers + try: + avail_vers = get_os_version_install_source(src) + except Exception: + avail_vers = cur_vers apt.init() return apt.version_compare(avail_vers, cur_vers) >= 1