* Fixed a bug in resync_databases where undefined column values weren't being handled properly.

* Made the link speed of down interfaces '0'.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 7 years ago
parent 0370d6acef
commit e38bc826dd
  1. 3
      Anvil/Tools/Database.pm
  2. 6
      tools/anvil-update-states

@ -3615,13 +3615,14 @@ sub resync_databases
foreach my $column_name (sort {$a cmp $b} keys %{$anvil->data->{db_data}{unified}{$table}{modified_date}{$modified_date}{$uuid_column}{$row_uuid}})
{
my $column_value = $anvil->data->{sys}{use_db_fh}->quote($anvil->data->{db_data}{unified}{$table}{modified_date}{$modified_date}{$uuid_column}{$row_uuid}{$column_name});
$column_value = "NULL" if not defined $column_value;
$column_value =~ s/'NULL'/NULL/g;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
column_name => $column_name,
column_value => $column_value,
}});
$query .= "$column_name = ".$anvil->data->{sys}{use_db_fh}->quote().", ";
$query .= "$column_name = ".$column_value.", ";
}
$query .= "modified_date = ".$anvil->data->{sys}{use_db_fh}->quote($modified_date)."::timestamp AT TIME ZONE 'UTC' WHERE $uuid_column = ".$anvil->data->{sys}{use_db_fh}->quote($row_uuid).";";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0074", variables => { id => $id, query => $query }});

@ -79,6 +79,12 @@ sub report_network
$speed = 100000 if not $speed;
$duplex = "full" if not $duplex;
}
# If the state is 'down', set the speed to '0'.
if (not $link_state)
{
$speed = 0;
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
interface => $interface,
mac_address => $mac_address,

Loading…
Cancel
Save