Project

General

Profile

User story #10568

Create a hook for pre and post node deletion event

Added by François ARMAND 6 months ago. Updated 13 days ago.

Status:
Released
Priority:
N/A
Category:
System integration
Target version:
Target version (plugin):
Suggestion strength:
Want - This would make my life a lot easier but I can manage without
User visibility:
Operational - other Techniques | Technique editor | Rudder settings
Effort required:
Medium
Tags: Sponsored

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

Subtasks

Bug #11307: "node-post-deletion" and "node-pre-deletion" readme main title are incorrectReleasedAlexis MOUSSET


Related issues

Related to Rudder - User story #8353: Implement notifications for different server-side actions and events (hooks) Released 2016-12-22
Related to Rudder - User story #10724: adding a Hook after node validation New

Associated revisions

Revision 7f26d75c
Added by François ARMAND 5 months ago

Fixes #10568: Create a hook for pre and post node deletion event

History

#1 Updated by François ARMAND 6 months ago

  • Status changed from New to In progress
  • Assignee set to François ARMAND

#2 Updated by François ARMAND 6 months 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.

#4 Updated by François ARMAND 6 months ago

  • Status changed from In progress to New
  • Assignee deleted (François ARMAND)

I can't work anymore on that for the coming week.

#7 Updated by Vincent MEMBRÉ 5 months ago

  • Target version changed from 4.1.1 to 4.1.2

#8 Updated by Vincent MEMBRÉ 5 months 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

#9 Updated by Vincent MEMBRÉ 5 months ago

  • Assignee changed from Nicolas CHARLES to François ARMAND

#10 Updated by Vincent MEMBRÉ 5 months ago

  • Assignee changed from François ARMAND to Nicolas CHARLES

#11 Updated by Vincent MEMBRÉ 5 months ago

  • Assignee changed from Nicolas CHARLES to François ARMAND

#12 Updated by François ARMAND 5 months ago

  • Status changed from Pending technical review to Pending release

#13 Updated by François ARMAND 4 months ago

  • Related to User story #8353: Implement notifications for different server-side actions and events (hooks) added

#14 Updated by François ARMAND 4 months ago

#15 Updated by Vincent MEMBRÉ 4 months ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 4.1.2 which was released today.

Also available in: Atom PDF