Project

General

Profile

Actions

Bug #17050

open

HAProxy pre-3.1-bug Warning

Added by Emre K 3 days ago. Updated 3 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
HAProxy
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Affected Version:
Affected Plus Version:
26.03.1
Affected Architecture:

Description

Documented here:

When enabling LUA and using LUA files in HAProxy, this warning comes up on every save

setting

tune.lua.bool-sample-conversion normal

in the global settings does not work because lua loading config is generated after the global settings.

using below patch fixed the issue for me but fixing it at upstream would be the optimal path.

--- a/usr/local/pkg/haproxy/haproxy.inc
+++ b/usr/local/pkg/haproxy/haproxy.inc
@@ -1620,3 +1620,15 @@
         // lua-load
+        $adv_lines = array();
+        if ($a_global['advanced']) {
+            $adv_lines = explode("\n", base64_decode($a_global['advanced']));
+            // Lua tunables and lua-prepend-path must precede lua-load directives
+            foreach($adv_lines as $adv_key => $adv_line) {
+                $adv_trimmed = trim(str_replace("\r", "", $adv_line));
+                if (preg_match('/^(tune\.lua\.|lua-prepend-path)/', $adv_trimmed)) {
+                    fwrite($fd, "\t" . $adv_trimmed . "\n");
+                    unset($adv_lines[$adv_key]);
+                }
+            }
+        }
         if (is_array($a_files)) {
             foreach($a_files as $file) {
@@ -1631,9 +1643,5 @@
         // Keep the advanced options on the bottom of the global settings, to allow additional sections to be easily added
-        if ($a_global['advanced']) {
-            $adv = explode("\n", base64_decode($a_global['advanced']));
-            foreach($adv as $adv_line) {
-                fwrite($fd, "\t" . str_replace("\r", "", $adv_line) . "\n");
-
-            }
-        }
+        foreach($adv_lines as $adv_line) {
+            fwrite($fd, "\t" . str_replace("\r", "", $adv_line) . "\n");
+        }
         fwrite ($fd, "\n");

Files

Actions

Also available in: Atom