aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-11-17 20:47:28 -0500
committerScott Ullrich <sullrich@pfsense.org>2009-11-17 20:47:28 -0500
commitcc28f054e65a3bbe0be3e6b279ef2971f97f2cd0 (patch)
treeea0ea51878b761d46044757eed3adc3fe07c5699 /config
parent541b5f4bac1b71e5774fb39f812a6124ef4bb186 (diff)
downloadpfsense-packages-cc28f054e65a3bbe0be3e6b279ef2971f97f2cd0.tar.gz
pfsense-packages-cc28f054e65a3bbe0be3e6b279ef2971f97f2cd0.tar.bz2
pfsense-packages-cc28f054e65a3bbe0be3e6b279ef2971f97f2cd0.zip
Reload HAProxy configuration on sync'd peers
Diffstat (limited to 'config')
-rw-r--r--config/haproxy/haproxy.inc30
1 files changed, 30 insertions, 0 deletions
diff --git a/config/haproxy/haproxy.inc b/config/haproxy/haproxy.inc
index 6c226269..652d0a63 100644
--- a/config/haproxy/haproxy.inc
+++ b/config/haproxy/haproxy.inc
@@ -287,4 +287,34 @@ function haproxy_do_xmlrpc_sync($sync_to_ip, $password) {
}
}
+ /* tell haproxy to reload our settings on the destionation sync host. */
+ $method = 'pfsense.exec_php';
+ $execcmd = "require_once('/usr/local/pkg/haproxy.inc');\n";
+ $execcmd .= "haproxy_configure();\n";
+
+ /* assemble xmlrpc payload */
+ $params = array(
+ XML_RPC_encode($password),
+ XML_RPC_encode($execcmd)
+ );
+
+ log_error("HAProxy XMLRPC reload data {$url}:{$port}.");
+ $msg = new XML_RPC_Message($method, $params);
+ $cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
+ $cli->setCredentials('admin', $password);
+ $resp = $cli->send($msg, "250");
+ if(!$resp) {
+ $error = "A communications error occurred while attempting HAProxy XMLRPC sync with {$url}:{$port} (pfsense.exec_php).";
+ log_error($error);
+ file_notice("sync_settings", $error, "HAProxy Settings Reload", "");
+ } elseif($resp->faultCode()) {
+ $cli->setDebug(1);
+ $resp = $cli->send($msg, "250");
+ $error = "An error code was received while attempting HAProxy XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
+ log_error($error);
+ file_notice("sync_settings", $error, "HAProxy Settings Sync", "");
+ } else {
+ log_error("HAProxy XMLRPC reload data success with {$url}:{$port} (pfsense.exec_php).");
+ }
+
?> \ No newline at end of file