WebUI: Oxidized Device List: Link to config and refreshDevice Btn (#9129)

* WebUI: Direct link to oxidized config from list, oxidized refresh device capability

* WebUI: Direct link to oxidized config from list, oxidized refresh device capability

* Move oxidized_node_update in functions.php to avoid code duplication

* Update refresh-oxidized-node.inc.php

* Update functions.php
This commit is contained in:
PipoCanaja
2018-09-04 19:09:27 -05:00
committed by Tony Murray
parent 9fc3891441
commit 3f806fdff3
5 changed files with 93 additions and 11 deletions
+23
View File
@@ -2628,3 +2628,26 @@ function is_disk_valid($disk, $device)
}
return true;
}
/**
* Queues a hostname to be refreshed by Oxidized
* Settings: oxidized.url
*
* @param string $hostname
* @param string $msg
* @param string $username
* @return bool
*/
function oxidized_node_update($hostname, $msg, $username = 'not_provided')
{
// Work around https://github.com/rack/rack/issues/337
$msg = str_replace("%", "", $msg);
$postdata = ["user" => $username, "msg" => $msg];
$oxidized_url = Config::get('oxidized.url');
if (!empty($oxidized_url)) {
Requests::put("$oxidized_url/node/next/$hostname", [], json_encode($postdata), ['proxy' => get_proxy()]);
return true;
}
return false;
}//end oxidized_node_update()