diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2008-03-18 23:39:21 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2008-03-18 23:39:21 +0000 |
commit | 1b3e5c016b90a501ab6a07aab1a05b09eab31571 (patch) | |
tree | 9345a6bc1a495538c674c1f98705bdd0c04af77c | |
parent | 3c960212e6d1469a8fef46b78559bf609113d365 (diff) | |
download | pfsense-1b3e5c016b90a501ab6a07aab1a05b09eab31571.zip pfsense-1b3e5c016b90a501ab6a07aab1a05b09eab31571.tar.gz |
If XML Carp configuration sync fails, rerun the sync with setDebug(1).
-rw-r--r-- | etc/inc/filter.inc | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index e5c7cd4..52fdaf4 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -3181,23 +3181,29 @@ function carp_sync_xml($url, $password, $sections, $port = 80, $method = 'pfsens 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++; } } |