diff --git a/hooks/charmhelpers/contrib/openstack/context.py b/hooks/charmhelpers/contrib/openstack/context.py index 42f15032..1e667fb0 100644 --- a/hooks/charmhelpers/contrib/openstack/context.py +++ b/hooks/charmhelpers/contrib/openstack/context.py @@ -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 diff --git a/hooks/charmhelpers/contrib/openstack/utils.py b/hooks/charmhelpers/contrib/openstack/utils.py index 429b09e5..da711c65 100644 --- a/hooks/charmhelpers/contrib/openstack/utils.py +++ b/hooks/charmhelpers/contrib/openstack/utils.py @@ -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 diff --git a/hooks/charmhelpers/contrib/storage/linux/lvm.py b/hooks/charmhelpers/contrib/storage/linux/lvm.py index d0a57211..0d294c79 100644 --- a/hooks/charmhelpers/contrib/storage/linux/lvm.py +++ b/hooks/charmhelpers/contrib/storage/linux/lvm.py @@ -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): diff --git a/hooks/charmhelpers/core/host.py b/hooks/charmhelpers/core/host.py index 70dde6a5..def403c5 100644 --- a/hooks/charmhelpers/core/host.py +++ b/hooks/charmhelpers/core/host.py @@ -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)) diff --git a/hooks/charmhelpers/fetch/ubuntu.py b/hooks/charmhelpers/fetch/ubuntu.py index 1be992c4..d0089eb7 100644 --- a/hooks/charmhelpers/fetch/ubuntu.py +++ b/hooks/charmhelpers/fetch/ubuntu.py @@ -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'), ]) diff --git a/hooks/charmhelpers/osplatform.py b/hooks/charmhelpers/osplatform.py index 1ace468f..5d121866 100644 --- a/hooks/charmhelpers/osplatform.py +++ b/hooks/charmhelpers/osplatform.py @@ -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: diff --git a/unit_tests/test_status.py b/unit_tests/test_status.py index 433f92e6..98a87a69 100644 --- a/unit_tests/test_status.py +++ b/unit_tests/test_status.py @@ -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):