Trying to fix a bug where vnet devices keep reporting as having returned.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 3 years ago
parent e40d0e2444
commit 213babaaf2
  1. 13
      Anvil/Tools/Database.pm
  2. 2
      Anvil/Tools/ScanCore.pm
  3. 1
      scancore-agents/scan-network/scan-network

@ -9112,16 +9112,21 @@ sub insert_or_update_network_interfaces
# If we don't have a network interface UUID, try to look one up using the MAC address
if (not $network_interface_uuid)
{
# See if I know this NIC by referencing it's MAC and name. The name is needed because virtual
# devices can share the MAC with the real interface.
# See if I know this NIC by referencing it's MAC (if not a vnet device), host_uuid and name.
# The name is needed because virtual devices can share the MAC with the real interface.
my $query = "
SELECT
network_interface_uuid
FROM
network_interfaces
WHERE
WHERE ";
if ($network_interface_name !~ /^vnet/)
{
$query .= "
network_interface_mac_address = ".$anvil->Database->quote($network_interface_mac_address)."
AND
AND ";
}
$query .= "
network_interface_name = ".$anvil->Database->quote($network_interface_name)."
AND
network_interface_host_uuid = ".$anvil->Database->quote($network_interface_host_uuid)."

@ -271,7 +271,7 @@ sub agent_startup
}
# Connect to DBs.
$anvil->Database->connect({debug => 2});
$anvil->Database->connect({debug => $debug});
$anvil->Log->entry({source => $agent, line => __LINE__, level => $debug, secure => 0, key => "log_0132"});
if (not $anvil->data->{sys}{database}{connections})
{

@ -724,6 +724,7 @@ ORDER BY
}});
my $query = "DELETE FROM network_interfaces WHERE network_interface_uuid = ".$anvil->Database->quote($network_interface_uuid).";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
$anvil->Database->write({query => $query, source => $THIS_FILE, line => __LINE__});
$count--;

Loading…
Cancel
Save