Project

General

Profile

Actions

User story #10568

closed

Create a hook for pre and post node deletion event

Added by François ARMAND almost 7 years ago. Updated almost 2 years ago.

Status:
Released
Priority:
N/A
Category:
System integration
Target version:
UX impact:
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
Name check:
Fix check:
Regression:

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 1 (0 open1 closed)

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

Related issues 2 (0 open2 closed)

Related to Rudder - User story #8353: Implement notifications for different server-side actions and events (hooks)ReleasedJonathan CLARKE2016-12-22Actions
Related to Rudder - User story #10724: adding a Hook after node validationRejectedActions
Actions #1

Updated by François ARMAND almost 7 years ago

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

Updated by François ARMAND almost 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.

Actions #4

Updated by François ARMAND almost 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.

Actions #7

Updated by Vincent MEMBRÉ almost 7 years ago

  • Target version changed from 4.1.1 to 4.1.2
Actions #8

Updated by Vincent MEMBRÉ almost 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
Actions #9

Updated by Vincent MEMBRÉ almost 7 years ago

  • Assignee changed from Nicolas CHARLES to François ARMAND
Actions #10

Updated by Vincent MEMBRÉ almost 7 years ago

  • Assignee changed from François ARMAND to Nicolas CHARLES
Actions #11

Updated by Vincent MEMBRÉ almost 7 years ago

  • Assignee changed from Nicolas CHARLES to François ARMAND
Actions #12

Updated by François ARMAND almost 7 years ago

  • Status changed from Pending technical review to Pending release
Actions #13

Updated by François ARMAND almost 7 years ago

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

Updated by François ARMAND almost 7 years ago

Actions #15

Updated by Vincent MEMBRÉ almost 7 years ago

  • Status changed from Pending release to Released

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

Actions

Also available in: Atom PDF