@@ -4,8 +4,8 @@
// isdf - dhcp generator
// Author: Carsten Schoene
//
-// $LastChangedDate: 2012-09-17 20:40:37 +0200 (Mon, 17 Sep 2012) $
-// $Rev: 1845 $
+// $LastChangedDate: 2012-09-17 21:47:13 +0200 (Mon, 17 Sep 2012) $
+// $Rev: 1850 $
*/
// define our name
@@ -64,7 +64,7 @@
$pxeend = $pxeinet4->broadcast();
// create dhcp entry for host & pxe
-$qrybkvm="SELECT value FROM inv_system_properties WHERE inv_system_id=(SELECT inv_system_id FROM inv_system_properties WHERE datakey='" . $config["isdf"]["dhcp"]["db_datakey"] . "' and value='" . $config["isdf"]["dhcp"]["db_datavalue"] . "') AND datakey='get_system_net_info';";
+$qrybkvm = "SELECT t1.value AS value FROM inv_system_properties t1, inv_system_properties t2 WHERE t1.datakey='get_system_net_info' AND t1.inv_system_id=t2.inv_system_id AND t2.datakey='" . $config["isdf"]["dhcp"]["db_datakey"] . "' AND t2.value='" . $config["isdf"]["dhcp"]["db_datavalue"] . "';";
$dhcpmacs = array();
@@ -103,6 +103,8 @@
//echo " another try with: $revhost\n";
$systemfirst = $systeminet4->increment($systemfirst,$systemend);
$revhost = $config["isdf"]["dhcp"]["system"]["hostnameprefix"] . preg_replace('/\./', '-', $systemfirst);
+ } else {
+ break;
}
}
//echo " while loop ended with: $revhost\n";
@@ -120,6 +122,8 @@
} elseif ( $retval == 1 ) {
$pxefirst = $pxeinet4->increment($pxefirst,$pxeend);
$revhost = $config["isdf"]["dhcp"]["systempxe"]["hostnameprefix"] . preg_replace('/\./', '-', $pxefirst);
+ } else {
+ break;
}
}
$dhcpsystempxe->addHost($revhost,$mac,$pxefirst);
@@ -129,7 +133,8 @@
// create dhcp entry for mgmt
-$qrymgmtbkvm = "SELECT value FROM inv_system_properties WHERE datakey LIKE 'get_system_mgmt_mac' AND inv_system_id=(SELECT inv_system_id FROM inv_system_properties WHERE datakey='" . $config["isdf"]["dhcp"]["db_datakey"] . "' AND value='" . $config["isdf"]["dhcp"]["db_datavalue"] . "');";
+$qrymgmtbkvm = "SELECT t1.value AS value FROM inv_system_properties t1, inv_system_properties t2 WHERE t1.datakey='get_system_mgmt_mac' AND t1.inv_system_id=t2.inv_system_id AND t2.datakey='" . $config["isdf"]["dhcp"]["db_datakey"] . "' AND t2.value='" . $config["isdf"]["dhcp"]["db_datavalue"] . "';";
+
$mgmtaddr = explode("/", $config["isdf"]["dhcp"]["systemmgmt"]["net4"]);
$mgmtinet4 = new IPv4($mgmtaddr[0], $mgmtaddr[1]);
$mgmtend = $mgmtinet4->broadcast();
@@ -161,6 +166,8 @@
} elseif ( $retval == 1 ) {
$mgmtfirst = $mgmtinet4->increment($mgmtfirst,$mgmtend);
$revhost = $config["isdf"]["dhcp"]["systemmgmt"]["hostnameprefix"] . preg_replace('/\./', '-', $mgmtfirst);
+ } else {
+ break;
}
}
$dhcpsystemmgmt->addHost($revhost,$mac,$mgmtfirst);
|