Changes between Initial Version and Version 1 of Development/Features/PrePostActionsNCMNCD


Ignore:
Timestamp:
Jul 31, 2013, 7:14:30 PM (12 years ago)
Author:
munoz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Development/Features/PrePostActionsNCMNCD

    v1 v1  
     1= Pre and post-configuration hooks on ncm-ncd =
     2
     3[[TracNav]]
     4
     5[[TOC(inline)]]
     6
     7== Introduction ==
     8
     9We want to be able to take actions before and after components are executed, with no link to the profile.  Use cases include:
     10
     11* Report the execution results to the monitoring right away.
     12* Freezing and unfreezing services in the members of an HA setup.
     13
     14Users should be able to specify the actions that need to be taken.  However, these actions will not receive any `$config`-like object, or any profile representation.
     15
     16This came a long time ago, as part of our feedback during our LISA presentation.
     17
     18=== When hooks will run ===
     19
     20We'll run hooks as part of the `--configure` process only. We'll run them:
     21
     22* Before any components run (`run-init`).
     23* After all components have run (`run-finalize`)
     24
     25We may discuss also:
     26
     27* Before the execution of each component.
     28* After the execution of each component.
     29
     30But I'll implement these only if they are '''really''' needed.
     31
     32== Implementation ==
     33
     34=== Hook API ===
     35
     36==== run-init ====
     37
     38The pre-run action will receive no arguments. If it fails, it shall abort the execution of any configuration modules.
     39
     40==== run-finalize ====
     41
     42The post-run will receive the execution status (`%global_status` variable in [https://github.com/quattor/ncm-ncd/blob/master/src/main/perl/ComponentProxyList.pm#L87 NCD::ComponentProxyList::executeConfigComponents]) as its only argument.  If it fails, `ncm-ncd` will exit with a special exit code.
     43
     44=== Specifying the hooks ===
     45
     46We'll specify hooks in `/etc/ncm-ncd.conf`.  They will look like this:
     47
     48{{{
     49#!ini
     50run-init-hook = <hook-name>
     51run-finalize-hook = <hook-name>
     52}}}
     53
     54=== What a hook actually is ===
     55
     56We have two options here.  And I'll implement only one of them, what's the feeling of the community?
     57
     58==== Option 1: Perl module ====
     59
     60A Perl module inside, say, `NCD::Hooks` namespace.  It provides `run_init` and `run_finalize` methods.
     61
     62==== Option 2: an executable ====
     63
     64Perl is not the favourite language of many contributors, and they prefer to be able to write their hooks in a different language.  Any scripted hook that requires arguments would receive them as a JSON object via STDIN.