Commit ee486a42 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Couple of bug fixes:

* Use the "role" slot of the interfaces table, instead of joining with
  node_type, to find the control interface. Must do this inside an
  inner Elab of course, since the node_types table does not reflect
  how assign selected the interface we use for the "control" network.

* Use !is_numeric() instead of is_string() to determine if the naming
  patter in alpha based instead of number based ("1" is a string).
parent 5722b3e3
...@@ -143,10 +143,10 @@ function guess_IP ($prefix, $number) { ...@@ -143,10 +143,10 @@ function guess_IP ($prefix, $number) {
} }
# #
# We want to be able to handle both numeric and character 'number's - figure # We want to be able to handle both numeric and character 'number's
# out which we have # Figure out which we have
# #
if (is_string($number)) { if (! is_numeric($number)) {
$using_char = 1; $using_char = 1;
$number = ord($number); $number = ord($number);
} else { } else {
...@@ -166,10 +166,10 @@ function guess_IP ($prefix, $number) { ...@@ -166,10 +166,10 @@ function guess_IP ($prefix, $number) {
} else { } else {
$node = $prefix . $i; $node = $prefix . $i;
} }
$query_result = DBQueryFatal("select IP from interfaces as i " . $query_result =
"left join nodes as n on i.node_id = n.node_id left join " . DBQueryFatal("select IP from interfaces as i " .
"node_types as nt on n.type = nt.type " . "where i.node_id='$node' and ".
"where n.node_id='$node' and i.iface = nt.control_iface"); " i.role='" . TBDB_IFACEROLE_CONTROL . "'");
if (mysql_num_rows($query_result)) { if (mysql_num_rows($query_result)) {
$row = mysql_fetch_array($query_result); $row = mysql_fetch_array($query_result);
$IP = $row[IP]; $IP = $row[IP];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment