Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Change order of commit handlers #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tombosmansibm
Copy link
Collaborator

to avoid that the appliance becomes unresponsive when both "commit" and "commit and restart" handlers are called. Now "commit and restart" is executed first.

See issue 172

…nresponsive when both "commit" and "commit and restart" handlers are called. Now "commit and restart" is executed first.
@Warkdev
Copy link

Warkdev commented Nov 9, 2020

Hello,

What's the reasonning of this PR ? The order of handlers in the YML file have no impact on how they are triggered, right ? They are only listed and can be used if you call them explicitly in a task somewhere else.

@tombosmansibm
Copy link
Collaborator Author

Handlers are executed in the order they’re listed. In situations where there are multiple handlers to be executed, you want the “Commit and restart” handler to be executed first (it also handles commit), this avoids ending up with an unresponsive appliance.

@Warkdev
Copy link

Warkdev commented Nov 10, 2020

Wait, to be sure I get it, you mean that, if you describe in the handlers this:

- handler_A
- handler_B

And in your role/task file this:

- task: ..
  notify:
    - handler_B
    - handler_A

Handler B will be triggered after Handler A because in the handler file it's declared before ? This doesn't make sense to me, bit of weird, no ?

Cédric Servais

@tombosmansibm
Copy link
Collaborator Author

That is correct. But the real issue occurs when there's multiple handlers at different places (in different tasks). So for instance, you do multiple tasks, the first one you process notifies "commit and restart", the last one notifies "commit", the order of processing is based on the order in handlers.

@tombosmansibm
Copy link
Collaborator Author

Has nothing to do with the IBM Security code, btw, it is Ansible :
https://docs.ansible.com/ansible/latest/user_guide/playbooks_handlers.html#controlling-when-handlers-run

@Warkdev
Copy link

Warkdev commented Nov 10, 2020

Got it,

I wondered indeed :) Thank you !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants