From 4faa97a29e62d37ff7a75488c82e39cd909feb96 Mon Sep 17 00:00:00 2001 From: jim-p Date: Thu, 29 Aug 2013 12:34:20 -0400 Subject: Add a manual config validation option to HAproxy (using -c to only check config file) --- config/haproxy/haproxy.inc | 5 +++++ config/haproxy/haproxy.xml | 2 +- config/haproxy/haproxy_global.php | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/haproxy/haproxy.inc b/config/haproxy/haproxy.inc index 61957252..aa8d5a3e 100644 --- a/config/haproxy/haproxy.inc +++ b/config/haproxy/haproxy.inc @@ -637,6 +637,11 @@ function haproxy_is_running() { return $running; } +function haproxy_check_config() { + exec("/usr/local/sbin/haproxy -c -f /var/etc/haproxy.cfg 2>&1", $output); + return implode("\n", $output); +} + function haproxy_check_run($reload) { global $config, $g; diff --git a/config/haproxy/haproxy.xml b/config/haproxy/haproxy.xml index 0c897dc7..227d1b27 100644 --- a/config/haproxy/haproxy.xml +++ b/config/haproxy/haproxy.xml @@ -42,7 +42,7 @@ Describe your package requirements here Currently there are no FAQ items provided. haproxy - 1.0 + 1.2.4 HAProxy /pkg_edit.php?xml=haproxy_pools.php /usr/local/pkg/haproxy.inc diff --git a/config/haproxy/haproxy_global.php b/config/haproxy/haproxy_global.php index c09b202f..aa046544 100755 --- a/config/haproxy/haproxy_global.php +++ b/config/haproxy/haproxy_global.php @@ -89,6 +89,12 @@ if ($_POST) { touch($d_haproxyconfdirty_path); write_config(); } + + if ($_POST['Submit'] == "Save and Check Config") { + $check_output = haproxy_check_config(); + if (empty($check_output)) + $check_output = "No output."; + } } } @@ -159,6 +165,14 @@ function enable_change(enable_change) {
+ + + @@ -386,6 +400,7 @@ function enable_change(enable_change) { -- cgit v1.2.3
+Configuration check output: +
+
+
+
General settings
  +