I think so - the message is recorded with juju as it should,
but it's not printed by default.
For example, if the code for an action handler (ops framework) looks like this (ignore the action name; it's copied from a project we're working on):
```
def _on_get_lists_action(self, event: ops.charm.ActionEvent) -> None:
"""List tempest test lists action.""" event.fail("this is the event fail message")
return
```
Then this is an example set of interactions with it:
```
$ juju run tempest/0 get-lists
Running operation 33 with 1 task
- task 34 on unit-tempest-0
Waiting for task 34...
$ echo $?
0
$ juju show-operation 33
summary: get-lists run on unit-tempest-0
status: failed
action:
name: get-lists
parameters: {}
timing:
enqueued: 2024-02-22 23:57:23 +0000 UTC
started: 2024-02-22 23:57:23 +0000 UTC
completed: 2024-02-22 23:57:25 +0000 UTC
tasks:
"34":
host: tempest/0
status: failed
timing:
enqueued: 2024-02-22 23:57:23 +0000 UTC
started: 2024-02-22 23:57:23 +0000 UTC
completed: 2024-02-22 23:57:25 +0000 UTC
message: this is the event fail message
results:
return-code: 0
$ juju show-task 34
$ juju show-task 34 --format yaml
id: "34"
message: this is the event fail message
results:
return-code: 0
status: failed
timing:
completed: 2024-02-22 23:57:25 +0000 UTC
enqueued: 2024-02-22 23:57:23 +0000 UTC
started: 2024-02-22 23:57:23 +0000 UTC
unit: tempest/0
$ juju run tempest/0 get-lists --format yaml
Running operation 35 with 1 task
- task 36 on unit-tempest-0
Waiting for task 36...
tempest/0:
id: "36"
message: this is the event fail message
results:
return-code: 0
status: failed
timing:
completed: 2024-02-22 23:57:48 +0000 UTC
enqueued: 2024-02-22 23:57:47 +0000 UTC
started: 2024-02-22 23:57:47 +0000 UTC
unit: tempest/0
```
The fail message is recorded, but the real issue is that it's not printed with the default plain formatter from juju.
It's only when showing the operation or task with yaml formatter, or running the action with the yaml formatter, is the failure made apparent.
This is an issue because it completely silences the failure for the default case of running the action,
leading the user to believe that the action succeeded:
no error message is displayed, and additionally the exit code is 0.
Note that in earlier versions of juju (2.9 from memory), this event failure message is indeed printed as expected.
I think so - the message is recorded with juju as it should,
but it's not printed by default.
For example, if the code for an action handler (ops framework) looks like this (ignore the action name; it's copied from a project we're working on):
``` lists_action( self, event: ops.charm. ActionEvent) -> None:
event. fail("this is the event fail message")
def _on_get_
"""List tempest test lists action."""
return
```
Then this is an example set of interactions with it:
```
$ juju run tempest/0 get-lists
Running operation 33 with 1 task
- task 34 on unit-tempest-0
Waiting for task 34...
$ echo $?
0
$ juju show-operation 33
summary: get-lists run on unit-tempest-0
status: failed
action:
name: get-lists
parameters: {}
timing:
enqueued: 2024-02-22 23:57:23 +0000 UTC
started: 2024-02-22 23:57:23 +0000 UTC
completed: 2024-02-22 23:57:25 +0000 UTC
tasks:
"34":
host: tempest/0
status: failed
timing:
enqueued: 2024-02-22 23:57:23 +0000 UTC
started: 2024-02-22 23:57:23 +0000 UTC
completed: 2024-02-22 23:57:25 +0000 UTC
message: this is the event fail message
results:
return-code: 0
$ juju show-task 34
$ juju show-task 34 --format yaml
id: "34"
message: this is the event fail message
results:
return-code: 0
status: failed
timing:
completed: 2024-02-22 23:57:25 +0000 UTC
enqueued: 2024-02-22 23:57:23 +0000 UTC
started: 2024-02-22 23:57:23 +0000 UTC
unit: tempest/0
$ juju run tempest/0 get-lists --format yaml
Running operation 35 with 1 task
- task 36 on unit-tempest-0
Waiting for task 36...
tempest/0:
id: "36"
message: this is the event fail message
results:
return-code: 0
status: failed
timing:
completed: 2024-02-22 23:57:48 +0000 UTC
enqueued: 2024-02-22 23:57:47 +0000 UTC
started: 2024-02-22 23:57:47 +0000 UTC
unit: tempest/0
```
The fail message is recorded, but the real issue is that it's not printed with the default plain formatter from juju.
It's only when showing the operation or task with yaml formatter, or running the action with the yaml formatter, is the failure made apparent.
This is an issue because it completely silences the failure for the default case of running the action,
leading the user to believe that the action succeeded:
no error message is displayed, and additionally the exit code is 0.
Note that in earlier versions of juju (2.9 from memory), this event failure message is indeed printed as expected.