Skip to content

Commit

Permalink
Enable swift payload upgrades for wallaby+
Browse files Browse the repository at this point in the history
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.

juju/charm-helpers#870
Closes-Bug: #2040606
Change-Id: I41fbfc57fe7a623466ab2def77d6b401e0f46b06
  • Loading branch information
Corey Bryant committed Oct 31, 2023
1 parent 7ac4906 commit 8e62403
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
22 changes: 4 additions & 18 deletions charmhelpers/contrib/openstack/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8e62403

Please sign in to comment.