Log the configuration is not the same error message only when this is true. This message would have been shown even when a communication error would occur.

This commit is contained in:
Ermal 2011-03-17 18:58:02 +00:00
parent 7e5f3edbf6
commit 3c69c52c1c

View File

@ -99,19 +99,19 @@ function carp_check_version($url, $password, $port = 80, $method = 'pfsense.host
$numberofruns = 0;
while ($numberofruns < 2) {
$msg = new XML_RPC_Message($method, $params);
$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
$username = $config['system']['user'][0]['name'];
$cli->setCredentials($username, $password);
if($numberofruns > 1)
$cli->setDebug(1);
/* send our XMLRPC message and timeout after 240 seconds */
$resp = $cli->send($msg, "240");
if(!is_object($resp)) {
$error = "A communications error occured while attempting XMLRPC sync with username {$username} {$url}:{$port}.";
} elseif($resp->faultCode()) {
$error = "An error code was received while attempting XMLRPC sync with username {$username} {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
} else {
$msg = new XML_RPC_Message($method, $params);
$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
$username = $config['system']['user'][0]['name'];
$cli->setCredentials($username, $password);
if($numberofruns > 1)
$cli->setDebug(1);
/* send our XMLRPC message and timeout after 240 seconds */
$resp = $cli->send($msg, "240");
if(!is_object($resp)) {
$error = "A communications error occured while attempting XMLRPC sync with username {$username} {$url}:{$port}.";
} elseif($resp->faultCode()) {
$error = "An error code was received while attempting XMLRPC sync with username {$username} {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
} else {
$parsed_response = XML_RPC_decode($resp->value());
if(!is_array($parsed_response)) {
if (trim($parsed_response) == "Authentication failed") {
@ -122,9 +122,11 @@ function carp_check_version($url, $password, $port = 80, $method = 'pfsense.host
}
} else {
if (!isset($parsed_response['config_version']) ||
$parsed_response['config_version'] < $config['version'])
$parsed_response['config_version'] < $config['version']) {
update_filter_reload_status("The other member is on older configuration version of {$g['product_name']}. Sync will not be done to prevent problems!");
log_error("The other member is on older configuration version of {$g['product_name']}. Sync will not be done to prevent problems!");
return false;
else
} else
return true;
}
}
@ -379,11 +381,8 @@ if (is_array($config['installedpackages']['carpsettings']['config'])) {
if ($carp['synchronizecaptiveportal'] != "" and is_array($config['vouchers']))
$sections[] = 'vouchers';
if (count($sections) > 0) {
if (!carp_check_version($synchronizetoip, $carp['password'], $port)) {
update_filter_reload_status("The other member is on older configuration version of {$g['product_name']}. Sync will not be done to prevent problems!");
log_error("The other member is on older configuration version of {$g['product_name']}. Sync will not be done to prevent problems!");
if (!carp_check_version($synchronizetoip, $carp['password'], $port))
break;
}
update_filter_reload_status("Signaling CARP reload signal...");
carp_sync_xml($synchronizetoip, $carp['password'], $sections, $port);