** Tags added: canonical-bootstack ** Also affects: nagios-charm Importance: Undecided Status: New
-- You received this bug notification because you are a member of Nagios Charm developers, which is subscribed to Nagios Charm. https://bugs.launchpad.net/bugs/1712977 Title: config-changed hook fails: nrpe_helpers.py:nagios_hostname in _metadata_unit with FileNotFoundError error for metadata.yaml of related unit on another host Status in Charm Helpers: Confirmed Status in Nagios Charm: New Status in NRPE Charm: Confirmed Bug description: Due to recent changes, nrpe_helpers.py:nagios_hostname calls charmhelpers.core.hookenv.principal_unit to get the parent unit's hostname. On Juju 2.1 or earlier, it does this by walking all relations of the unit and inspecting it's metadata file using _metadata_unit. This fails because it attempts to inspect units on another host, i.e. the parent nagios unit and _metadata_unit fires a FileNotFoundError exception for the file that doesn't exist. You can simulate this on Juju 2.2 by commenting out the Juju 2.2 checks at the start and deploying the nagios and nrpe charms on separate machines. Traceback (most recent call last): File "/var/lib/juju/agents/unit-nrpe-0/charm/hooks/config-changed", line 3, in <module> services.manage() File "/var/lib/juju/agents/unit-nrpe-0/charm/hooks/services.py", line 27, in manage nrpe_helpers.NagiosInfo(), File "/var/lib/juju/agents/unit-nrpe-0/charm/hooks/nrpe_helpers.py", line 202, in __init__ self['nagios_hostname'] = self.principle_relation.nagios_hostname() File "/var/lib/juju/agents/unit-nrpe-0/charm/hooks/nrpe_helpers.py", line 163, in nagios_hostname principle_unitname = hookenv.principal_unit() File "/var/lib/juju/agents/unit-nrpe-0/charm/hooks/charmhelpers/core/hookenv.py", line 219, in principal_unit md = _metadata_unit(unit) File "/var/lib/juju/agents/unit-nrpe-0/charm/hooks/charmhelpers/core/hookenv.py", line 513, in _metadata_unit with open(os.path.join(basedir, unitdir, 'charm', 'metadata.yaml')) as md: FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/juju/agents/unit-nagios-0/charm/metadata.yaml' To manage notifications about this bug go to: https://bugs.launchpad.net/charm-helpers/+bug/1712977/+subscriptions -- Mailing list: https://launchpad.net/~nagios-charmers Post to : nagios-charmers@lists.launchpad.net Unsubscribe : https://launchpad.net/~nagios-charmers More help : https://help.launchpad.net/ListHelp