Adding a second unit to a k8s charm deployment, my charm fails to run 'relation-get --format=json -' inside the peer relation-joined hook. The command returns a failure code, printing 'ERROR permission denied'.
application-pgk8s: 20:23:05 INFO unit.pgk8s/4.juju-log pgpeer:3: **** pgpeer-relation-joined DEBUG ****
application-pgk8s: 20:23:05 DEBUG unit.pgk8s/4.pgpeer-relation-joined ERROR permission denied
application-pgk8s: 20:23:05 ERROR unit.pgk8s/4.juju-log pgpeer:3: Hook error:
Traceback (most recent call last):
File "lib/charms/reactive/__init__.py", line 73, in main
bus.dispatch(restricted=restricted_mode)
File "lib/charms/reactive/bus.py", line 390, in dispatch
_invoke(other_handlers)
File "lib/charms/reactive/bus.py", line 359, in _invoke
handler.invoke()
File "lib/charms/reactive/bus.py", line 181, in invoke
self._action(*args)
File "/var/lib/juju/agents/unit-pgk8s-4/charm/reactive/pg.py", line 19, in debug
pprint(hookenv.execution_environment(), out)
File "lib/charmhelpers/core/hookenv.py", line 168, in execution_environment
context['rel'] = relation_get()
File "lib/charmhelpers/core/hookenv.py", line 82, in wrapper
res = func(*args, **kwargs)
File "lib/charmhelpers/core/hookenv.py", line 439, in relation_get
return json.loads(subprocess.check_output(_args).decode('UTF-8'))
File "/usr/lib/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/usr/lib/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['relation-get', '--format=json', '-']' returned non-zero exit status 1.
$ juju --version
2.5.2-bionic-amd64