k8s charm fails to access peer relation in peer relation-joined hook

Bug #1818230 reported by Stuart Bishop on 2019-03-01
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju
High
Ian Booth

Bug Description

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.

Stuart Bishop (stub) wrote :

$ juju --version
2.5.2-bionic-amd64

Tim Penhey (thumper) on 2019-03-02
Changed in juju:
status: New → Triaged
importance: Undecided → High
milestone: none → 2.5.3
assignee: nobody → Ian Booth (wallyworld)
Changed in juju:
milestone: 2.5.3 → 2.5.4
Changed in juju:
milestone: 2.5.4 → 2.5.5
Changed in juju:
milestone: 2.5.6 → 2.5.8
Changed in juju:
milestone: 2.5.8 → 2.5.9
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers