fix: Actually reload oxidized when we should not when we think we should (#6515)

This commit is contained in:
Neil Lathwood
2017-04-28 04:31:48 +01:00
committed by Tony Murray
parent 6b5faa75dd
commit 153f0de12f
2 changed files with 6 additions and 2 deletions

View File

@ -131,6 +131,10 @@ $proctime = substr($run, 0, 5);
if ($discovered_devices) {
dbInsert(array('type' => 'discover', 'doing' => $doing, 'start' => $start, 'duration' => $proctime, 'devices' => $discovered_devices, 'poller' => $config['distributed_poller_name']), 'perf_times');
if ($doing === 'new') {
// We have added a new device by this point so we might want to do some other work
oxidized_reload_nodes();
}
}
$string = $argv[0]." $doing ".date($config['dateformat']['compact'])." - $discovered_devices devices discovered in $proctime secs";

View File

@ -371,6 +371,7 @@ function delete_device($id)
$ret .= "Removed device $host\n";
log_event("Device $host has been removed", 0, 'system', 3);
oxidized_reload_nodes();
return $ret;
}
@ -718,7 +719,6 @@ function createHost(
$device_id = dbInsert($device, 'devices');
if ($device_id) {
oxidized_reload_nodes();
return $device_id;
}
@ -1559,7 +1559,7 @@ function oxidized_reload_nodes()
global $config;
if ($config['oxidized']['enabled'] === true && $config['oxidized']['reload_nodes'] === true && isset($config['oxidized']['url'])) {
$oxidized_reload_url = $config['oxidized']['url'] . '/reload?format=json';
$oxidized_reload_url = $config['oxidized']['url'] . '/reload.json';
$ch = curl_init($oxidized_reload_url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);