From 8e62403b6a71488a4aa7ad7573d95a0dfce10121 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 30 Oct 2023 12:48:19 -0400 Subject: [PATCH] Enable swift payload upgrades for wallaby+ Sync charm-helpers to pick up fix for openstack_upgrade_available that enables successful payload upgrades. This will need backporting to stable/wallaby. The openstacksdk version is pinned in test-requirements.txt to enabled py36 unit tests to run successfully. https://github.com/juju/charm-helpers/pull/870 Closes-Bug: #2040606 Change-Id: I41fbfc57fe7a623466ab2def77d6b401e0f46b06 --- charmhelpers/contrib/openstack/utils.py | 22 ++++------------------ test-requirements.txt | 4 ++++ 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/charmhelpers/contrib/openstack/utils.py b/charmhelpers/contrib/openstack/utils.py index 61e7c76..4c13dde 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 diff --git a/test-requirements.txt b/test-requirements.txt index cd25fb3..f9a7709 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -37,6 +37,10 @@ stevedore<1.31.0;python_version<'3.6' debtcollector<1.22.0;python_version<'3.6' oslo.utils<=3.41.0;python_version<'3.6' +# New openstacksdk versions depend on platformdirs>=3 which does not support +# python 3.6 +openstacksdk<1.6.0; python_version <= '3.6' + coverage>=4.5.2 pyudev # for ceph-* charm unit tests (need to fix the ceph-* charm unit tests/mocking) git+https://github.com/openstack-charmers/zaza.git@stable/xena#egg=zaza