`juju run-action --wait` returns 0 even when action status=failed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Triaged
|
Low
|
Unassigned |
Bug Description
$ juju version
2.3.8-xenial-amd64
Expected result is non-zero status code when an action failed since "--wait" is supposed to be sync command instead of async without --wait.
How to reproduce:
$ juju deploy --series xenial ceilometer
$ juju run-action --wait ceilometer/0 ceilometer-upgrade --debug
15:11:45 INFO juju.cmd supercommand.go:56 running juju [2.3.8 gc go1.10]
15:11:45 DEBUG juju.cmd supercommand.go:57 args: []string{
15:11:45 INFO juju.juju api.go:67 connecting to API addresses: [192.168.
15:11:45 DEBUG juju.api apiclient.go:843 successfully dialed "wss://
15:11:45 INFO juju.api apiclient.go:597 connection established to "wss://
unit-ceilometer-0:
id: e75efec6-
message: The identity-service and or metric-service relations are not complete.
ceilometer-
status: failed <<<<<<
timing:
completed: 2018-06-05 15:21:42 +0000 UTC
enqueued: 2018-06-05 15:11:45 +0000 UTC
started: 2018-06-05 15:21:36 +0000 UTC
unit: ceilometer/0
15:21:43 DEBUG juju.api monitor.go:35 RPC connection died
15:21:43 INFO cmd supercommand.go:465 command finished
$ echo $?
0
^^^ zero even with status=failed
I can certainly understand how this would be desirable. I think currently the exit code is only tied to whether we could successfully try to run the action, which was successfully requested, even though the action itself says that it failed.
I wouldn't expect people are currently depending on the return value of run action, so probably we can just change it.