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 (for peer relations)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Triaged
|
Low
|
Unassigned |
Bug Description
`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.
# a peer (!) relation is available
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.
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.
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
summary: |
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 + errors are raised in a unit log on commit (for peer relations) |
description: | updated |
description: | updated |
tags: | added: hook-tools jujuc relation-set |
Changed in juju: | |
status: | New → Triaged |
importance: | Undecided → Medium |
https:/ /github. com/dshcherb/ juju/commit/ af1be8f26d3d6c3 96b50562e274e17 e2dd02275d - a 2.7 branch. Manually tested but needs some unit tests.