From 975ad799a140412c53118eb38c028757e34ed014 Mon Sep 17 00:00:00 2001 From: Joao Morais Date: Mon, 14 Jan 2019 21:44:51 -0200 Subject: [PATCH] Fix validation of mod security conf HAProxy reloads are done after creating or updating haproxy.cfg and modsec.cfg, but validation of haproxy.cfg is done just after writing it to disk. This change writes haproxy.cfg after modsec.cfg in order to successfully validate it. --- pkg/controller/controller.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 0e2588387..413af07b5 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -179,22 +179,22 @@ func (haproxy *HAProxyController) OnUpdate(cfg ingress.Configuration) error { reloadRequired := !dynconfig.ConfigBackends(haproxy.currentConfig, updatedConfig) haproxy.currentConfig = updatedConfig - data, err := haproxy.haproxyTemplate.execute(updatedConfig) + modSecConf, err := haproxy.modsecTemplate.execute(updatedConfig) if err != nil { return err } - configFile, err := haproxy.rewriteConfigFiles(data) - if err != nil { + if err := haproxy.writeModSecConfigFile(modSecConf); err != nil { return err } - modSecConf, err := haproxy.modsecTemplate.execute(updatedConfig) + data, err := haproxy.haproxyTemplate.execute(updatedConfig) if err != nil { return err } - if err := haproxy.writeModSecConfigFile(modSecConf); err != nil { + configFile, err := haproxy.rewriteConfigFiles(data) + if err != nil { return err }