From 68e218f9a0c61a41343eeae14eadd2e2f04fae91 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 29 Aug 2018 14:03:05 +0200 Subject: 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 --- ctl-lib/ctl-control.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'ctl-lib/ctl-control.c') diff --git a/ctl-lib/ctl-control.c b/ctl-lib/ctl-control.c index 0605d6b..b28ff4c 100644 --- a/ctl-lib/ctl-control.c +++ b/ctl-lib/ctl-control.c @@ -24,15 +24,12 @@ // onload section receive one action or an array of actions int ControlConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *actionsJ) { - - // Load time parse actions in config file - if (actionsJ != NULL) { - section->actions= ActionConfig(apiHandle, actionsJ, 1); - - if (!section->actions) { - AFB_ApiError (apiHandle, "ControlLoad config fail processing onload actions"); - return 1; + int err = 0; + if (actionsJ) { + if ( (err= AddActionsToSection(apiHandle, section, actionsJ, 1)) ) { + AFB_ApiError (apiHandle, "ControlLoad config fail processing actions for section %s", section->uid); + return err; } } - return 0; + return err; } -- cgit 1.2.3-korg