<tl;dr> I really don't think this is a bug in the keystone charm.</tl;dr>
This bug can be reproduced a 100% of the time by joining keystone to lp:nrpe-charm
with juju 1. If "juju resolved --retry nrpe/0" is then run the hook again errors
but if a debug-hooks session is running on nrpe/0 and nrpe-external-master-relation-joined
is run by hand the hook completes succesfully.
The charm can also be fixed by updating charmhlpers in the nrpe charm with the following patch:
diff --git a/hooks/charmhelpers/core/hookenv.py b/hooks/charmhelpers/core/hookenv.py
index 899722f..1a1f1fc 100644
--- a/hooks/charmhelpers/core/hookenv.py
+++ b/hooks/charmhelpers/core/hookenv.py
@@ -516,7 +516,8 @@ def _metadata_unit(unit):
joineddir = os.path.join(basedir, unitdir, 'charm', 'metadata.yaml')
if not os.path.exists(joineddir):
return None
- with open(joineddir) as md:
+ with open(joineddir, 'r', encoding='utf-8') as md:
+ log('_metadata_unit: Loading {} '.format(joineddir))
return yaml.safe_load(md)
However it would need some testing, particularly where there are multiple subordinates connected to the same principle.
I am going to mark this as a bug against lp:nrpe-charm as that is where it is surfacing but
it might equally be a bug against juju 1.25.X or charm-helpers
<tl;dr> I really don't think this is a bug in the keystone charm.</tl;dr>
This bug can be reproduced a 100% of the time by joining keystone to lp:nrpe-charm master- relation- joined
with juju 1. If "juju resolved --retry nrpe/0" is then run the hook again errors
but if a debug-hooks session is running on nrpe/0 and nrpe-external-
is run by hand the hook completes succesfully.
The charm can also be fixed by updating charmhlpers in the nrpe charm with the following patch:
diff --git a/hooks/ charmhelpers/ core/hookenv. py b/hooks/ charmhelpers/ core/hookenv. py charmhelpers/ core/hookenv. py charmhelpers/ core/hookenv. py unit(unit) : join(basedir, unitdir, 'charm', 'metadata.yaml') exists( joineddir) : unit: Loading {} '.format( joineddir) )
index 899722f..1a1f1fc 100644
--- a/hooks/
+++ b/hooks/
@@ -516,7 +516,8 @@ def _metadata_
joineddir = os.path.
if not os.path.
return None
- with open(joineddir) as md:
+ with open(joineddir, 'r', encoding='utf-8') as md:
+ log('_metadata_
return yaml.safe_load(md)
However it would need some testing, particularly where there are multiple subordinates connected to the same principle.
I am going to mark this as a bug against lp:nrpe-charm as that is where it is surfacing but
it might equally be a bug against juju 1.25.X or charm-helpers