canonical / juju-verify

https://launchpad.net/juju-verify
GNU General Public License v3.0
2 stars 7 forks source link

[action] catch a failed action #112

Closed esunar closed 1 year ago

esunar commented 1 year ago

We need to capture the falling action and provide the user a better report of what happened.

Example: I was trying to verify that it is safe to shutdown the ceph-osd unit, where one of the checks will use the list-pools action with another parameter format. However this additional parameter is not an part of the list-pools action in ceph-mon unit.

What I get:

$ juju-verify shutdown --unit ceph-osd-g1/0
Verification failed: ['validation failed: (root) : additional property "format" is not allowed, given {"format":"json"}']

What would I expect:

$ juju-verify shutdown --unit ceph-osd-g1/0
action `list-pools format=json` failed with errors: 
  validation failed: (root) : additional property "format" is not allowed, given {"format":"json"}
Verification failed: action `list-pools` failed

juju output:

$ juju run-action --wait ceph-mon-g1/0 list-pools format=json
{}
ERROR validation failed: (root) : additional property "format" is not allowed, given {"format":"json"}

Imported from Launchpad using lp2gh.

esunar commented 1 year ago

(by rgildein) PR: https://github.com/canonical/juju-verify/pull/14

Actual output if action failed:

$ juju-verify shutdown --units ceph-osd-g1/0
WARNING: The function to get the number of free units from 'ceph df' is in WIP and returns only 1. See LP#1921121 for more information.
WARNING: The function to get the number of free units from 'ceph df' is in WIP and returns only 1. See LP#1921121 for more information.
WARNING: The function to get the number of free units from 'ceph df' is in WIP and returns only 1. See LP#1921121 for more information.
Checks:
[WARN] ceph-osd-g1/0 has units running on child machines: ceph-mon-g1/0*
[FAIL] ceph-mon-g1/2: Ceph cluster is unhealthy
[FAIL] check_replication_number check failed with error: ceph-mon-g1/2: action `list-pools format=json` failed with errors:
  validation failed: (root) : additional property "format" is not allowed, given {"format":"json"}
[FAIL] check_availability_zone check failed with error: ceph-osd-g1/0: action `get-availability-zone` failed with errors:
  action "get-availability-zone" not defined on unit "ceph-osd-g1/0"

Overall result: Failed
esunar commented 1 year ago

(by rgildein) PR: https://github.com/canonical/juju-verify/pull/14