On Ubuntu 18.04 `infra-node` units, the "nrpe-external-master-relation-joined" hook fails when attempting to install the relevant apt packages. The following is a sample of the `debug-log` output:
----
unit-infra-node-0: 20:50:53 ERROR unit.infra-node/0.juju-log nrpe-external-master:13: Hook error:
Traceback (most recent call last):
File "/var/lib/juju/agents/unit-infra-node-0/.venv/lib/python3.6/site-packages/charms/reactive/__init__.py", line 74, in main
bus.dispatch(restricted=restricted_mode)
File "/var/lib/juju/agents/unit-infra-node-0/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 390, in dispatch
_invoke(other_handlers)
File "/var/lib/juju/agents/unit-infra-node-0/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 359, in _invoke
handler.invoke()
File "/var/lib/juju/agents/unit-infra-node-0/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 181, in invoke
self._action(*args)
File "/var/lib/juju/agents/unit-infra-node-0/charm/reactive/infra_node.py", line 18, in update_nrpe_config
fetch.apt_install(['python-dbus', 'libnagios-plugin-perl'], fatal=True)
File "/var/lib/juju/agents/unit-infra-node-0/.venv/lib/python3.6/site-packages/charmhelpers/fetch/ubuntu.py", line 303, in apt_install
_run_apt_command(cmd, fatal, quiet=quiet)
File "/var/lib/juju/agents/unit-infra-node-0/.venv/lib/python3.6/site-packages/charmhelpers/fetch/ubuntu.py", line 807, in _run_apt_command
quiet=quiet)
File "/var/lib/juju/agents/unit-infra-node-0/.venv/lib/python3.6/site-packages/charmhelpers/fetch/ubuntu.py", line 781, in _run_with_retries
result = subprocess.check_call(cmd, env=env, **kwargs)
File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['apt-get', '--assume-yes', '--option=Dpkg::Options::=--force-confold', 'install', 'python-dbus', 'libnagios-plugin-perl']' returned non-zero exit status 100.
----
I have confirmed the issue by manually running the command:
$ apt-get --assume-yes --option=Dpkg::Options::=--force-confold install python-dbus libnagios-plugin-perl
[...]
Package libnagios-plugin-perl is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libnagios-plugin-perl' has no installation candidate
The installed Ubuntu version is as follows:
$ grep 'VERSION=' /etc/os-release
VERSION="18.04.5 LTS (Bionic Beaver)"
It appears the errant package has been renamed in Ubuntu repositories:
https://superuser.com/questions/1613764/is-there-any-ubuntu-package-can-replace-to-libnagios-plugin-perl-for-ubuntu18
As such, the workaround is manually running the command with the updated package name:
$ apt-get --assume-yes --option=Dpkg::Options::=--force-confold install python-dbus libmonitoring-plugin-perl
It does appear the code exists to check for the DISTRIB_VERSION from lsb_release, targeting bionic; however, this does not appear to work as expected.
This is infra-node rev 4 from latest/stable branch.