BUG/MEDIUM: opentracing: initialization before establishing daemon and/or chroot mode

This patch solves the problem reported in github issue #1204, where the
OpenTracing filter cannot communicate with the selected tracer if HAProxy
is run in daemon mode.

This commit also solves github issue #1274, where the problem manifests
itself when using the 'chroot' keyword in the HAProxy configuration.

This is solved so that the initialization of the OpenTracing plugin is
split into two operations, first the plugin (dynamic library) is loaded
before switching the HAProxy to daemon mode (or chroot) and then the
tracer thread is started.

This means that nothing is retrieved from the file system in runtime.

After applying this commit, opentracing C wrapper version 1.1.0 should be
used because the earlier version does not have separated initialization
functions.

This resolves GitHub issues #1204 and #1274.

(cherry picked from commit 9425ed488f4d31db07f0c9b1e8b2f0fb65b18c7b)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/addons/ot/src/parser.c b/addons/ot/src/parser.c
index 5dec862..e26ca18 100644
--- a/addons/ot/src/parser.c
+++ b/addons/ot/src/parser.c
@@ -574,7 +574,8 @@
  */
 static int flt_ot_post_parse_cfg_tracer(void)
 {
-	int retval = ERR_NONE;
+	char errbuf[BUFSIZ] = "";
+	int  retval = ERR_NONE;
 
 	FLT_OT_FUNC("");
 
@@ -586,8 +587,13 @@
 	if (flt_ot_current_tracer->id == NULL)
 		FLT_OT_RETURN(retval);
 
-	if (flt_ot_current_tracer->config == NULL)
+	if (flt_ot_current_tracer->config == NULL) {
 		FLT_OT_POST_PARSE_ALERT("tracer '%s' has no configuration file specified", flt_ot_current_tracer->cfg_line, flt_ot_current_tracer->id);
+	} else {
+		flt_ot_current_tracer->cfgbuf = otc_file_read(flt_ot_current_tracer->config, "#", errbuf, sizeof(errbuf));
+		if (flt_ot_current_tracer->cfgbuf == NULL)
+			FLT_OT_POST_PARSE_ALERT("tracer '%s' %s", flt_ot_current_tracer->cfg_line, flt_ot_current_tracer->id, (*errbuf == '\0') ? "cannot load configuration file" : errbuf);
+	}
 
 	if (flt_ot_current_tracer->plugin == NULL)
 		FLT_OT_POST_PARSE_ALERT("tracer '%s' has no plugin library specified", flt_ot_current_tracer->cfg_line, flt_ot_current_tracer->id);