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/871
Closes-Bug: #2040606
Change-Id: I1c6a8adaf61f927239aeecbcd7cde28e47885b20
This commit is contained in:
Corey Bryant 2023-10-30 12:49:48 -04:00
parent df69671544
commit c52f683973
2 changed files with 8 additions and 18 deletions

View File

@ -409,16 +409,6 @@ def get_os_version_codename(codename, version_map=OPENSTACK_CODENAMES):
error_out(e) 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): def get_swift_codename(version):
'''Determine OpenStack codename that corresponds to swift version.''' '''Determine OpenStack codename that corresponds to swift version.'''
codenames = [k for k, v in six.iteritems(SWIFT_CODENAMES) if version in v] 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: if not cur_vers:
# The package has not been installed yet do not attempt upgrade # The package has not been installed yet do not attempt upgrade
return False return False
if "swift" in package: try:
codename = get_os_codename_install_source(src) avail_vers = get_os_version_install_source(src)
avail_vers = get_os_version_codename_swift(codename) except Exception:
else: avail_vers = cur_vers
try:
avail_vers = get_os_version_install_source(src)
except Exception:
avail_vers = cur_vers
apt.init() apt.init()
return apt.version_compare(avail_vers, cur_vers) >= 1 return apt.version_compare(avail_vers, cur_vers) >= 1

View File

@ -37,6 +37,10 @@ stevedore<1.31.0;python_version<'3.6'
debtcollector<1.22.0;python_version<'3.6' debtcollector<1.22.0;python_version<'3.6'
oslo.utils<=3.41.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 coverage>=4.5.2
pyudev # for ceph-* charm unit tests (need to fix the ceph-* charm unit tests/mocking) pyudev # for ceph-* charm unit tests (need to fix the ceph-* charm unit tests/mocking)
git+https://github.com/openstack-charmers/zaza.git@stable/wallaby#egg=zaza git+https://github.com/openstack-charmers/zaza.git@stable/wallaby#egg=zaza