Make sure lockfile-progs package is installed

Also, drop python-dbus for simplicity since "check_upstart_job" in nrpe
is not enabled any longer. And the python-dbus package is no longer
available on jammy either.

    [on focal with systemd]
    $ ls -1 /etc/nagios/nrpe.d/
    check_ceph.cfg
    check_conntrack.cfg
    check_reboot.cfg
    check_systemd_scopes.cfg

Closes-Bug: #1998163
Change-Id: I30bc22ae8509367207004b90eb2c38ad0fae9ffe
This commit is contained in:
Nobuto Murata 2023-01-17 17:09:48 +09:00
parent af9143503c
commit df676a097f
2 changed files with 4 additions and 5 deletions

View File

@ -1104,8 +1104,7 @@ def upgrade_charm():
@hooks.hook('nrpe-external-master-relation-joined')
@hooks.hook('nrpe-external-master-relation-changed')
def update_nrpe_config():
# python-dbus is used by check_upstart_job
apt_install(['python-dbus', 'lockfile-progs'])
apt_install('lockfile-progs', fatal=True)
log('Refreshing nagios checks')
if os.path.isdir(NAGIOS_PLUGINS):
rsync(os.path.join(os.getenv('CHARM_DIR'), 'files', 'nagios',

View File

@ -206,8 +206,8 @@ class CephHooksTestCase(test_utils.CharmTestCase):
write_file=DEFAULT,
nrpe=DEFAULT) as mocks:
ceph_hooks.update_nrpe_config()
mocks["apt_install"].assert_called_once_with(
["python-dbus", "lockfile-progs"])
mocks["apt_install"].assert_called_with(
"lockfile-progs", fatal=True)
@patch.object(ceph_hooks, 'notify_prometheus')
@patch.object(ceph_hooks, 'notify_rbd_mirrors')
@ -239,7 +239,7 @@ class CephHooksTestCase(test_utils.CharmTestCase):
mocks["is_relation_made"].return_value = True
ceph_hooks.upgrade_charm()
mocks["apt_install"].assert_called_with(
["python-dbus", "lockfile-progs"])
"lockfile-progs", fatal=True)
mock_notify_radosgws.assert_called_once_with()
mock_ceph.update_monfs.assert_called_once_with()
mock_notify_prometheus.assert_called_once_with()