Comment 0 for bug 1865176

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote : relation-set --app -r <num> k=v does not return a non-zero exit code but errors are raised in a unit log on commit

`relation-set --app` does not fail for non-leader units in hook executions. The error is only surfaced after the charm process exits and the control is returned back to the unit agent.

juju run --unit nats/1 'relation-ids cluster'
cluster:0

# This should return a non-zero exit code:
juju run --unit nats/1 'relation-set -r 0 --app x=1 ; echo $?'
0

juju debug-log -i nats/1:

unit-nats-1: 16:53:35 ERROR juju.worker.uniter.context could not write settings from "juju-run" to relation 0: permission denied
unit-nats-1: 16:53:35 ERROR juju.worker.uniter resolver loop error: executing operation "run action 4": running action "juju-run": could not write settings from "juju-run" to relation 0: permission denied
unit-nats-1: 16:53:35 ERROR juju.worker.dependency "uniter" manifold worker returned unexpected error: executing operation "run action 4": running action "juju-run": could not write settings from "juju-run" to relation 0: permission denied

nats/1 is not a leader at the time of the call:

juju status
Model Controller Cloud/Region Version SLA Timestamp
default localhost-localhost localhost/localhost 2.7.2 unsupported 16:52:26+01:00

App Version Status Scale Charm Store Rev OS Notes
nats active 3 nats local 0 ubuntu

Unit Workload Agent Machine Public address Ports Message
nats/0* active idle 0 10.209.240.36
nats/1 active idle 1 10.209.240.214
nats/2 active idle 2 10.209.240.157

Machine State DNS Inst id Series AZ Message
0 started 10.209.240.36 juju-b48e3c-0 bionic Running
1 started 10.209.240.214 juju-b48e3c-1 bionic Running
2 started 10.209.240.157 juju-b48e3c-2 bionic Running