Conversation
|
|
|
||
| def v2_playbook_on_start(self, playbook): | ||
| playbook_filename = basename(playbook._file_name) | ||
| if playbook_filename == 'features.yaml': |
There was a problem hiding this comment.
This is probably the only ugly part since additional playbooks wanting this kind of output would require an entry here. That would be nice to somehow indicate in the playbook or the metadata for a given command but I think we could solve that later since this achieves the goal pretty cleanly.
There was a problem hiding this comment.
Yeah. The problem is that the "read playbook metadata" step in obsah happens after Ansible (and callbacks) is initialized, as we use Ansible to parse the playbook for information. @arvind4501 also had issues with that in theforeman/obsah#107
| def v2_runner_on_ok(self, result): | ||
| if self.FALLBACK_TO_DEFAULT: | ||
| super().v2_runner_on_ok(result) | ||
| else: |
There was a problem hiding this comment.
Since you only want to change the on_ok behavior, maybe instead of catching the playbook name, you can access the task object via the result, and extract the parameters of the task object. If you can add arbitrary params to the task, you will be able to do something like:
- task1:
verbatim_print: true
and then catch it from here:
if result._task.params[verbatim_print]
....
else
super().v2_runner_on_ok(result)This way we won't need to store the FALLBACK_TO_DEFAULT in all the other hooks.
No description provided.