diff mbox series

[7/9] Use new config API in suricatta clients

Message ID 20210126131412.3567-8-michael.adler@siemens.com
State Changes Requested
Headers show
Series Overhaul swupdate.cfg handling | expand

Commit Message

Michael Adler Jan. 26, 2021, 1:14 p.m. UTC
Signed-off-by: Michael Adler <michael.adler@siemens.com>
Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 suricatta/server_general.c |  8 ++++++--
 suricatta/server_hawkbit.c | 11 ++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/suricatta/server_general.c b/suricatta/server_general.c
index 1803981..6ffc030 100644
--- a/suricatta/server_general.c
+++ b/suricatta/server_general.c
@@ -604,11 +604,15 @@  server_op_res_t server_start(char *fname, int argc, char *argv[])
 	LIST_INIT(&server_general.configdata);
 
 	if (fname) {
+		swupdate_cfg_handle handle;
+		swupdate_cfg_init(&handle, fname);
 
-		read_module_settings(fname, "gservice", server_general_settings,
+		swupdate_cfg_read_module_settings(&handle, "gservice", server_general_settings,
 					NULL);
-		read_module_settings(fname, "identify", settings_into_dict,
+		swupdate_cfg_read_module_settings(&handle, "identify", settings_into_dict,
 					&server_general.configdata);
+
+		swupdate_cfg_destroy(&handle);
 	}
 
 	if (loglevel >= DEBUGLEVEL) {
diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c
index df48180..165e686 100644
--- a/suricatta/server_hawkbit.c
+++ b/suricatta/server_hawkbit.c
@@ -1650,19 +1650,24 @@  server_op_res_t server_start(char *fname, int argc, char *argv[])
 	LIST_INIT(&server_hawkbit.configdata);
 
 	if (fname) {
+		swupdate_cfg_handle handle;
+		swupdate_cfg_init(&handle, fname);
+
 		/*
 		 * Search "suricatta" section to be compatible with past
 		 */
-		read_module_settings(fname, "suricatta", server_hawkbit_settings,
+		swupdate_cfg_read_module_settings(&handle, "suricatta", server_hawkbit_settings,
 					NULL);
 		/*
 		 * Then try "hawkBit" because each server has its own
 		 * section
 		 */
-		read_module_settings(fname, "hawkbit", server_hawkbit_settings,
+		swupdate_cfg_read_module_settings(&handle, "hawkbit", server_hawkbit_settings,
 					NULL);
-		read_module_settings(fname, "identify", settings_into_dict,
+		swupdate_cfg_read_module_settings(&handle, "identify", settings_into_dict,
 					&server_hawkbit.configdata);
+
+		swupdate_cfg_destroy(&handle);
 	}
 
 	if (loglevel >= DEBUGLEVEL) {