nagios-charmers team mailing list archive
-
nagios-charmers team
-
Mailing list archive
-
Message #00076
[Bug 1712977] Re: config-changed hook fails: nrpe_helpers.py:nagios_hostname in _metadata_unit with FileNotFoundError error for metadata.yaml of related unit on another host
no that code is from nagios charm not nrpe charm
full traceback is below
2017-09-01 01:47:50 INFO config-changed Traceback (most recent call last):
2017-09-01 01:47:50 INFO config-changed File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/config-changed", line 339, in <module>
2017-09-01 01:47:50 INFO config-changed update_config()
2017-09-01 01:47:50 INFO config-changed File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/config-changed", line 231, in update_config
2017-09-01 01:47:50 INFO config-changed for relunit in self[self.name]:
2017-09-01 01:47:50 INFO config-changed NameError: global name 'self' is not defined
2017-09-01 01:47:50 ERROR juju.worker.uniter.operation runhook.go:107 hook "config-changed" failed: exit status 1
2017-09-01 01:47:56 WARNING juju-log Please use the generic juju-info or the monitors interface
2017-09-01 01:47:56 DEBUG juju-log Writing file /etc/nagios3/conf.d/extra.cfg root:root 444
2017-09-01 01:47:56 INFO config-changed Traceback (most recent call last):
2017-09-01 01:47:56 INFO config-changed File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/config-changed", line 339, in <module>
2017-09-01 01:47:56 INFO config-changed update_config()
2017-09-01 01:47:56 INFO config-changed File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/config-changed", line 231, in update_config
2017-09-01 01:47:56 INFO config-changed for relunit in self[self.name]:
2017-09-01 01:47:56 INFO config-changed NameError: global name 'self' is not defined
2017-09-01 01:47:56 ERROR juju.worker.uniter.operation runhook.go:107 hook "config-changed" failed: exit status 1
2017-09-01 01:48:07 WARNING juju-log Please use the generic juju-info or the monitors interface
2017-09-01 01:48:07 DEBUG juju-log Writing file /etc/nagios3/conf.d/extra.cfg root:root 444
2017-09-01 01:48:07 INFO config-changed Traceback (most recent call last):
2017-09-01 01:48:07 INFO config-changed File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/config-changed", line 339, in <module>
2017-09-01 01:48:07 INFO config-changed update_config()
2017-09-01 01:48:07 INFO config-changed File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/config-changed", line 231, in update_config
2017-09-01 01:48:07 INFO config-changed for relunit in self[self.name]:
2017-09-01 01:48:07 INFO config-changed NameError: global name 'self' is not defined
2017-09-01 01:48:07 ERROR juju.worker.uniter.operation runhook.go:107 hook "config-changed" failed: exit status 1
2017-09-01 01:48:28 WARNING juju-log Please use the generic juju-info or the monitors interface
2017-09-01 01:48:28 DEBUG juju-log Writing file /etc/nagios3/conf.d/extra.cfg root:root 444
2017-09-01 01:48:28 INFO config-changed Traceback (most recent call last):
2017-09-01 01:48:28 INFO config-changed File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/config-changed", line 339, in <module>
2017-09-01 01:48:28 INFO config-changed update_config()
2017-09-01 01:48:28 INFO config-changed File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/config-changed", line 231, in update_config
2017-09-01 01:48:28 INFO config-changed for relunit in self[self.name]:
2017-09-01 01:48:28 INFO config-changed NameError: global name 'self' is not defined
2017-09-01 01:48:29 ERROR juju.worker.uniter.operation runhook.go:107 hook "config-changed" failed: exit status 1
2017-09-01 01:49:09 WARNING juju-log Please use the generic juju-info or the monitors interface
2017-09-01 01:49:09 DEBUG juju-log Writing file /etc/nagios3/conf.d/extra.cfg root:root 444
2017-09-01 01:49:09 INFO config-changed Traceback (most recent call last):
2017-09-01 01:49:09 INFO config-changed File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/config-changed", line 339, in <module>
2017-09-01 01:49:09 INFO config-changed update_config()
2017-09-01 01:49:09 INFO config-changed File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/config-changed", line 231, in update_config
2017-09-01 01:49:09 INFO config-changed for relunit in self[self.name]:
2017-09-01 01:49:09 INFO config-changed NameError: global name 'self' is not defined
2017-09-01 01:49:09 ERROR juju.worker.uniter.operation runhook.go:107 hook "config-changed" failed: exit status 1
2017-09-01 01:50:28 WARNING juju-log Please use the generic juju-info or the monitors interface
2017-09-01 01:50:28 DEBUG juju-log Writing file /etc/nagios3/conf.d/extra.cfg root:root 444
2017-09-01 01:50:29 INFO config-changed Traceback (most recent call last):
2017-09-01 01:50:29 INFO config-changed File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/config-changed", line 339, in <module>
2017-09-01 01:50:29 INFO config-changed update_config()
2017-09-01 01:50:29 INFO config-changed File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/config-changed", line 231, in update_config
2017-09-01 01:50:29 INFO config-changed for relunit in self[self.name]:
2017-09-01 01:50:29 INFO config-changed NameError: global name 'self' is not defined
2017-09-01 01:50:29 ERROR juju.worker.uniter.operation runhook.go:107 hook "config-changed" failed: exit status 1
--
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:
Fix Released
Status in Nagios Charm:
Fix Released
Status in NRPE Charm:
Fix Released
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
Follow ups