Sync charmhelpers

Prep for noble/caracal, unit test fix

Change-Id: I5ad6b618bb3a5660a61ac3c536430c8e380e655c
This commit is contained in:
Peter Sabaini 2024-04-09 09:51:10 +02:00
parent ae6ee7f590
commit bd57a326e9
7 changed files with 40 additions and 16 deletions

View File

@ -545,7 +545,7 @@ class IdentityServiceContext(OSContextGenerator):
'internal_auth_url': internal_auth_url,
})
# we keep all veriables in ctxt for compatibility and
# we keep all variables in ctxt for compatibility and
# add nested dictionary for keystone_authtoken generic
# templating
if keystonemiddleware_os_release:
@ -557,6 +557,7 @@ class IdentityServiceContext(OSContextGenerator):
# NOTE(jamespage) this is required for >= icehouse
# so a missing value just indicates keystone needs
# upgrading
ctxt['admin_user_id'] = _resolve('service_user_id')
ctxt['admin_tenant_id'] = _resolve('service_tenant_id')
ctxt['admin_domain_id'] = _resolve('service_domain_id')
return ctxt

View File

@ -161,6 +161,7 @@ OPENSTACK_CODENAMES = OrderedDict([
('2022.2', 'zed'),
('2023.1', 'antelope'),
('2023.2', 'bobcat'),
('2024.1', 'caracal'),
])
# The ugly duckling - must list releases oldest to newest

View File

@ -17,8 +17,6 @@ from subprocess import (
CalledProcessError,
check_call,
check_output,
Popen,
PIPE,
)
@ -58,9 +56,7 @@ def remove_lvm_physical_volume(block_device):
:param block_device: str: Full path of block device to scrub.
'''
p = Popen(['pvremove', '-ff', block_device],
stdin=PIPE)
p.communicate(input='y\n')
check_call(['pvremove', '-ff', '--yes', block_device])
def list_lvm_volume_group(block_device):

View File

@ -256,8 +256,11 @@ def service_resume(service_name, init_dir="/etc/init",
upstart_file = os.path.join(init_dir, "{}.conf".format(service_name))
sysv_file = os.path.join(initd_dir, service_name)
if init_is_systemd(service_name=service_name):
service('unmask', service_name)
service('enable', service_name)
if service('is-enabled', service_name):
log('service {} already enabled'.format(service_name), level=DEBUG)
else:
service('unmask', service_name)
service('enable', service_name)
elif os.path.exists(upstart_file):
override_path = os.path.join(
init_dir, '{}.override'.format(service_name))

View File

@ -246,6 +246,14 @@ CLOUD_ARCHIVE_POCKETS = {
'bobcat/proposed': 'jammy-proposed/bobcat',
'jammy-bobcat/proposed': 'jammy-proposed/bobcat',
'jammy-proposed/bobcat': 'jammy-proposed/bobcat',
# caracal
'caracal': 'jammy-updates/caracal',
'jammy-caracal': 'jammy-updates/caracal',
'jammy-caracal/updates': 'jammy-updates/caracal',
'jammy-updates/caracal': 'jammy-updates/caracal',
'caracal/proposed': 'jammy-proposed/caracal',
'jammy-caracal/proposed': 'jammy-proposed/caracal',
'jammy-proposed/caracal': 'jammy-proposed/caracal',
# OVN
'focal-ovn-22.03': 'focal-updates/ovn-22.03',
@ -279,6 +287,7 @@ OPENSTACK_RELEASES = (
'zed',
'antelope',
'bobcat',
'caracal',
)
@ -308,6 +317,7 @@ UBUNTU_OPENSTACK_RELEASE = OrderedDict([
('kinetic', 'zed'),
('lunar', 'antelope'),
('mantic', 'bobcat'),
('noble', 'caracal'),
])

View File

@ -9,19 +9,13 @@ def get_platform():
will be returned (which is the name of the module).
This string is used to decide which platform module should be imported.
"""
# linux_distribution is deprecated and will be removed in Python 3.7
# Warnings *not* disabled, as we certainly need to fix this.
if hasattr(platform, 'linux_distribution'):
tuple_platform = platform.linux_distribution()
current_platform = tuple_platform[0]
else:
current_platform = _get_platform_from_fs()
current_platform = _get_current_platform()
if "Ubuntu" in current_platform:
return "ubuntu"
elif "CentOS" in current_platform:
return "centos"
elif "debian" in current_platform:
elif "debian" in current_platform or "Debian" in current_platform:
# Stock Python does not detect Ubuntu and instead returns debian.
# Or at least it does in some build environments like Travis CI
return "ubuntu"
@ -36,6 +30,24 @@ def get_platform():
.format(current_platform))
def _get_current_platform():
"""Return the current platform information for the OS.
Attempts to lookup linux distribution information from the platform
module for releases of python < 3.7. For newer versions of python,
the platform is determined from the /etc/os-release file.
"""
# linux_distribution is deprecated and will be removed in Python 3.7
# Warnings *not* disabled, as we certainly need to fix this.
if hasattr(platform, 'linux_distribution'):
tuple_platform = platform.linux_distribution()
current_platform = tuple_platform[0]
else:
current_platform = _get_platform_from_fs()
return current_platform
def _get_platform_from_fs():
"""Get Platform from /etc/os-release."""
with open(os.path.join(os.sep, 'etc', 'os-release')) as fin:

View File

@ -43,6 +43,7 @@ CEPH_MONS = [
]
@patch.object(hooks, 'get_mon_hosts', new=MagicMock(return_value=['1.1.1.1']))
class ServiceStatusTestCase(test_utils.CharmTestCase):
def setUp(self):