Skip to content

Commit 4f8625c

Browse files
committed
switching to utilizing the ipmi_hosts table instead of hardcoded ipmi host ips adding support for the new and future hosts
1 parent 361ef85 commit 4f8625c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

bin/update_ipmi.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ function update_ipmi_ip()
1818
die('You\'re not authorized');
1919
}
2020
$final = [];
21-
foreach (['162.250.127.210', '216.219.95.21'] as $dhcpHost) {
21+
$db = get_module_db('default');
22+
$db->query("select * from ipmi_hosts", __LINE__, __FILE__);
23+
while ($db->next_record(MYSQL_ASSOC)) {
24+
$dhcpHost = $db->Record['host_ip'];
2225
if (preg_match_all('/^lease (?P<ip>[\d\.]*) {.*ends (?P<dayofweek>\d+) (?P<year>\d+)\/(?P<month>\d+)\/(?P<day>\d+) (?P<hour>\d+):(?P<minute>\d+):(?P<second>\d+);.* ethernet (?P<mac>[a-f\d:]+)\s*;.*}/msuU', file_get_contents('http://'.$dhcpHost.'/dhcpd.leases'), $matches)) {
2326
foreach ($matches['mac'] as $idx => $mac) {
2427
// Parse the lease timestamp

0 commit comments

Comments
 (0)