Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Added run_action task #21
Conversation
|
This depends on juju/python-libjuju#15 which has been bundled into the wheelhouse. |
| @@ -34,3 +34,21 @@ tests: | ||
| periodic: 5 | ||
| until: test_traffic.complete | ||
| after: deploy | ||
| +- name: test run_action |
petevg
Nov 22, 2016
Collaborator
This change breaks test_rules.py. It's a small fix: you just need to change the length assertion from 2 to 3.
| + until: run_action.complete | ||
| + - do: | ||
| + task: matrix.tasks.run_action | ||
| + application: kibana |
johnsca
Nov 22, 2016
Owner
It does actually deploy it, but it's not blocking properly on the health check. I'll look in to it.
| else: | ||
| result = 'healthy' | ||
| context.set_state('health.status', result) | ||
| rule.log.info("Health check: %s", result) | ||
| - return True | ||
| + return result != 'unhealthy' |
bcsaller
Nov 22, 2016
Contributor
I think True here is the right answer. Did this plugin exist successfully is the question. The semantics of the return are not about the work the task did, only if it could or could not.
There might be many occasions where the task is functioning properly but the result isn't as expected. For the type of signaling you expect here I think you'd set a state.
| + rule.log.info('Running %s on %s', action_name, unit.name) | ||
| + action = await unit.run_action(action_name, **params) | ||
| + await action.wait() | ||
| + return action.status != 'failed' |
|
Both tox and .yaml tests work great for me now. LGTM/+1 (not merging, because I see that @bcsaller has left comments.) |
johnsca commentedNov 22, 2016
No description provided.