[master] 48d013f6d Expand macros in HAproxy config files.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Aug 7 09:39:09 UTC 2018
commit 48d013f6df8f58543d6501993bea783b8bf807af
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Aug 7 09:38:04 2018 +0000
Expand macros in HAproxy config files.
Submitted by: Frederic Lecaille <flecaille at haproxy.com>
diff --git a/bin/varnishtest/vtc_haproxy.c b/bin/varnishtest/vtc_haproxy.c
index 2de165031..a3e89c713 100644
--- a/bin/varnishtest/vtc_haproxy.c
+++ b/bin/varnishtest/vtc_haproxy.c
@@ -435,7 +435,7 @@ haproxy_check_conf(struct haproxy *h, const char *expect)
static void
haproxy_write_conf(const struct haproxy *h, const char *cfg, int auto_be)
{
- struct vsb *vsb, *vsb2;
+ struct vsb *vsb, *vsb2, *vsb3;
vsb = VSB_new_auto();
AN(vsb);
@@ -454,14 +454,18 @@ haproxy_write_conf(const struct haproxy *h, const char *cfg, int auto_be)
AZ(haproxy_build_backends(h, VSB_data(vsb)));
+ vsb3 = macro_expand(h->vl, VSB_data(vsb));
+ AN(vsb3);
+
if (VFIL_writefile(h->workdir, h->cfg_fn,
- VSB_data(vsb), VSB_len(vsb)) != 0)
+ VSB_data(vsb3), VSB_len(vsb3)) != 0)
vtc_fatal(h->vl,
"failed to write haproxy configuration file: %s (%d)",
strerror(errno), errno);
- vtc_dump(h->vl, 4, "conf", VSB_data(vsb), VSB_len(vsb));
+ vtc_dump(h->vl, 4, "conf", VSB_data(vsb3), VSB_len(vsb3));
+ VSB_destroy(&vsb3);
VSB_destroy(&vsb2);
VSB_destroy(&vsb);
}
More information about the varnish-commit
mailing list