User story #10568
closedCreate a hook for pre and post node deletion event
Description
We want to add a hook for pre and post node deletion event.
A first idea is to have the following parameters to each hook:
node-delete-pre:
Required information via Environment (in addition to any possible other default information – so it might be redundant):
- UUID of Node - RUDDER_NODEID
- Role(s) of Node (none / policy server / etc) – RUDDER_NODE_ROLES (?)
- Full patch of its policy root-directory (since it might be chained through different relays) – for cleanup – RUDDER_POLICIES_DIRECTORY
- Policy server it belongs to. – RUDDER_NODE_POLICY_SERVER (?)
Return code in addition to the default ones:
- Cancel the removal = 100
- it would mean successful executed of the hook (without errors), but this node should not be removed (like protecting some nodes on the lowest level)
- it should be returned differently than a hook-failure to the UI/API
node-delete-post:
Required information via Environment (in addition to any possible other default information – so it might be redundant):
- UUID of Node - RUDDER_NODEID
- Role(s) of Node (none / policy server / etc) – RUDDER_NODE_ROLES (?)
- Full patch of its policy root-directory (since it might be chained through different relays) – for cleanup – RUDDER_POLICIES_DIRECTORY
- Policy server it belongs to. – RUDDER_NODE_POLICY_SERVER (?)
Possible exit code strategies:
- Error in hook + warning in hook:
- same behavior as an error would trigger in other hooks
Updated by François ARMAND over 7 years ago
- Status changed from New to In progress
- Assignee set to François ARMAND
Updated by François ARMAND over 7 years ago
I need a precision for the return code 100 for pre-hook.
For now, I understand the semantic as:
- execution of the hook is successful - the script did what it was supposed to do,
- do NOT process latter hooks - as if it was an error - and so must be the last hook to be used as a guard,
- returned a custom, specialized non-error message to the used explaining that all the hook where executed until the one returning 100 which prevented the node to be deleted because "hook message"
Is this that? I don't see how any other semantic plays well will the hook flow (especially if we choose to continue forward in the case of 100) - but I can just be missing the use case / semantic.
Updated by François ARMAND over 7 years ago
Work in progess here: https://github.com/fanf/rudder/commit/09e3f54538b7848f01784dfb8224af13aef22fbd
Updated by François ARMAND over 7 years ago
- Status changed from In progress to New
- Assignee deleted (
François ARMAND)
I can't work anymore on that for the coming week.
Updated by Vincent MEMBRÉ over 7 years ago
Work in progess here: https://github.com/VinceMacBuche/rudder/commit/b4306efe7979cb4a1d0b8179c65e24b3ac746a1e
Updated by Vincent MEMBRÉ over 7 years ago
Work in progess here: https://github.com/VinceMacBuche/rudder/commit/53686fa6f3a6431b93f955a7dc0236f3711bc95b
Updated by Vincent MEMBRÉ over 7 years ago
- Target version changed from 4.1.1 to 4.1.2
Updated by Vincent MEMBRÉ over 7 years ago
- Status changed from New to Pending technical review
- Assignee set to Nicolas CHARLES
- Pull Request set to https://github.com/Normation/rudder/pull/1629
Updated by Vincent MEMBRÉ over 7 years ago
- Assignee changed from Nicolas CHARLES to François ARMAND
Updated by Vincent MEMBRÉ over 7 years ago
- Assignee changed from François ARMAND to Nicolas CHARLES
Updated by Vincent MEMBRÉ over 7 years ago
- Assignee changed from Nicolas CHARLES to François ARMAND
Updated by François ARMAND over 7 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset rudder|7f26d75c230f7421d36214efc0aa1841f4f3fdaf.
Updated by François ARMAND over 7 years ago
- Related to User story #8353: Implement notifications for different server-side actions and events (hooks) added
Updated by François ARMAND over 7 years ago
- Related to User story #10724: adding a Hook after node validation added
Updated by Vincent MEMBRÉ over 7 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 4.1.2 which was released today.
- 4.1.2: Announce Changelog
- Download: https://www.rudder-project.org/site/get-rudder/downloads/