Install resource-agents-extra on jammy.

The install hooks rsync a set of scripts and one of the destinations
is /usr/lib/stonith/plugins/external, this directory is created by the
installation of the package cluster-glue which is a pulled as an
indirect dependency of pacemaker, this changed on >=jammy where an
intermediate package named resource-agents was split into
resource-agents-base and resource-agents-extra wher the latter doesn't
get installed and it's the one that depends on cluster-glue.

The specific chain of dependencies are:

focal:
pacemaker -> pacemaker-resource-agents -> resource-agents -> cluster-glue

jammy
pacemaker -> pacemaker-resource-agents -> resource-agents-base

Change-Id: Ia00061bff2ebe16d35d52b256c61243935edabba
Closes-Bug: #1971841
This commit is contained in:
Felipe Reyes 2022-05-06 09:55:15 -04:00
parent 715d31e09f
commit 32ab2d4bda
2 changed files with 13 additions and 2 deletions

View File

@ -167,7 +167,11 @@ def install():
# NOTE(dosaboy): we currently disallow upgrades due to bug #1382842. This
# should be removed once the pacemaker package is fixed.
status_set('maintenance', 'Installing apt packages')
apt_install(filter_installed_packages(PACKAGES), fatal=True)
if CompareHostReleases(get_distrib_codename()) >= 'jammy':
pkgs = PACKAGES + ['resource-agents-extra']
else:
pkgs = PACKAGES
apt_install(filter_installed_packages(pkgs), fatal=True)
setup_ocf_files()

View File

@ -379,6 +379,7 @@ class TestHooks(test_utils.CharmTestCase):
super(TestHooks, self).setUp(hooks, self.TO_PATCH)
self.config.side_effect = self.test_config.get
@mock.patch.object(hooks, 'get_distrib_codename')
@mock.patch.object(hooks, 'emit_corosync_conf')
@mock.patch.object(hooks.os, 'mkdir')
@mock.patch.object(hooks, 'filter_installed_packages')
@ -386,7 +387,9 @@ class TestHooks(test_utils.CharmTestCase):
@mock.patch.object(hooks, 'apt_install')
@mock.patch.object(hooks, 'status_set')
def test_install(self, status_set, apt_install, setup_ocf_files,
filter_installed_packages, mkdir, emit_corosync_conf):
filter_installed_packages, mkdir, emit_corosync_conf,
get_distrib_codename):
get_distrib_codename.return_value = 'focal'
filter_installed_packages.side_effect = lambda x: x
expected_pkgs = [
'crmsh', 'corosync', 'pacemaker', 'python3-netaddr', 'ipmitool',
@ -403,6 +406,8 @@ class TestHooks(test_utils.CharmTestCase):
setup_ocf_files.assert_called_once_with()
mkdir.reset_mock()
apt_install.reset_mock()
get_distrib_codename.return_value = 'jammy'
def raise_():
raise FileExistsError()
@ -410,6 +415,8 @@ class TestHooks(test_utils.CharmTestCase):
mkdir.side_effect = lambda p, mode: raise_()
hooks.install()
mkdir.assert_called_once_with('/etc/corosync', mode=0o755)
apt_install.assert_called_once_with(
expected_pkgs + ['resource-agents-extra'], fatal=True)
@mock.patch('pcmk.set_property')
@mock.patch.object(hooks, 'is_stonith_configured')