aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-08-29 12:34:20 -0400
committerjim-p <jimp@pfsense.org>2013-08-29 12:34:20 -0400
commit4faa97a29e62d37ff7a75488c82e39cd909feb96 (patch)
tree8e4b75c4276375a76fd4a4c8779a57b8fcd65913 /config/haproxy
parent6f8bef0a95e943f35144b342f12013638dde27e3 (diff)
downloadpfsense-packages-4faa97a29e62d37ff7a75488c82e39cd909feb96.tar.gz
pfsense-packages-4faa97a29e62d37ff7a75488c82e39cd909feb96.tar.bz2
pfsense-packages-4faa97a29e62d37ff7a75488c82e39cd909feb96.zip
Add a manual config validation option to HAproxy (using -c to only check config file)
Diffstat (limited to 'config/haproxy')
-rw-r--r--config/haproxy/haproxy.inc5
-rw-r--r--config/haproxy/haproxy.xml2
-rwxr-xr-xconfig/haproxy/haproxy_global.php15
3 files changed, 21 insertions, 1 deletions
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 @@
<requirements>Describe your package requirements here</requirements>
<faq>Currently there are no FAQ items provided.</faq>
<name>haproxy</name>
- <version>1.0</version>
+ <version>1.2.4</version>
<title>HAProxy</title>
<aftersaveredirect>/pkg_edit.php?xml=haproxy_pools.php</aftersaveredirect>
<include_file>/usr/local/pkg/haproxy.inc</include_file>
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) {
<td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <?php if ($_POST['Submit'] == "Save and Check Config"): ?>
+ <tr><td colspan="2" valign="top" class="vncell">
+Configuration check output:
+<pre>
+<?= $check_output; ?>
+</pre>
+ </td></tr>
+ <?php endif; ?>
<tr>
<td colspan="2" valign="top" class="listtopic">General settings</td>
</tr>
@@ -386,6 +400,7 @@ function enable_change(enable_change) {
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change(true)">
+ <input name="Submit" type="submit" class="formbtn" value="Save and Check Config" onClick="enable_change(true)">
</td>
</td>
</tr>