* Fixed tools/anvil-update-states so that it properly removed ip_addresses no longer assigned to a host. Also merged 'network::interfaces::by_name::${interface}' with 'network::local::interface::${interface}' for storing discovered interfaces.'

* Added 'ip_address_note' to the 'ip_addresses' table as there was no column convenient for flagging as DELETEd.
* Added 'uuid' to Database->insert_or_update_file_locations() and ->insert_or_update_files(), and actually used it in all ->inser_or_update_X() methods.
* Added 'delete' as a parameter to Database->insert_or_update_ip_addresses() to allow simple deletion of a referenced IP address.
* Addressed a few 'undefined variable' errors.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent 517771594e
commit 077977ad9c
  1. 205
      Anvil/Tools/Database.pm
  2. 27
      Anvil/Tools/Network.pm
  3. 8
      Anvil/Tools/System.pm
  4. 5
      rpm/SPECS/anvil.spec
  5. 4
      share/anvil.sql
  6. 2
      tools/anvil-check-memory
  7. 2
      tools/anvil-daemon
  8. 2
      tools/anvil-manage-files
  9. 207
      tools/anvil-update-states

@ -2074,7 +2074,7 @@ AND
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -2135,7 +2135,7 @@ INSERT INTO
); );
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
else else
{ {
@ -2152,7 +2152,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -2193,7 +2193,7 @@ WHERE
bridge_interface_uuid = ".$anvil->Database->quote($bridge_interface_uuid)." bridge_interface_uuid = ".$anvil->Database->quote($bridge_interface_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -2303,7 +2303,7 @@ AND
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -2370,7 +2370,7 @@ INSERT INTO
); );
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
else else
{ {
@ -2390,7 +2390,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -2443,7 +2443,7 @@ WHERE
bridge_uuid = ".$anvil->Database->quote($bridge_uuid)." bridge_uuid = ".$anvil->Database->quote($bridge_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -2593,7 +2593,7 @@ AND
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -2672,7 +2672,7 @@ INSERT INTO
); );
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
else else
{ {
@ -2698,7 +2698,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -2775,7 +2775,7 @@ WHERE
bond_uuid = ".$anvil->Database->quote($bond_uuid)." bond_uuid = ".$anvil->Database->quote($bond_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -2807,6 +2807,10 @@ This is the C<< files >> -> C<< file_uuid >> referenced by this record.
This is the C<< hosts >> -> C<< host_uuid >> referenced by this record. This is the C<< hosts >> -> C<< host_uuid >> referenced by this record.
=head3 uuid (optional)
If set, only the corresponding database will be written to.
=cut =cut
sub insert_or_update_file_locations sub insert_or_update_file_locations
{ {
@ -2816,12 +2820,14 @@ sub insert_or_update_file_locations
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3; my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Database->insert_or_update_file_locations()" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Database->insert_or_update_file_locations()" }});
my $uuid = defined $parameter->{uuid} ? $parameter->{uuid} : "";
my $file = defined $parameter->{file} ? $parameter->{file} : ""; my $file = defined $parameter->{file} ? $parameter->{file} : "";
my $line = defined $parameter->{line} ? $parameter->{line} : ""; my $line = defined $parameter->{line} ? $parameter->{line} : "";
my $file_location_uuid = defined $parameter->{file_location_uuid} ? $parameter->{file_location_uuid} : ""; my $file_location_uuid = defined $parameter->{file_location_uuid} ? $parameter->{file_location_uuid} : "";
my $file_location_file_uuid = defined $parameter->{file_location_file_uuid} ? $parameter->{file_location_file_uuid} : ""; my $file_location_file_uuid = defined $parameter->{file_location_file_uuid} ? $parameter->{file_location_file_uuid} : "";
my $file_location_host_uuid = defined $parameter->{file_location_host_uuid} ? $parameter->{file_location_host_uuid} : $anvil->data->{sys}{host_uuid}; my $file_location_host_uuid = defined $parameter->{file_location_host_uuid} ? $parameter->{file_location_host_uuid} : $anvil->data->{sys}{host_uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
uuid => $uuid,
file_location_uuid => $file_location_uuid, file_location_uuid => $file_location_uuid,
file_location_file_uuid => $file_location_file_uuid, file_location_file_uuid => $file_location_file_uuid,
file_location_host_uuid => $file_location_host_uuid, file_location_host_uuid => $file_location_host_uuid,
@ -2858,7 +2864,7 @@ AND
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -2917,7 +2923,7 @@ INSERT INTO
); );
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
else else
{ {
@ -2933,7 +2939,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -2970,7 +2976,7 @@ WHERE
file_location_uuid = ".$anvil->Database->quote($file_location_uuid)." file_location_uuid = ".$anvil->Database->quote($file_location_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -3014,6 +3020,10 @@ This is the file's type/purpose. The expected values are 'iso' (disc image a new
This is the file's C<< mtime >> (modification time as a unix timestamp). This is used in case a file of the same name exists on two or more systems, but their size or md5sum differ. The file with the most recent mtime is used to update the older versions. This is the file's C<< mtime >> (modification time as a unix timestamp). This is used in case a file of the same name exists on two or more systems, but their size or md5sum differ. The file with the most recent mtime is used to update the older versions.
=head3 uuid (optional)
If set, only the corresponding database will be written to.
=cut =cut
sub insert_or_update_files sub insert_or_update_files
{ {
@ -3023,6 +3033,7 @@ sub insert_or_update_files
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3; my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Database->insert_or_update_files()" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Database->insert_or_update_files()" }});
my $uuid = defined $parameter->{uuid} ? $parameter->{uuid} : "";
my $file = defined $parameter->{file} ? $parameter->{file} : ""; my $file = defined $parameter->{file} ? $parameter->{file} : "";
my $line = defined $parameter->{line} ? $parameter->{line} : ""; my $line = defined $parameter->{line} ? $parameter->{line} : "";
my $file_uuid = defined $parameter->{file_uuid} ? $parameter->{file_uuid} : ""; my $file_uuid = defined $parameter->{file_uuid} ? $parameter->{file_uuid} : "";
@ -3033,6 +3044,9 @@ sub insert_or_update_files
my $file_type = defined $parameter->{file_type} ? $parameter->{file_type} : ""; my $file_type = defined $parameter->{file_type} ? $parameter->{file_type} : "";
my $file_mtime = defined $parameter->{file_mtime} ? $parameter->{file_mtime} : ""; my $file_mtime = defined $parameter->{file_mtime} ? $parameter->{file_mtime} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
uuid => $uuid,
file => $file,
line => $line,
file_uuid => $file_uuid, file_uuid => $file_uuid,
file_name => $file_name, file_name => $file_name,
file_directory => $file_directory, file_directory => $file_directory,
@ -3092,7 +3106,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -3159,7 +3173,7 @@ INSERT INTO
); );
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
else else
{ {
@ -3179,7 +3193,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -3232,7 +3246,7 @@ WHERE
file_uuid = ".$anvil->Database->quote($file_uuid)." file_uuid = ".$anvil->Database->quote($file_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -3330,7 +3344,7 @@ AND
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -3369,7 +3383,7 @@ INSERT INTO
); );
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
else else
{ {
@ -3386,7 +3400,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -3427,7 +3441,7 @@ WHERE
host_key_uuid = ".$anvil->Database->quote($host_key_uuid)." host_key_uuid = ".$anvil->Database->quote($host_key_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -3535,7 +3549,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -3573,7 +3587,7 @@ INSERT INTO
); );
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
elsif (($old_host_name ne $host_name) or elsif (($old_host_name ne $host_name) or
($old_host_type ne $host_type) or ($old_host_type ne $host_type) or
@ -3592,7 +3606,7 @@ WHERE
host_uuid = ".$anvil->Database->quote($host_uuid)." host_uuid = ".$anvil->Database->quote($host_uuid)."
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0126", variables => { method => "Database->insert_or_update_hosts()" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0126", variables => { method => "Database->insert_or_update_hosts()" }});
@ -3607,6 +3621,12 @@ If there is an error, an empty string is returned.
Parameters; Parameters;
=head3 delete (optional, default '0')
When set to C<< 1 >>, the C<< ip_address_note >> is set to C<< DELETED >>, and nothing else is changed.
B<< Note >>: When set to C<< 1 >>, only the C<< ip_address_uuid >> is needed.
=head3 uuid (optional) =head3 uuid (optional)
If set, only the corresponding database will be written to. If set, only the corresponding database will be written to.
@ -3655,6 +3675,10 @@ This is an option gateway IP address for this interface.
This is a comma-separated list of DNS servers used to resolve host names. This is recorded, but ignored unless C<< ip_address_gateway >> is set. Example format is C<< 8.8.8.8 >> or C<< 8.8.8.8,4.4.4.4 >>. This is a comma-separated list of DNS servers used to resolve host names. This is recorded, but ignored unless C<< ip_address_gateway >> is set. Example format is C<< 8.8.8.8 >> or C<< 8.8.8.8,4.4.4.4 >>.
=head2 ip_address_note (optional)
This can be set to C<< DELETED >> when the IP address is no longer in use.
=cut =cut
sub insert_or_update_ip_addresses sub insert_or_update_ip_addresses
{ {
@ -3664,6 +3688,7 @@ sub insert_or_update_ip_addresses
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3; my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Database->insert_or_update_ip_addresses()" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Database->insert_or_update_ip_addresses()" }});
my $delete = defined $parameter->{'delete'} ? $parameter->{'delete'} : 0;
my $uuid = defined $parameter->{uuid} ? $parameter->{uuid} : ""; my $uuid = defined $parameter->{uuid} ? $parameter->{uuid} : "";
my $file = defined $parameter->{file} ? $parameter->{file} : ""; my $file = defined $parameter->{file} ? $parameter->{file} : "";
my $line = defined $parameter->{line} ? $parameter->{line} : ""; my $line = defined $parameter->{line} ? $parameter->{line} : "";
@ -3676,6 +3701,7 @@ sub insert_or_update_ip_addresses
my $ip_address_gateway = defined $parameter->{ip_address_gateway} ? $parameter->{ip_address_gateway} : ""; my $ip_address_gateway = defined $parameter->{ip_address_gateway} ? $parameter->{ip_address_gateway} : "";
my $ip_address_default_gateway = defined $parameter->{ip_address_default_gateway} ? $parameter->{ip_address_default_gateway} : 0; my $ip_address_default_gateway = defined $parameter->{ip_address_default_gateway} ? $parameter->{ip_address_default_gateway} : 0;
my $ip_address_dns = defined $parameter->{ip_address_dns} ? $parameter->{ip_address_dns} : ""; my $ip_address_dns = defined $parameter->{ip_address_dns} ? $parameter->{ip_address_dns} : "";
my $ip_address_note = defined $parameter->{ip_address_note} ? $parameter->{ip_address_note} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
uuid => $uuid, uuid => $uuid,
file => $file, file => $file,
@ -3689,8 +3715,21 @@ sub insert_or_update_ip_addresses
ip_address_gateway => $ip_address_gateway, ip_address_gateway => $ip_address_gateway,
ip_address_default_gateway => $ip_address_default_gateway, ip_address_default_gateway => $ip_address_default_gateway,
ip_address_dns => $ip_address_dns, ip_address_dns => $ip_address_dns,
ip_address_note => $ip_address_note,
}}); }});
if ($delete)
{
# We need the ip_address_uuid _or_ the ip_address_address
if (not $ip_address_uuid)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0020", variables => { method => "Database->insert_or_update_ip_addresses()", parameter => "ip_address_uuid" }});
return("");
}
}
else
{
# Not deleting, verify we have what we need.
if (not $ip_address_on_type) if (not $ip_address_on_type)
{ {
# Throw an error and exit. # Throw an error and exit.
@ -3715,6 +3754,7 @@ sub insert_or_update_ip_addresses
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0020", variables => { method => "Database->insert_or_update_ip_addresses()", parameter => "ip_address_subnet_mask" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0020", variables => { method => "Database->insert_or_update_ip_addresses()", parameter => "ip_address_subnet_mask" }});
return(""); return("");
} }
}
# If we don't have a UUID, see if we can find one for the given ip_address server name. # If we don't have a UUID, see if we can find one for the given ip_address server name.
if (not $ip_address_uuid) if (not $ip_address_uuid)
@ -3726,12 +3766,10 @@ FROM
ip_addresses ip_addresses
WHERE WHERE
ip_address_address = ".$anvil->Database->quote($ip_address_address)." ip_address_address = ".$anvil->Database->quote($ip_address_address)."
AND
ip_address_host_uuid = ".$anvil->Database->quote($ip_address_host_uuid)."
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -3744,6 +3782,13 @@ AND
} }
} }
if ($delete)
{
my $query = "UPDATE ip_addresses SET ip_address_note = 'DELETED' WHERE ip_address_uuid = ".$anvil->Database->quote($ip_address_uuid).";";
$anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
return($ip_address_uuid);
}
# If I still don't have an ip_address_uuid, we're INSERT'ing . # If I still don't have an ip_address_uuid, we're INSERT'ing .
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { ip_address_uuid => $ip_address_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { ip_address_uuid => $ip_address_uuid }});
if (not $ip_address_uuid) if (not $ip_address_uuid)
@ -3787,6 +3832,7 @@ INSERT INTO
ip_address_gateway, ip_address_gateway,
ip_address_default_gateway, ip_address_default_gateway,
ip_address_dns, ip_address_dns,
ip_address_note,
modified_date modified_date
) VALUES ( ) VALUES (
".$anvil->Database->quote($ip_address_uuid).", ".$anvil->Database->quote($ip_address_uuid).",
@ -3798,11 +3844,12 @@ INSERT INTO
".$anvil->Database->quote($ip_address_gateway).", ".$anvil->Database->quote($ip_address_gateway).",
".$anvil->Database->quote($ip_address_default_gateway).", ".$anvil->Database->quote($ip_address_default_gateway).",
".$anvil->Database->quote($ip_address_dns).", ".$anvil->Database->quote($ip_address_dns).",
".$anvil->Database->quote($ip_address_note).",
".$anvil->Database->quote($anvil->data->{sys}{database}{timestamp})." ".$anvil->Database->quote($anvil->data->{sys}{database}{timestamp})."
); );
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
else else
{ {
@ -3816,7 +3863,8 @@ SELECT
ip_address_subnet_mask, ip_address_subnet_mask,
ip_address_gateway, ip_address_gateway,
ip_address_default_gateway, ip_address_default_gateway,
ip_address_dns ip_address_dns,
ip_address_note
FROM FROM
ip_addresses ip_addresses
WHERE WHERE
@ -3824,7 +3872,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -3846,6 +3894,7 @@ WHERE
my $old_ip_address_gateway = $row->[5]; my $old_ip_address_gateway = $row->[5];
my $old_ip_address_default_gateway = $row->[6]; my $old_ip_address_default_gateway = $row->[6];
my $old_ip_address_dns = $row->[7]; my $old_ip_address_dns = $row->[7];
my $old_ip_address_note = $row->[8];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
old_ip_address_host_uuid => $old_ip_address_host_uuid, old_ip_address_host_uuid => $old_ip_address_host_uuid,
old_ip_address_on_type => $old_ip_address_on_type, old_ip_address_on_type => $old_ip_address_on_type,
@ -3855,6 +3904,7 @@ WHERE
old_ip_address_gateway => $old_ip_address_gateway, old_ip_address_gateway => $old_ip_address_gateway,
old_ip_address_default_gateway => $old_ip_address_default_gateway, old_ip_address_default_gateway => $old_ip_address_default_gateway,
old_ip_address_dns => $old_ip_address_dns, old_ip_address_dns => $old_ip_address_dns,
old_ip_address_note => $old_ip_address_note,
}}); }});
# Anything change? # Anything change?
@ -3865,7 +3915,8 @@ WHERE
($old_ip_address_subnet_mask ne $ip_address_subnet_mask) or ($old_ip_address_subnet_mask ne $ip_address_subnet_mask) or
($old_ip_address_gateway ne $ip_address_gateway) or ($old_ip_address_gateway ne $ip_address_gateway) or
($old_ip_address_default_gateway ne $ip_address_default_gateway) or ($old_ip_address_default_gateway ne $ip_address_default_gateway) or
($old_ip_address_dns ne $ip_address_dns)) ($old_ip_address_dns ne $ip_address_dns) or
($old_ip_address_note ne $ip_address_note))
{ {
# Something changed, save. # Something changed, save.
my $query = " my $query = "
@ -3880,12 +3931,13 @@ SET
ip_address_gateway = ".$anvil->Database->quote($ip_address_gateway).", ip_address_gateway = ".$anvil->Database->quote($ip_address_gateway).",
ip_address_default_gateway = ".$anvil->Database->quote($ip_address_default_gateway).", ip_address_default_gateway = ".$anvil->Database->quote($ip_address_default_gateway).",
ip_address_dns = ".$anvil->Database->quote($ip_address_dns).", ip_address_dns = ".$anvil->Database->quote($ip_address_dns).",
ip_address_note = ".$anvil->Database->quote($ip_address_note).",
modified_date = ".$anvil->Database->quote($anvil->data->{sys}{database}{timestamp})." modified_date = ".$anvil->Database->quote($anvil->data->{sys}{database}{timestamp})."
WHERE WHERE
ip_address_uuid = ".$anvil->Database->quote($ip_address_uuid)." ip_address_uuid = ".$anvil->Database->quote($ip_address_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -4100,7 +4152,7 @@ AND
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -4182,7 +4234,7 @@ INSERT INTO
); );
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
else else
{ {
@ -4207,7 +4259,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -4319,7 +4371,7 @@ WHERE
{ {
# Something changed, update # Something changed, update
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
else else
@ -4359,7 +4411,7 @@ WHERE
job_uuid = ".$anvil->Database->quote($job_uuid)." job_uuid = ".$anvil->Database->quote($job_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -4517,7 +4569,7 @@ sub insert_or_update_network_interfaces
my $query = "SELECT network_interface_uuid FROM network_interfaces WHERE network_interface_mac_address = ".$anvil->Database->quote($network_interface_mac_address)." AND network_interface_name = ".$anvil->Database->quote($network_interface_name).";"; my $query = "SELECT network_interface_uuid FROM network_interfaces WHERE network_interface_mac_address = ".$anvil->Database->quote($network_interface_mac_address)." AND network_interface_name = ".$anvil->Database->quote($network_interface_name).";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$network_interface_uuid = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__})->[0]->[0]; $network_interface_uuid = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__})->[0]->[0];
$network_interface_uuid = "" if not defined $network_interface_uuid; $network_interface_uuid = "" if not defined $network_interface_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { network_interface_uuid => $network_interface_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { network_interface_uuid => $network_interface_uuid }});
} }
@ -4546,7 +4598,7 @@ WHERE
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -4623,7 +4675,7 @@ WHERE
;"; ;";
$query =~ s/'NULL'/NULL/g; $query =~ s/'NULL'/NULL/g;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -4668,7 +4720,7 @@ INSERT INTO
"; ";
$query =~ s/'NULL'/NULL/g; $query =~ s/'NULL'/NULL/g;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0126", variables => { method => "Database->insert_or_update_network_interfaces()" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0126", variables => { method => "Database->insert_or_update_network_interfaces()" }});
@ -4768,7 +4820,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -4797,7 +4849,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -4856,7 +4908,7 @@ WHERE
mac_to_ip_uuid = ".$anvil->Database->quote($mac_to_ip_uuid)." mac_to_ip_uuid = ".$anvil->Database->quote($mac_to_ip_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -4885,7 +4937,7 @@ INSERT INTO
"; ";
$query =~ s/'NULL'/NULL/g; $query =~ s/'NULL'/NULL/g;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
$anvil->Database->write({query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
return($mac_to_ip_uuid); return($mac_to_ip_uuid);
@ -4976,7 +5028,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -5005,7 +5057,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -5046,7 +5098,7 @@ WHERE
oui_uuid = ".$anvil->Database->quote($oui_uuid)." oui_uuid = ".$anvil->Database->quote($oui_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -5075,7 +5127,7 @@ INSERT INTO
"; ";
$query =~ s/'NULL'/NULL/g; $query =~ s/'NULL'/NULL/g;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
$anvil->Database->write({query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
return($oui_uuid); return($oui_uuid);
@ -5159,7 +5211,7 @@ AND
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -5190,7 +5242,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -5235,7 +5287,7 @@ WHERE
session_uuid = ".$anvil->Database->quote($session_uuid)." session_uuid = ".$anvil->Database->quote($session_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -5265,7 +5317,7 @@ INSERT INTO
"; ";
$query =~ s/'NULL'/NULL/g; $query =~ s/'NULL'/NULL/g;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, uuid => $uuid, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
return($session_uuid); return($session_uuid);
@ -5370,7 +5422,7 @@ AND
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -5429,7 +5481,7 @@ INSERT INTO
); );
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
else else
{ {
@ -5446,7 +5498,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -5488,7 +5540,7 @@ WHERE
state_uuid = ".$anvil->Database->quote($state_uuid)." state_uuid = ".$anvil->Database->quote($state_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -5659,7 +5711,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -5730,7 +5782,7 @@ INSERT INTO
); );
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
else else
{ {
@ -5753,7 +5805,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -5819,7 +5871,7 @@ WHERE
user_uuid = ".$anvil->Database->quote($user_uuid)." user_uuid = ".$anvil->Database->quote($user_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -5946,7 +5998,7 @@ WHERE
variable_uuid = ".$anvil->Database->quote($variable_uuid); variable_uuid = ".$anvil->Database->quote($variable_uuid);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$variable_name = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__})->[0]->[0]; $variable_name = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__})->[0]->[0];
$variable_name = "" if not defined $variable_name; $variable_name = "" if not defined $variable_name;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { variable_name => $variable_name }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { variable_name => $variable_name }});
} }
@ -5972,7 +6024,7 @@ AND
$query .= ";"; $query .= ";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -6018,7 +6070,7 @@ INSERT INTO
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
else else
{ {
@ -6044,7 +6096,7 @@ AND
$query .= ";"; $query .= ";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -6089,7 +6141,7 @@ AND
$query .= ";"; $query .= ";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -6110,7 +6162,7 @@ WHERE
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
@ -6160,7 +6212,7 @@ WHERE
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$anvil->Database->write({query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__});
} }
} }
} }
@ -7299,7 +7351,6 @@ sub refresh_timestamp
This will resync the database data on this and peer database(s) if needed. It takes no arguments and will immediately return unless C<< sys::database::resync_needed >> was set. This will resync the database data on this and peer database(s) if needed. It takes no arguments and will immediately return unless C<< sys::database::resync_needed >> was set.
=cut =cut
### TODO - BUG: This is, somehow, writing existing records into the history schema of databases.
sub resync_databases sub resync_databases
{ {
my $self = shift; my $self = shift;
@ -7682,7 +7733,7 @@ sub resync_databases
if ($to_write_count > 0) if ($to_write_count > 0)
{ {
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0221", variables => { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0221", variables => {
to_write => $to_write_count, to_write => $anvil->Convert->add_commas({number => $to_write_count}),
host_name => $anvil->Get->host_name({host_uuid => $uuid}), host_name => $anvil->Get->host_name({host_uuid => $uuid}),
}}); }});
$anvil->Database->write({debug => $debug, uuid => $uuid, query => $merged, source => $THIS_FILE, line => __LINE__}); $anvil->Database->write({debug => $debug, uuid => $uuid, query => $merged, source => $THIS_FILE, line => __LINE__});
@ -7698,14 +7749,6 @@ sub resync_databases
$anvil->data->{sys}{database}{resync_needed} = 0; $anvil->data->{sys}{database}{resync_needed} = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 'sys::database::resync_needed' => $anvil->data->{sys}{database}{resync_needed} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 'sys::database::resync_needed' => $anvil->data->{sys}{database}{resync_needed} }});
# Show tables;
# SELECT table_schema, table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE' AND table_schema NOT IN ('pg_catalog', 'information_schema') ORDER BY table_name ASC, table_schema DESC;
# Show columns;
# SELECT table_catalog, table_schema, table_name, column_name, column_default, is_nullable, data_type FROM information_schema.columns WHERE table_schema = 'public' AND table_name = 'alerts';
# psql -E anvil <<-- LOVE <3
return(0); return(0);
} }

@ -729,6 +729,8 @@ sub find_matches
This method loads and stores the same data as the C<< get_ips >> method, but does so by loading data from the database, instead of collecting it directly from the host. As such, it can also be used by C<< find_matches >>. This method loads and stores the same data as the C<< get_ips >> method, but does so by loading data from the database, instead of collecting it directly from the host. As such, it can also be used by C<< find_matches >>.
C<< Note >>: IP addresses that have been deleted will be marked so by C<< ip >> being set to C<< DELETED >>.
The loaded data will be stored as: The loaded data will be stored as:
* C<< network::<target>::interface::<iface_name>::ip >> - If an IP address is set * C<< network::<target>::interface::<iface_name>::ip >> - If an IP address is set
@ -744,9 +746,9 @@ Parameters;
This is the optional C<< target >> string to use in the hash where the data is stored. This is the optional C<< target >> string to use in the hash where the data is stored.
=head3 host_uuid (required) =head3 host_uuid (optional, default 'sys::host_uuid')
This is the C<< host_uuid >> of the hosts whose IP and interface data that you want to load. This is the C<< host_uuid >> of the hosts whose IP and interface data that you want to load. The default is to load the local machine's data.
=cut =cut
sub load_ips sub load_ips
@ -757,7 +759,7 @@ sub load_ips
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3; my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Network->find_matches()" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Network->find_matches()" }});
my $host_uuid = defined $parameter->{host_uuid} ? $parameter->{host_uuid} : ""; my $host_uuid = defined $parameter->{host_uuid} ? $parameter->{host_uuid} : $anvil->data->{sys}{host_uuid};
my $host = defined $parameter->{host} ? $parameter->{host} : ""; my $host = defined $parameter->{host} ? $parameter->{host} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
host => $host, host => $host,
@ -776,6 +778,12 @@ sub load_ips
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { host => $host }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { host => $host }});
} }
if (exists $anvil->data->{network}{$host})
{
delete $anvil->data->{network}{$host};
}
# Read in all IPs, so that we know which to remove.
my $query = " my $query = "
SELECT SELECT
ip_address_address, ip_address_address,
@ -788,8 +796,6 @@ SELECT
FROM FROM
ip_addresses ip_addresses
WHERE WHERE
ip_address_on_type != 'DELETED'
AND
ip_address_host_uuid = ".$anvil->Database->quote($host_uuid)." ip_address_host_uuid = ".$anvil->Database->quote($host_uuid)."
"; ";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
@ -852,6 +858,7 @@ WHERE
$anvil->data->{network}{$host}{interface}{$interface_name}{default_gateway} = $ip_address_default_gateway; $anvil->data->{network}{$host}{interface}{$interface_name}{default_gateway} = $ip_address_default_gateway;
$anvil->data->{network}{$host}{interface}{$interface_name}{gateway} = $ip_address_gateway; $anvil->data->{network}{$host}{interface}{$interface_name}{gateway} = $ip_address_gateway;
$anvil->data->{network}{$host}{interface}{$interface_name}{dns} = $ip_address_dns; $anvil->data->{network}{$host}{interface}{$interface_name}{dns} = $ip_address_dns;
$anvil->data->{network}{$host}{interface}{$interface_name}{type} = $ip_address_on_type;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"network::${host}::interface::${interface_name}::mac" => $anvil->data->{network}{$host}{interface}{$interface_name}{mac}, "network::${host}::interface::${interface_name}::mac" => $anvil->data->{network}{$host}{interface}{$interface_name}{mac},
"network::${host}::interface::${interface_name}::ip" => $anvil->data->{network}{$host}{interface}{$interface_name}{ip}, "network::${host}::interface::${interface_name}::ip" => $anvil->data->{network}{$host}{interface}{$interface_name}{ip},
@ -859,6 +866,7 @@ WHERE
"network::${host}::interface::${interface_name}::default_gateway" => $anvil->data->{network}{$host}{interface}{$interface_name}{default_gateway}, "network::${host}::interface::${interface_name}::default_gateway" => $anvil->data->{network}{$host}{interface}{$interface_name}{default_gateway},
"network::${host}::interface::${interface_name}::gateway" => $anvil->data->{network}{$host}{interface}{$interface_name}{gateway}, "network::${host}::interface::${interface_name}::gateway" => $anvil->data->{network}{$host}{interface}{$interface_name}{gateway},
"network::${host}::interface::${interface_name}::dns" => $anvil->data->{network}{$host}{interface}{$interface_name}{dns}, "network::${host}::interface::${interface_name}::dns" => $anvil->data->{network}{$host}{interface}{$interface_name}{dns},
"network::${host}::interface::${interface_name}::type" => $anvil->data->{network}{$host}{interface}{$interface_name}{type},
}}); }});
} }
elsif ($ip_address_on_type eq "bond") elsif ($ip_address_on_type eq "bond")
@ -893,6 +901,7 @@ WHERE
$anvil->data->{network}{$host}{interface}{$interface_name}{default_gateway} = $ip_address_default_gateway; $anvil->data->{network}{$host}{interface}{$interface_name}{default_gateway} = $ip_address_default_gateway;
$anvil->data->{network}{$host}{interface}{$interface_name}{gateway} = $ip_address_gateway; $anvil->data->{network}{$host}{interface}{$interface_name}{gateway} = $ip_address_gateway;
$anvil->data->{network}{$host}{interface}{$interface_name}{dns} = $ip_address_dns; $anvil->data->{network}{$host}{interface}{$interface_name}{dns} = $ip_address_dns;
$anvil->data->{network}{$host}{interface}{$interface_name}{type} = $ip_address_on_type;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"network::${host}::interface::${interface_name}::mac" => $anvil->data->{network}{$host}{interface}{$interface_name}{mac}, "network::${host}::interface::${interface_name}::mac" => $anvil->data->{network}{$host}{interface}{$interface_name}{mac},
"network::${host}::interface::${interface_name}::ip" => $anvil->data->{network}{$host}{interface}{$interface_name}{ip}, "network::${host}::interface::${interface_name}::ip" => $anvil->data->{network}{$host}{interface}{$interface_name}{ip},
@ -900,6 +909,7 @@ WHERE
"network::${host}::interface::${interface_name}::default_gateway" => $anvil->data->{network}{$host}{interface}{$interface_name}{default_gateway}, "network::${host}::interface::${interface_name}::default_gateway" => $anvil->data->{network}{$host}{interface}{$interface_name}{default_gateway},
"network::${host}::interface::${interface_name}::gateway" => $anvil->data->{network}{$host}{interface}{$interface_name}{gateway}, "network::${host}::interface::${interface_name}::gateway" => $anvil->data->{network}{$host}{interface}{$interface_name}{gateway},
"network::${host}::interface::${interface_name}::dns" => $anvil->data->{network}{$host}{interface}{$interface_name}{dns}, "network::${host}::interface::${interface_name}::dns" => $anvil->data->{network}{$host}{interface}{$interface_name}{dns},
"network::${host}::interface::${interface_name}::type" => $anvil->data->{network}{$host}{interface}{$interface_name}{type},
}}); }});
} }
elsif ($ip_address_on_type eq "bridge") elsif ($ip_address_on_type eq "bridge")
@ -934,6 +944,7 @@ WHERE
$anvil->data->{network}{$host}{interface}{$interface_name}{default_gateway} = $ip_address_default_gateway; $anvil->data->{network}{$host}{interface}{$interface_name}{default_gateway} = $ip_address_default_gateway;
$anvil->data->{network}{$host}{interface}{$interface_name}{gateway} = $ip_address_gateway; $anvil->data->{network}{$host}{interface}{$interface_name}{gateway} = $ip_address_gateway;
$anvil->data->{network}{$host}{interface}{$interface_name}{dns} = $ip_address_dns; $anvil->data->{network}{$host}{interface}{$interface_name}{dns} = $ip_address_dns;
$anvil->data->{network}{$host}{interface}{$interface_name}{type} = $ip_address_on_type;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"network::${host}::interface::${interface_name}::mac" => $anvil->data->{network}{$host}{interface}{$interface_name}{mac}, "network::${host}::interface::${interface_name}::mac" => $anvil->data->{network}{$host}{interface}{$interface_name}{mac},
"network::${host}::interface::${interface_name}::ip" => $anvil->data->{network}{$host}{interface}{$interface_name}{ip}, "network::${host}::interface::${interface_name}::ip" => $anvil->data->{network}{$host}{interface}{$interface_name}{ip},
@ -941,6 +952,7 @@ WHERE
"network::${host}::interface::${interface_name}::default_gateway" => $anvil->data->{network}{$host}{interface}{$interface_name}{default_gateway}, "network::${host}::interface::${interface_name}::default_gateway" => $anvil->data->{network}{$host}{interface}{$interface_name}{default_gateway},
"network::${host}::interface::${interface_name}::gateway" => $anvil->data->{network}{$host}{interface}{$interface_name}{gateway}, "network::${host}::interface::${interface_name}::gateway" => $anvil->data->{network}{$host}{interface}{$interface_name}{gateway},
"network::${host}::interface::${interface_name}::dns" => $anvil->data->{network}{$host}{interface}{$interface_name}{dns}, "network::${host}::interface::${interface_name}::dns" => $anvil->data->{network}{$host}{interface}{$interface_name}{dns},
"network::${host}::interface::${interface_name}::type" => $anvil->data->{network}{$host}{interface}{$interface_name}{type},
}}); }});
} }
} }
@ -1009,6 +1021,11 @@ sub get_ips
my $host = $target ? $target : "local"; my $host = $target ? $target : "local";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { host => $host }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { host => $host }});
if (exists $anvil->data->{network}{$host})
{
delete $anvil->data->{network}{$host};
}
# Reading locally or remote? # Reading locally or remote?
my $in_iface = ""; my $in_iface = "";
my $shell_call = $anvil->data->{path}{exe}{ip}." addr list"; my $shell_call = $anvil->data->{path}{exe}{ip}." addr list";

@ -2115,7 +2115,7 @@ sub reload_daemon
my $anvil = $self->parent; my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3; my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
my $return = undef; my $return = 9999;
my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : ""; my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }});
@ -2241,7 +2241,7 @@ sub restart_daemon
my $anvil = $self->parent; my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3; my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
my $return = undef; my $return = 9999;
my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : ""; my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }});
@ -2273,7 +2273,7 @@ sub start_daemon
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3; my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "System->start_daemon()" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "System->start_daemon()" }});
my $return = undef; my $return = 9999;
my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : ""; my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }});
@ -2305,7 +2305,7 @@ sub stop_daemon
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3; my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "System->stop_daemon()" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "System->stop_daemon()" }});
my $return = undef; my $return = 9999;
my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : ""; my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }});

@ -3,7 +3,7 @@
%define anvilgroup admin %define anvilgroup admin
Name: anvil Name: anvil
Version: 3.0 Version: 3.0
Release: 28%{?dist} Release: 29%{?dist}
Summary: Alteeve Anvil! complete package. Summary: Alteeve Anvil! complete package.
License: GPLv2+ License: GPLv2+
@ -287,6 +287,9 @@ firewall-cmd --add-service=postgresql --permanent
%changelog %changelog
* tbd Madison Kelly <mkelly@alteeve.ca> 3.0-29
-
* Mon Oct 28 2019 Madison Kelly <mkelly@alteeve.ca> 3.0-28 * Mon Oct 28 2019 Madison Kelly <mkelly@alteeve.ca> 3.0-28
- Updated source - Updated source

@ -1107,6 +1107,7 @@ CREATE TABLE ip_addresses (
ip_address_gateway text not null, -- If set, this is the gateway IP for this subnet ip_address_gateway text not null, -- If set, this is the gateway IP for this subnet
ip_address_default_gateway integer not null default 0, -- If true, the gateway will be the default for the host. ip_address_default_gateway integer not null default 0, -- If true, the gateway will be the default for the host.
ip_address_dns text not null, -- If set, this is a comma-separated list of DNS IPs to use (in the order given) ip_address_dns text not null, -- If set, this is a comma-separated list of DNS IPs to use (in the order given)
ip_address_note text not null, -- Set to 'DELETED' when no longer in use.
modified_date timestamp with time zone not null, modified_date timestamp with time zone not null,
FOREIGN KEY(ip_address_host_uuid) REFERENCES hosts(host_uuid) FOREIGN KEY(ip_address_host_uuid) REFERENCES hosts(host_uuid)
@ -1124,6 +1125,7 @@ CREATE TABLE history.ip_addresses (
ip_address_gateway text, ip_address_gateway text,
ip_address_default_gateway integer, ip_address_default_gateway integer,
ip_address_dns text, ip_address_dns text,
ip_address_note text,
modified_date timestamp with time zone not null modified_date timestamp with time zone not null
); );
ALTER TABLE history.ip_addresses OWNER TO admin; ALTER TABLE history.ip_addresses OWNER TO admin;
@ -1144,6 +1146,7 @@ BEGIN
ip_address_gateway, ip_address_gateway,
ip_address_default_gateway, ip_address_default_gateway,
ip_address_dns, ip_address_dns,
ip_address_note,
modified_date) modified_date)
VALUES VALUES
(history_ip_addresses.ip_address_uuid, (history_ip_addresses.ip_address_uuid,
@ -1154,6 +1157,7 @@ BEGIN
history_ip_addresses.ip_address_subnet_mask, history_ip_addresses.ip_address_subnet_mask,
history_ip_addresses.ip_address_gateway, history_ip_addresses.ip_address_gateway,
history_ip_addresses.ip_address_default_gateway, history_ip_addresses.ip_address_default_gateway,
history_ip_addresses.ip_address_note,
history_ip_addresses.ip_address_dns, history_ip_addresses.ip_address_dns,
history_ip_addresses.modified_date); history_ip_addresses.modified_date);
RETURN NULL; RETURN NULL;

@ -82,7 +82,7 @@ foreach my $pid (sort {$a cmp $b} @{$anvil->data->{sys}{pids}})
my $body = $anvil->Storage->read_file({file => $smaps_path}); my $body = $anvil->Storage->read_file({file => $smaps_path});
foreach my $line (split/\n/, $body) foreach my $line (split/\n/, $body)
{ {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { line => $line }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }});
if ($line =~ /^Private_Dirty:\s+(\d+) (.*B)$/) if ($line =~ /^Private_Dirty:\s+(\d+) (.*B)$/)
{ {
my $size = $1; my $size = $1;

@ -743,7 +743,7 @@ WHERE
} }
# Find any IP addresses for this host. # Find any IP addresses for this host.
my $query = "SELECT ip_address_address FROM ip_addresses WHERE ip_address_host_uuid = ".$anvil->Database->quote($host_uuid).";"; my $query = "SELECT ip_address_address FROM ip_addresses WHERE ip_address_host_uuid = ".$anvil->Database->quote($host_uuid)." AND ip_address_note != 'DELETED';";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__}); my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});

@ -345,7 +345,7 @@ SELECT
FROM FROM
ip_addresses ip_addresses
WHERE WHERE
ip_address_on_type != 'DELETED' ip_address_note != 'DELETED'
AND AND
ip_address_host_uuid = ".$anvil->Database->quote($host_uuid)." ip_address_host_uuid = ".$anvil->Database->quote($host_uuid)."
;"; ;";

@ -46,7 +46,7 @@ sub update_network
my ($anvil) = @_; my ($anvil) = @_;
# Run 'ip addr' to see what IPs are in use. # Run 'ip addr' to see what IPs are in use.
$anvil->Network->get_ips(); $anvil->Network->get_ips({debug => 3});
# We'll read through '/sys/class/net' looking for network interfaces. # We'll read through '/sys/class/net' looking for network interfaces.
# * 'network::local::interface::<iface_name>::ip' - If an IP address is set # * 'network::local::interface::<iface_name>::ip' - If an IP address is set
@ -57,9 +57,10 @@ sub update_network
# We'll need to know what interfaces to remove, if any. This will store the interfaces we've seen and # We'll need to know what interfaces to remove, if any. This will store the interfaces we've seen and
# any others will be removed. # any others will be removed.
$anvil->data->{seen} = { $anvil->data->{seen} = {
interfaces => {}, interface => {},
bonds => {}, bond => {},
bridges => {}, bridge => {},
ip => {},
}; };
# Walk through the sysfs files. # Walk through the sysfs files.
@ -116,13 +117,16 @@ sub update_network
my $bridge_id = ""; my $bridge_id = "";
my $bridge_stp_enabled = ""; my $bridge_stp_enabled = "";
# Explicitly check for the existing of the hash so that we don't auto-vivivate the interface.
if (exists $anvil->data->{network}{'local'}{interface}{$interface}) if (exists $anvil->data->{network}{'local'}{interface}{$interface})
{ {
$ip_address = $anvil->data->{network}{'local'}{interface}{$interface}{ip} ? $anvil->data->{network}{'local'}{interface}{$interface}{ip} : ""; $ip_address = defined $anvil->data->{network}{'local'}{interface}{$interface}{ip} ? $anvil->data->{network}{'local'}{interface}{$interface}{ip} : "";
$subnet_mask = $anvil->data->{network}{'local'}{interface}{$interface}{subnet} ? $anvil->data->{network}{'local'}{interface}{$interface}{subnet} : ""; $subnet_mask = defined $anvil->data->{network}{'local'}{interface}{$interface}{subnet} ? $anvil->data->{network}{'local'}{interface}{$interface}{subnet} : "";
$type = defined $anvil->data->{network}{'local'}{interface}{$interface}{type} ? $anvil->data->{network}{'local'}{interface}{$interface}{type} : "interface";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
ip_address => $ip_address, ip_address => $ip_address,
subnet_mask => $subnet_mask, subnet_mask => $subnet_mask,
type => $type,
}}); }});
} }
@ -283,51 +287,57 @@ sub update_network
$anvil->data->{seen}{$type}{$interface} = 1; $anvil->data->{seen}{$type}{$interface} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "seen::${type}::${interface}" => $anvil->data->{seen}{$type}{$interface} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "seen::${type}::${interface}" => $anvil->data->{seen}{$type}{$interface} }});
# Log # Record the IP, if set.
$anvil->data->{network}{interfaces}{by_name}{$interface} = { if ($ip_address)
active_slave => $active_slave, {
bond_mode => $bond_mode, $anvil->data->{seen}{ip}{$ip_address} = $interface;
bond_master => $bond_master, $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "seen::ip::${ip_address}" => $anvil->data->{seen}{ip}{$ip_address} }});
bridge_id => $bridge_id, }
bridge_stp_enabled => $bridge_stp_enabled,
down_delay => $down_delay, # Store new information we found.
duplex => $duplex, $anvil->data->{network}{'local'}{interface}{$interface}{active_slave} = $active_slave;
ip_address => $ip_address, $anvil->data->{network}{'local'}{interface}{$interface}{bond_mode} = $bond_mode;
link_state => $link_state, $anvil->data->{network}{'local'}{interface}{$interface}{bond_master} = $bond_master;
mac_address => $mac_address, $anvil->data->{network}{'local'}{interface}{$interface}{bridge_id} = $bridge_id;
media => $media, $anvil->data->{network}{'local'}{interface}{$interface}{bridge_stp_enabled} = $bridge_stp_enabled;
mii_polling_interval => $mii_polling_interval, $anvil->data->{network}{'local'}{interface}{$interface}{down_delay} = $down_delay;
mtu => $mtu, $anvil->data->{network}{'local'}{interface}{$interface}{duplex} = $duplex;
operational => $operational, $anvil->data->{network}{'local'}{interface}{$interface}{ip} = $ip_address;
primary_reselect => $primary_reselect, $anvil->data->{network}{'local'}{interface}{$interface}{link_state} = $link_state;
primary_slave => $primary_slave, $anvil->data->{network}{'local'}{interface}{$interface}{mac_address} = $mac_address;
speed => $speed, $anvil->data->{network}{'local'}{interface}{$interface}{media} = $media;
subnet_mask => $subnet_mask, $anvil->data->{network}{'local'}{interface}{$interface}{mii_polling_interval} = $mii_polling_interval;
type => $type, $anvil->data->{network}{'local'}{interface}{$interface}{mtu} = $mtu;
up_delay => $up_delay, $anvil->data->{network}{'local'}{interface}{$interface}{operational} = $operational;
}; $anvil->data->{network}{'local'}{interface}{$interface}{primary_reselect} = $primary_reselect;
$anvil->data->{network}{'local'}{interface}{$interface}{primary_slave} = $primary_slave;
$anvil->data->{network}{'local'}{interface}{$interface}{speed} = $speed;
$anvil->data->{network}{'local'}{interface}{$interface}{subnet} = $subnet_mask;
$anvil->data->{network}{'local'}{interface}{$interface}{type} = $type;
$anvil->data->{network}{'local'}{interface}{$interface}{up_delay} = $up_delay;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"network::interfaces::by_name::${interface}::active_slave" => $anvil->data->{network}{interfaces}{by_name}{$interface}{active_slave}, "network::local::interface::${interface}::active_slave" => $anvil->data->{network}{'local'}{interface}{$interface}{active_slave},
"network::interfaces::by_name::${interface}::bond_mode" => $anvil->data->{network}{interfaces}{by_name}{$interface}{bond_mode}, "network::local::interface::${interface}::bond_mode" => $anvil->data->{network}{'local'}{interface}{$interface}{bond_mode},
"network::interfaces::by_name::${interface}::bond_master" => $anvil->data->{network}{interfaces}{by_name}{$interface}{bond_master}, "network::local::interface::${interface}::bond_master" => $anvil->data->{network}{'local'}{interface}{$interface}{bond_master},
"network::interfaces::by_name::${interface}::bridge_id" => $anvil->data->{network}{interfaces}{by_name}{$interface}{bridge_id}, "network::local::interface::${interface}::bridge_id" => $anvil->data->{network}{'local'}{interface}{$interface}{bridge_id},
"network::interfaces::by_name::${interface}::bridge_stp_enabled" => $anvil->data->{network}{interfaces}{by_name}{$interface}{bridge_stp_enabled}, "network::local::interface::${interface}::bridge_stp_enabled" => $anvil->data->{network}{'local'}{interface}{$interface}{bridge_stp_enabled},
"network::interfaces::by_name::${interface}::down_delay" => $anvil->data->{network}{interfaces}{by_name}{$interface}{down_delay}, "network::local::interface::${interface}::down_delay" => $anvil->data->{network}{'local'}{interface}{$interface}{down_delay},
"network::interfaces::by_name::${interface}::duplex" => $anvil->data->{network}{interfaces}{by_name}{$interface}{duplex}, "network::local::interface::${interface}::duplex" => $anvil->data->{network}{'local'}{interface}{$interface}{duplex},
"network::interfaces::by_name::${interface}::ip_address" => $anvil->data->{network}{interfaces}{by_name}{$interface}{ip_address}, "network::local::interface::${interface}::ip" => $anvil->data->{network}{'local'}{interface}{$interface}{ip},
"network::interfaces::by_name::${interface}::link_state" => $anvil->data->{network}{interfaces}{by_name}{$interface}{link_state}, "network::local::interface::${interface}::link_state" => $anvil->data->{network}{'local'}{interface}{$interface}{link_state},
"network::interfaces::by_name::${interface}::mac_address" => $anvil->data->{network}{interfaces}{by_name}{$interface}{mac_address}, "network::local::interface::${interface}::mac" => $anvil->data->{network}{'local'}{interface}{$interface}{mac},
"network::interfaces::by_name::${interface}::media" => $anvil->data->{network}{interfaces}{by_name}{$interface}{media}, "network::local::interface::${interface}::media" => $anvil->data->{network}{'local'}{interface}{$interface}{media},
"network::interfaces::by_name::${interface}::mii_polling_interval" => $anvil->data->{network}{interfaces}{by_name}{$interface}{mii_polling_interval}, "network::local::interface::${interface}::mii_polling_interval" => $anvil->data->{network}{'local'}{interface}{$interface}{mii_polling_interval},
"network::interfaces::by_name::${interface}::mtu" => $anvil->data->{network}{interfaces}{by_name}{$interface}{mtu}, "network::local::interface::${interface}::mtu" => $anvil->data->{network}{'local'}{interface}{$interface}{mtu},
"network::interfaces::by_name::${interface}::operational" => $anvil->data->{network}{interfaces}{by_name}{$interface}{operational}, "network::local::interface::${interface}::operational" => $anvil->data->{network}{'local'}{interface}{$interface}{operational},
"network::interfaces::by_name::${interface}::primary_reselect" => $anvil->data->{network}{interfaces}{by_name}{$interface}{primary_reselect}, "network::local::interface::${interface}::primary_reselect" => $anvil->data->{network}{'local'}{interface}{$interface}{primary_reselect},
"network::interfaces::by_name::${interface}::primary_slave" => $anvil->data->{network}{interfaces}{by_name}{$interface}{primary_slave}, "network::local::interface::${interface}::primary_slave" => $anvil->data->{network}{'local'}{interface}{$interface}{primary_slave},
"network::interfaces::by_name::${interface}::speed" => $anvil->data->{network}{interfaces}{by_name}{$interface}{speed}, "network::local::interface::${interface}::speed" => $anvil->data->{network}{'local'}{interface}{$interface}{speed},
"network::interfaces::by_name::${interface}::subnet_mask" => $anvil->data->{network}{interfaces}{by_name}{$interface}{subnet_mask}, "network::local::interface::${interface}::subnet" => $anvil->data->{network}{'local'}{interface}{$interface}{subnet},
"network::interfaces::by_name::${interface}::type" => $anvil->data->{network}{interfaces}{by_name}{$interface}{type}, "network::local::interface::${interface}::type" => $anvil->data->{network}{'local'}{interface}{$interface}{type},
"network::interfaces::by_name::${interface}::up_delay" => $anvil->data->{network}{interfaces}{by_name}{$interface}{up_delay}, "network::local::interface::${interface}::up_delay" => $anvil->data->{network}{'local'}{interface}{$interface}{up_delay},
}}); }});
} }
} }
closedir(DIRECTORY); closedir(DIRECTORY);
@ -336,36 +346,37 @@ sub update_network
foreach my $processing ("bond", "interface", "bridge") foreach my $processing ("bond", "interface", "bridge")
{ {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { processing => $processing }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { processing => $processing }});
foreach my $interface (sort {$a cmp $b} keys %{$anvil->data->{network}{interfaces}{by_name}}) foreach my $interface (sort {$a cmp $b} keys %{$anvil->data->{network}{'local'}{interface}})
{ {
# Skip if this isn't the device type we're working on. # Skip if this isn't the device type we're working on.
my $type = $anvil->data->{network}{interfaces}{by_name}{$interface}{type}; next if not defined $anvil->data->{network}{'local'}{interface}{$interface}{type};
my $type = $anvil->data->{network}{'local'}{interface}{$interface}{type};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:interface' => $interface, 's1:interface' => $interface,
's2:type' => $type, 's2:type' => $type,
's3:processing' => $processing, 's3:processing' => $processing,
}}); }});
next if $processing ne $anvil->data->{network}{interfaces}{by_name}{$interface}{type}; next if $processing ne $anvil->data->{network}{'local'}{interface}{$interface}{type};
my $active_slave = $anvil->data->{network}{interfaces}{by_name}{$interface}{active_slave}; my $active_slave = $anvil->data->{network}{'local'}{interface}{$interface}{active_slave};
my $bond_mode = $anvil->data->{network}{interfaces}{by_name}{$interface}{bond_mode}; my $bond_mode = $anvil->data->{network}{'local'}{interface}{$interface}{bond_mode};
my $bond_master = $anvil->data->{network}{interfaces}{by_name}{$interface}{bond_master}; my $bond_master = $anvil->data->{network}{'local'}{interface}{$interface}{bond_master};
my $bridge_id = $anvil->data->{network}{interfaces}{by_name}{$interface}{bridge_id}; my $bridge_id = $anvil->data->{network}{'local'}{interface}{$interface}{bridge_id};
my $bridge_stp_enabled = $anvil->data->{network}{interfaces}{by_name}{$interface}{bridge_stp_enabled}; my $bridge_stp_enabled = $anvil->data->{network}{'local'}{interface}{$interface}{bridge_stp_enabled};
my $down_delay = $anvil->data->{network}{interfaces}{by_name}{$interface}{down_delay}; my $down_delay = $anvil->data->{network}{'local'}{interface}{$interface}{down_delay};
my $duplex = $anvil->data->{network}{interfaces}{by_name}{$interface}{duplex}; my $duplex = $anvil->data->{network}{'local'}{interface}{$interface}{duplex};
my $ip_address = $anvil->data->{network}{interfaces}{by_name}{$interface}{ip_address}; my $ip_address = $anvil->data->{network}{'local'}{interface}{$interface}{ip};
my $link_state = $anvil->data->{network}{interfaces}{by_name}{$interface}{link_state}; my $link_state = $anvil->data->{network}{'local'}{interface}{$interface}{link_state};
my $mac_address = $anvil->data->{network}{interfaces}{by_name}{$interface}{mac_address}; my $mac_address = $anvil->data->{network}{'local'}{interface}{$interface}{mac};
my $media = $anvil->data->{network}{interfaces}{by_name}{$interface}{media}; my $media = $anvil->data->{network}{'local'}{interface}{$interface}{media};
my $mii_polling_interval = $anvil->data->{network}{interfaces}{by_name}{$interface}{mii_polling_interval}; my $mii_polling_interval = $anvil->data->{network}{'local'}{interface}{$interface}{mii_polling_interval};
my $mtu = $anvil->data->{network}{interfaces}{by_name}{$interface}{mtu}; my $mtu = $anvil->data->{network}{'local'}{interface}{$interface}{mtu};
my $operational = $anvil->data->{network}{interfaces}{by_name}{$interface}{operational}; my $operational = $anvil->data->{network}{'local'}{interface}{$interface}{operational};
my $primary_reselect = $anvil->data->{network}{interfaces}{by_name}{$interface}{primary_reselect}; my $primary_reselect = $anvil->data->{network}{'local'}{interface}{$interface}{primary_reselect};
my $primary_slave = $anvil->data->{network}{interfaces}{by_name}{$interface}{primary_slave}; my $primary_slave = $anvil->data->{network}{'local'}{interface}{$interface}{primary_slave};
my $speed = $anvil->data->{network}{interfaces}{by_name}{$interface}{speed}; my $speed = $anvil->data->{network}{'local'}{interface}{$interface}{speed};
my $subnet_mask = $anvil->data->{network}{interfaces}{by_name}{$interface}{subnet_mask}; my $subnet_mask = $anvil->data->{network}{'local'}{interface}{$interface}{subnet};
my $up_delay = $anvil->data->{network}{interfaces}{by_name}{$interface}{up_delay}; my $up_delay = $anvil->data->{network}{'local'}{interface}{$interface}{up_delay};
my $default_gateway = $anvil->data->{network}{'local'}{interface}{$interface}{default_gateway}; my $default_gateway = $anvil->data->{network}{'local'}{interface}{$interface}{default_gateway};
my $gateway = $anvil->data->{network}{'local'}{interface}{$interface}{gateway}; my $gateway = $anvil->data->{network}{'local'}{interface}{$interface}{gateway};
my $dns = $anvil->data->{network}{'local'}{interface}{$interface}{dns}; my $dns = $anvil->data->{network}{'local'}{interface}{$interface}{dns};
@ -429,6 +440,7 @@ sub update_network
ip_address_gateway => $gateway, ip_address_gateway => $gateway,
ip_address_default_gateway => $default_gateway, ip_address_default_gateway => $default_gateway,
ip_address_dns => $dns, ip_address_dns => $dns,
ip_address_note => "",
}); });
} }
} }
@ -475,11 +487,11 @@ sub update_network
ip_address_gateway => $gateway, ip_address_gateway => $gateway,
ip_address_default_gateway => $default_gateway, ip_address_default_gateway => $default_gateway,
ip_address_dns => $dns, ip_address_dns => $dns,
ip_address_note => "",
}); });
} }
} }
### TODO: Left off here. Add 'insert_or_update_bridge_interfaces' and see why bridges aren't being saved.
if (($type eq $processing) && ($type eq "bridge")) if (($type eq $processing) && ($type eq "bridge"))
{ {
my $bridge_uuid = $anvil->Database->insert_or_update_bridges({ my $bridge_uuid = $anvil->Database->insert_or_update_bridges({
@ -508,6 +520,7 @@ sub update_network
ip_address_gateway => $gateway, ip_address_gateway => $gateway,
ip_address_default_gateway => $default_gateway, ip_address_default_gateway => $default_gateway,
ip_address_dns => $dns, ip_address_dns => $dns,
ip_address_note => "",
}); });
} }
} }
@ -533,7 +546,7 @@ SELECT
FROM FROM
bonds bonds
WHERE WHERE
bond_host_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)." bond_host_uuid = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid})."
AND AND
bond_mode != 'DELETED' bond_mode != 'DELETED'
;"; ;";
@ -598,7 +611,7 @@ SELECT
FROM FROM
bridges bridges
WHERE WHERE
bridge_host_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)." bridge_host_uuid = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid})."
AND AND
bridge_id != 'DELETED' bridge_id != 'DELETED'
;"; ;";
@ -660,7 +673,7 @@ SELECT
FROM FROM
network_interfaces network_interfaces
WHERE WHERE
network_interface_host_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)." network_interface_host_uuid = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid})."
AND AND
network_interface_operational != 'DELETED' network_interface_operational != 'DELETED'
ORDER BY ORDER BY
@ -755,13 +768,12 @@ SELECT
ip_address_subnet_mask, ip_address_subnet_mask,
ip_address_gateway, ip_address_gateway,
ip_address_default_gateway, ip_address_default_gateway,
ip_address_dns ip_address_dns,
ip_address_note
FROM FROM
ip_addresses ip_addresses
WHERE WHERE
ip_address_host_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)." ip_address_host_uuid = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid})."
AND
ip_address_on_type != 'DELETED'
;"; ;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0124", variables => { query => $query }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0124", variables => { query => $query }});
$results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__}); $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
@ -780,6 +792,7 @@ WHERE
my $ip_address_gateway = $row->[5]; my $ip_address_gateway = $row->[5];
my $ip_address_default_gateway = $row->[6]; my $ip_address_default_gateway = $row->[6];
my $ip_address_dns = $row->[7]; my $ip_address_dns = $row->[7];
my $ip_address_note = $row->[8];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
ip_address_on_type => $ip_address_on_type, ip_address_on_type => $ip_address_on_type,
ip_address_on_uuid => $ip_address_on_uuid, ip_address_on_uuid => $ip_address_on_uuid,
@ -788,28 +801,21 @@ WHERE
ip_address_gateway => $ip_address_gateway, ip_address_gateway => $ip_address_gateway,
ip_address_default_gateway => $ip_address_default_gateway, ip_address_default_gateway => $ip_address_default_gateway,
ip_address_dns => $ip_address_dns, ip_address_dns => $ip_address_dns,
ip_address_note => $ip_address_note,
}}); }});
# Did we see this IP on this scan? If not, set on_type to DELETEd. if ((not exists $anvil->data->{seen}{ip}{$ip_address_address}) or (not $anvil->data->{seen}{ip}{$ip_address_address}))
my $found = 0;
foreach my $interface (sort {$a cmp $b} keys %{$anvil->data->{network}{'local'}{interface}})
{ {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { # This IP address no longer exists on this host, removing it.
interface => $interface, my $ip_address_uuid = $anvil->Database->insert_or_update_ip_addresses({
ip_address_address => $ip_address_address, file => $THIS_FILE,
"network::local::interface::${interface}::ip" => $anvil->data->{network}{'local'}{interface}{$interface}{ip}, line => __LINE__,
}}); 'delete' => 1,
if ((defined $anvil->data->{network}{'local'}{interface}{$interface}{ip}) && ($anvil->data->{network}{'local'}{interface}{$interface}{ip} eq $ip_address_address)) ip_address_uuid => $ip_address_uuid,
{ });
$found = 1; next;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { found => $found }});
last;
}
} }
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { found => $found }});
if ($found)
{
my $say_on = ""; my $say_on = "";
if ($ip_address_on_type eq "interface") if ($ip_address_on_type eq "interface")
{ {
@ -830,13 +836,6 @@ WHERE
$network_json .= " { \"address\":\"$ip_address_address\", \"on\":\"$say_on\", \"subnet\":\"$ip_address_subnet_mask\", \"gateway\":\"$ip_address_gateway\", \"default_gateway\":\"$ip_address_default_gateway\", \"dns\":\"$ip_address_dns\" },\n"; $network_json .= " { \"address\":\"$ip_address_address\", \"on\":\"$say_on\", \"subnet\":\"$ip_address_subnet_mask\", \"gateway\":\"$ip_address_gateway\", \"default_gateway\":\"$ip_address_default_gateway\", \"dns\":\"$ip_address_dns\" },\n";
$network_xml .= " <ip address=\"$ip_address_address\" on=\"$say_on\" subnet=\"$ip_address_subnet_mask\" gateway=\"$ip_address_gateway\" default_gateway=\"$ip_address_default_gateway\" dns=\"$ip_address_dns\" />\n"; $network_xml .= " <ip address=\"$ip_address_address\" on=\"$say_on\" subnet=\"$ip_address_subnet_mask\" gateway=\"$ip_address_gateway\" default_gateway=\"$ip_address_default_gateway\" dns=\"$ip_address_dns\" />\n";
} }
else
{
# Stale, mark it as deleted.
my $query = "UPDATE ip_addresses SET ip_address_on_type = 'DELETED' WHERE ip_address_uuid = ".$anvil->Database->quote($ip_address_uuid).";";
$anvil->Database->write({debug => 2, query => $query, source => $THIS_FILE, line => __LINE__});
}
}
# Now record the interfaces on bridges. # Now record the interfaces on bridges.
$anvil->Network->bridge_info({debug => 2}); $anvil->Network->bridge_info({debug => 2});

Loading…
Cancel
Save