diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-08-29 14:03:05 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-12-13 15:02:55 +0100 |
commit | 68e218f9a0c61a41343eeae14eadd2e2f04fae91 (patch) | |
tree | 31549f90a6fc5377d775ee6438f10e341348b191 /ctl-lib/ctl-event.c | |
parent | a0f6ac410373843035cd54d648b28e9ea8f0cd1f (diff) |
Change loading configuration object behavior
This changes the default behavior when loading actions. Now, it appends
the new actions to the old ones instead of replacing them when called
several times.
If there were no actions previously loaded then it just loads normally
the actions.
Change-Id: Ica58a3edf4a9bf18ae31c6b6a5fa329e7ec5478b
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-event.c')
-rw-r--r-- | ctl-lib/ctl-event.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/ctl-lib/ctl-event.c b/ctl-lib/ctl-event.c index 4174000..1bed333 100644 --- a/ctl-lib/ctl-event.c +++ b/ctl-lib/ctl-event.c @@ -86,16 +86,14 @@ void CtrlDispatchV2Event(const char *evtLabel, json_object *eventJ) { // onload section receive one action or an array of actions int EventConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *actionsJ) { - + int err = 0; // Load time parse actions in config file if (actionsJ != NULL) { - section->actions= ActionConfig(apiHandle, actionsJ, 0); - - if (!section->actions) { - AFB_ApiError (apiHandle, "EventLoad config fail processing onload actions"); - return 1; + if ( (err= AddActionsToSection(apiHandle, section, actionsJ, 0)) ) { + AFB_ApiError (apiHandle, "EventLoad config fail processing actions for section %s", section->uid); + return err; } } - return 0; + return err; } |