summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2008-03-18 23:39:08 +0000
committerScott Ullrich <sullrich@pfsense.org>2008-03-18 23:39:08 +0000
commit87bdd838333187b70891c7dd9aad8b5462f66ab4 (patch)
treefc8c24cb672df4dc85e99193b4b3e1c7a5adb389
parentbf6d2fbc60ca51bdcf3266130ec8e538127594cd (diff)
downloadpfsense-87bdd838333187b70891c7dd9aad8b5462f66ab4.zip
pfsense-87bdd838333187b70891c7dd9aad8b5462f66ab4.tar.gz
If XML Carp configuration sync fails, rerun the sync with setDebug(1).
-rw-r--r--etc/inc/filter.inc42
1 files changed, 24 insertions, 18 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index 467a7c6..d727fff 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -3322,24 +3322,30 @@ function carp_sync_xml($url, $password, $sections, $port = 80, $method = 'pfsens
XML_RPC_encode($password),
XML_RPC_encode($xml)
);
-
- log_error("Beginning XMLRPC sync to {$url}:{$port}.");
- $msg = new XML_RPC_Message($method, $params);
- $cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
- $cli->setCredentials('admin', $password);
- if($g['debug']) $cli->setDebug(1);
- /* send our XMLRPC message and timeout after 240 seconds */
- $resp = $cli->send($msg, "240");
- if(!$resp) {
- $error = "A communications error occured while attempting XMLRPC sync with username admin {$url}:{$port}.";
- log_error($error);
- file_notice("sync_settings", $error, "Settings Sync", "");
- } elseif($resp->faultCode()) {
- $error = "An error code was received while attempting XMLRPC sync with username admin {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
- log_error($error);
- file_notice("sync_settings", $error, "Settings Sync", "");
- } else {
- log_error("XMLRPC sync successfully completed with {$url}:{$port}.");
+
+ $numberofruns = 0;
+ while($numberofruns < 2) {
+ log_error("Beginning XMLRPC sync to {$url}:{$port}.");
+ $msg = new XML_RPC_Message($method, $params);
+ $cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
+ $cli->setCredentials('admin', $password);
+ if($numberofruns == 1)
+ $cli->setDebug(1);
+ /* send our XMLRPC message and timeout after 240 seconds */
+ $resp = $cli->send($msg, "240");
+ if(!$resp) {
+ $error = "A communications error occured while attempting XMLRPC sync with username admin {$url}:{$port}.";
+ log_error($error);
+ file_notice("sync_settings", $error, "Settings Sync", "");
+ } elseif($resp->faultCode()) {
+ $error = "An error code was received while attempting XMLRPC sync with username admin {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
+ log_error($error);
+ file_notice("sync_settings", $error, "Settings Sync", "");
+ } else {
+ log_error("XMLRPC sync successfully completed with {$url}:{$port}.");
+ $numberofruns = 3;
+ }
+ $numberofruns++;
}
}
OpenPOWER on IntegriCloud