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)

Bug #1865176 reported by Dmitrii Shcherbakov
6
This bug affects 1 person
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.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

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
Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

https://github.com/dshcherb/juju/commit/af1be8f26d3d6c396b50562e274e17e2dd02275d - a 2.7 branch. Manually tested but needs some unit tests.

Tim Penhey (thumper)
tags: added: hook-tools jujuc relation-set
Changed in juju:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Canonical Juju QA Bot (juju-qa-bot) wrote :

This bug has not been updated in 2 years, so we're marking it Low importance. If you believe this is incorrect, please update the importance.

Changed in juju:
importance: Medium → Low
tags: added: expirebugs-bot
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.