* Created Database->read() to store and return the handle to whichever database is used for read operations. Also created Database->quote that uses ->read to access the DBI 'quote' method more cleanly. Updated all calls to use these new methods.

* anvil-manage-files now identifies peers on the same subnet(s) and stores them in a sortable hash.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 6 years ago
parent 040f189ea6
commit 27ba3dcbb9
  1. 16
      Anvil/Tools/Account.pm
  2. 42
      Anvil/Tools/Alert.pm
  3. 691
      Anvil/Tools/Database.pm
  4. 4
      Anvil/Tools/Get.pm
  5. 10
      Anvil/Tools/Job.pm
  6. 2
      Anvil/Tools/System.pm
  7. 6
      cgi-bin/striker
  8. 8
      tools/anvil-daemon
  9. 148
      tools/anvil-manage-files
  10. 16
      tools/anvil-update-states
  11. 2
      tools/striker-configure-host
  12. 4
      tools/striker-manage-peers

@ -273,7 +273,7 @@ FROM
WHERE
user_algorithm != 'DELETED'
AND
user_name = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->data->{cgi}{username}{value})."
user_name = ".$anvil->Database->quote($anvil->data->{cgi}{username}{value})."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
@ -434,14 +434,14 @@ UPDATE
sessions
SET
session_salt = '',
modified_date = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->data->{sys}{database}{timestamp})."
modified_date = ".$anvil->Database->quote($anvil->data->{sys}{database}{timestamp})."
WHERE
session_user_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($user_uuid)." ";
session_user_uuid = ".$anvil->Database->quote($user_uuid)." ";
if ($host_uuid ne "all")
{
$query .= "
AND
session_host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($host_uuid)." ";
session_host_uuid = ".$anvil->Database->quote($host_uuid)." ";
}
$query .= "
;";
@ -535,9 +535,9 @@ SELECT
FROM
sessions
WHERE
session_user_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->data->{cookie}{anvil_user_uuid})."
session_user_uuid = ".$anvil->Database->quote($anvil->data->{cookie}{anvil_user_uuid})."
AND
session_host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
session_host_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)."
;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0124", variables => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
@ -661,7 +661,7 @@ SELECT
FROM
users
WHERE
user_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($user_uuid)."
user_uuid = ".$anvil->Database->quote($user_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
@ -784,7 +784,7 @@ SELECT
FROM
users
WHERE
user_name = ".$anvil->data->{sys}{database}{use_handle}->quote($user)."
user_name = ".$anvil->Database->quote($user)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});

@ -177,13 +177,13 @@ SELECT
FROM
alert_sent
WHERE
alert_sent_host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->data->{sys}{host_uuid})."
alert_sent_host_uuid = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid})."
AND
alert_set_by = ".$anvil->data->{sys}{database}{use_handle}->quote($set_by)."
alert_set_by = ".$anvil->Database->quote($set_by)."
AND
alert_record_locator = ".$anvil->data->{sys}{database}{use_handle}->quote($record_locator)."
alert_record_locator = ".$anvil->Database->quote($record_locator)."
AND
alert_name = ".$anvil->data->{sys}{database}{use_handle}->quote($name)."
alert_name = ".$anvil->Database->quote($name)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
@ -209,7 +209,7 @@ SELECT
FROM
hosts
WHERE
host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->data->{sys}{host_uuid})."
host_uuid = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid})."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
@ -247,12 +247,12 @@ INSERT INTO
alert_name,
modified_date
) VALUES (
".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->uuid).",
".$anvil->data->{sys}{database}{use_handle}->quote($anvil->data->{sys}{host_uuid}).",
".$anvil->data->{sys}{database}{use_handle}->quote($set_by).",
".$anvil->data->{sys}{database}{use_handle}->quote($record_locator).",
".$anvil->data->{sys}{database}{use_handle}->quote($name).",
".$anvil->data->{sys}{database}{use_handle}->quote($anvil->data->{sys}{database}{timestamp})."
".$anvil->Database->quote($anvil->Get->uuid).",
".$anvil->Database->quote($anvil->data->{sys}{host_uuid}).",
".$anvil->Database->quote($set_by).",
".$anvil->Database->quote($record_locator).",
".$anvil->Database->quote($name).",
".$anvil->Database->quote($anvil->data->{sys}{database}{timestamp})."
);
";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
@ -269,7 +269,7 @@ INSERT INTO
DELETE FROM
alert_sent
WHERE
alert_sent_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($alert_sent_uuid)."
alert_sent_uuid = ".$anvil->Database->quote($alert_sent_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
query => $query,
@ -490,15 +490,15 @@ INSERT INTO
alert_show_header,
modified_date
) VALUES (
".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->uuid()).",
".$anvil->data->{sys}{database}{use_handle}->quote($anvil->data->{sys}{host_uuid}).",
".$anvil->data->{sys}{database}{use_handle}->quote($set_by).",
".$anvil->data->{sys}{database}{use_handle}->quote($level).",
".$anvil->data->{sys}{database}{use_handle}->quote($title).",
".$anvil->data->{sys}{database}{use_handle}->quote($message).",
".$anvil->data->{sys}{database}{use_handle}->quote($sort_position).",
".$anvil->data->{sys}{database}{use_handle}->quote($show_header).",
".$anvil->data->{sys}{database}{use_handle}->quote($anvil->data->{sys}{database}{timestamp})."
".$anvil->Database->quote($anvil->Get->uuid()).",
".$anvil->Database->quote($anvil->data->{sys}{host_uuid}).",
".$anvil->Database->quote($set_by).",
".$anvil->Database->quote($level).",
".$anvil->Database->quote($title).",
".$anvil->Database->quote($message).",
".$anvil->Database->quote($sort_position).",
".$anvil->Database->quote($show_header).",
".$anvil->Database->quote($anvil->data->{sys}{database}{timestamp})."
);
";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});

File diff suppressed because it is too large Load Diff

@ -482,7 +482,7 @@ SELECT
FROM
hosts
WHERE
host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($host_uuid).";
host_uuid = ".$anvil->Database->quote($host_uuid).";
";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
@ -650,7 +650,7 @@ Parameters;
This is the IPv4 IP address being calculated.
=head3 subnet (optional)
=head3 subnet (required)
This is the subnet of the IP address being calculated.

@ -190,7 +190,7 @@ SELECT
FROM
jobs
WHERE
job_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->data->{switches}{'job-uuid'})."
job_uuid = ".$anvil->Database->quote($anvil->data->{switches}{'job-uuid'})."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { query => $query }});
@ -297,11 +297,11 @@ SELECT
FROM
jobs
WHERE
job_command LIKE ".$anvil->data->{sys}{database}{use_handle}->quote($program."%")."
job_command LIKE ".$anvil->Database->quote($program."%")."
AND
job_progress != '100'
AND
job_host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($host_uuid)."
job_host_uuid = ".$anvil->Database->quote($host_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
@ -347,7 +347,7 @@ FROM
WHERE
job_progress != '100'
AND
job_host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
job_host_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
@ -567,7 +567,7 @@ SELECT
FROM
jobs
WHERE
job_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($job_uuid)."
job_uuid = ".$anvil->Database->quote($job_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});

@ -728,6 +728,8 @@ This method checks the local system for interfaces and stores them in:
To aid in look-up by MAC address, C<< sys::mac::<mac_address>::iface >> is also set.
No parameters are accepted by this method.
=cut
sub get_ips
{

@ -1311,7 +1311,7 @@ WHERE
AND
job_progress != 100
AND
job_host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
job_host_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
@ -1371,7 +1371,7 @@ WHERE
AND
variable_source_table = 'hosts'
AND
variable_source_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
variable_source_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)."
ORDER BY
variable_name ASC;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0124", variables => { query => $query }});
@ -1521,7 +1521,7 @@ WHERE
AND
variable_source_table = 'hosts'
AND
variable_source_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
variable_source_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)."
ORDER BY
variable_name ASC;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0124", variables => { query => $query }});

@ -641,7 +641,7 @@ SELECT
FROM
hosts
WHERE
host_uuid != ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
host_uuid != ".$anvil->Database->quote($anvil->Get->host_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { query => $query }});
@ -678,7 +678,7 @@ WHERE
}
# Find any IP addresses for this host.
my $query = "SELECT ip_address_address FROM ip_addresses WHERE ip_address_host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($host_uuid).";";
my $query = "SELECT ip_address_address FROM ip_addresses WHERE ip_address_host_uuid = ".$anvil->Database->quote($host_uuid).";";
$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__});
@ -711,7 +711,7 @@ SELECT
FROM
host_keys
WHERE
host_key_host_uuid != ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
host_key_host_uuid != ".$anvil->Database->quote($anvil->Get->host_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { query => $query }});
@ -851,7 +851,7 @@ FROM
WHERE
variable_source_table = 'hosts'
AND
variable_source_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
variable_source_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)."
AND
variable_name = 'reboot::needed'
;";

@ -176,7 +176,7 @@ FROM
hosts b,
file_locations c
WHERE
b.host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->data->{sys}{host_uuid})."
b.host_uuid = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid})."
AND
a.file_uuid = c.file_location_file_uuid
AND
@ -207,7 +207,7 @@ ORDER BY
my $test_file = $file_directory."/".$file_name;
$test_file =~ s/\/\//\//g;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { test_file => $test_file }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { test_file => $test_file }});
if (not -e $test_file)
{
@ -240,7 +240,48 @@ sub find_file
my $port = "";
my $password = "";
# Find the file on any/all other hosts.
# What are my IPs?
$anvil->System->get_ips();
foreach my $interface (sort {$a cmp $b} keys %{$anvil->data->{sys}{network}{interface}})
{
next if not $anvil->data->{sys}{network}{interface}{$interface}{ip};
next if not $anvil->data->{sys}{network}{interface}{$interface}{subnet};
my $ip = $anvil->data->{sys}{network}{interface}{$interface}{ip};
my $subnet = $anvil->data->{sys}{network}{interface}{$interface}{subnet};
my $network = $anvil->Get->network({ip => $ip, subnet => $subnet});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
's1:interface' => $interface,
's2:ip' => $ip,
's3:subnet' => $subnet,
's4:network' => $network,
}});
my $type = "other";
my $sort = $interface;
if ($interface =~ /^((?:bc|s|if)n)(\d+)/)
{
$type = $1;
$sort = $2;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:type' => $type,
's2:sort' => $sort,
}});
}
$anvil->data->{local_ip}{by_network}{$network}{type} = $type;
$anvil->data->{local_ip}{by_network}{$network}{'sort'} = $sort;
$anvil->data->{local_ip}{by_network}{$network}{interface} = $interface;
$anvil->data->{local_ip}{by_network}{$network}{ip} = $ip;
$anvil->data->{local_ip}{by_network}{$network}{subnet} = $subnet;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"s1:local_ip::by_network::${network}::type" => $anvil->data->{local_ip}{by_network}{$network}{type},
"s1:local_ip::by_network::${network}::sort" => $anvil->data->{local_ip}{by_network}{$network}{'sort'},
"s2:local_ip::by_network::${network}::interface" => $anvil->data->{local_ip}{by_network}{$network}{interface},
"s3:local_ip::by_network::${network}::ip" => $anvil->data->{local_ip}{by_network}{$network}{ip},
"s4:local_ip::by_network::${network}::subnet" => $anvil->data->{local_ip}{by_network}{$network}{subnet},
}});
}
# Create a hash we can sort through that are on the same subnet as us.
my $query = "
SELECT
a.host_uuid,
@ -259,16 +300,16 @@ WHERE
AND
b.file_uuid = c.file_location_file_uuid
AND
b.file_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($file_uuid)."
b.file_uuid = ".$anvil->Database->quote($file_uuid)."
AND
a.host_uuid != ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->data->{sys}{host_uuid})."
a.host_uuid != ".$anvil->Database->quote($anvil->data->{sys}{host_uuid})."
ORDER BY
file_mtime DESC;
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { query => $query }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
results => $results,
count => $count,
}});
@ -281,7 +322,9 @@ ORDER BY
my $file_name = $row->[4];
my $file_size = $row->[5];
my $file_md5sum = $row->[6];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
my $test_file = $file_directory."/".$file_name;
$test_file =~ s/\/\//\//g;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
host_uuid => $host_uuid,
host_name => $host_name,
host_type => $host_type,
@ -289,16 +332,91 @@ ORDER BY
file_name => $file_name,
file_size => $file_size,
file_md5sum => $file_md5sum,
test_file => $test_file,
}});
my $test_file = $file_directory."/".$file_name;
$test_file =~ s/\/\//\//g;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { test_file => $test_file }});
# What IP addresses are on this machine?
my $query = "
SELECT
ip_address_address,
ip_address_subnet_mask
FROM
ip_addresses
WHERE
ip_address_on_type != 'DELETED'
AND
ip_address_host_uuid = ".$anvil->Database->quote($host_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
results => $results,
count => $count,
}});
foreach my $row (@{$results})
{
my $ip_address_address = $row->[0];
my $ip_address_subnet_mask = $row->[1];
my $network = $anvil->Get->network({ip => $ip_address_address, subnet => $ip_address_subnet_mask});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
ip_address_address => $ip_address_address,
ip_address_subnet_mask => $ip_address_subnet_mask,
network => $network,
}});
# Are we on the same subnet?
if (exists $anvil->data->{local_ip}{by_network}{$network})
{
# We're on the same subnet!
my $type = $anvil->data->{local_ip}{by_network}{$network}{type};
my $sort = $anvil->data->{local_ip}{by_network}{$network}{'sort'};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"s1:type" => $type,
"s2:sort" => $sort,
}});
# Record.
$anvil->data->{peer_ip}{$host_type}{$type}{$sort}{ip} = $ip_address_address;
$anvil->data->{peer_ip}{$host_type}{$type}{$sort}{name} = $host_name;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"s1:peer_ip::${host_type}::${type}::${sort}::name" => $anvil->data->{peer_ip}{$host_type}{$type}{$sort}{name},
"s2:peer_ip::${host_type}::${type}::${sort}::ip" => $anvil->data->{peer_ip}{$host_type}{$type}{$sort}{ip},
}});
}
}
# Can I connect to this machine?
### NOTE: Use '$anvil->Get->network({ip => "10.2.4.1", subnet => "255.255.0.0"});' with our IPs and this machines IPs to see if we're on the same subnet.
}
# Sort through what we've found.
my $file_found = 0;
foreach my $host_type (sort {$a cmp $b} keys %{$anvil->data->{peer_ip}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { host_type => $host_type }});
foreach my $type (sort {$a cmp $b} keys %{$anvil->data->{peer_ip}{$host_type}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { type => $type }});
foreach my $sort (sort {$a cmp $b} keys %{$anvil->data->{peer_ip}{$host_type}{$type}})
{
my $ip = $anvil->data->{peer_ip}{$host_type}{$type}{$sort}{ip};
my $name = $anvil->data->{peer_ip}{$host_type}{$type}{$sort}{name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:sort' => $sort,
's2:name' => $name,
's3:ip' => $ip,
}});
}
}
}
die;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
target => $target,
port => $port,
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
}});
die;
return($target, $port, $password);
}
@ -505,11 +623,11 @@ WHERE
";
if ($file_md5sum)
{
$query .= " file_md5sum = ".$anvil->data->{sys}{database}{use_handle}->quote($file_md5sum)."\n";
$query .= " file_md5sum = ".$anvil->Database->quote($file_md5sum)."\n";
}
elsif ($file_name)
{
$query .= " file_name = ".$anvil->data->{sys}{database}{use_handle}->quote($file_name)."\n";
$query .= " file_name = ".$anvil->Database->quote($file_name)."\n";
}
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
@ -603,7 +721,7 @@ SELECT
FROM
files
WHERE
file_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($file_uuid)."
file_uuid = ".$anvil->Database->quote($file_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});

@ -451,7 +451,7 @@ SELECT
FROM
bonds
WHERE
bond_host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
bond_host_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)."
AND
bond_mode != 'DELETED'
;";
@ -497,7 +497,7 @@ AND
if ((not exists $anvil->data->{seen}{bond}{$bond_name}) or (not $anvil->data->{seen}{bond}{$bond_name}))
{
# Mark it as deleted.
my $query = "UPDATE bonds SET bond_mode = 'DELETED' WHERE bond_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($bond_uuid).";";
my $query = "UPDATE bonds SET bond_mode = 'DELETED' WHERE bond_uuid = ".$anvil->Database->quote($bond_uuid).";";
$anvil->Database->write({debug => 2, query => $query, source => $THIS_FILE, line => __LINE__});
# Remove it from the hash so we don't add it to the .json and .xml files.
@ -514,7 +514,7 @@ SELECT
FROM
bridges
WHERE
bridge_host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
bridge_host_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)."
AND
bridge_id != 'DELETED'
;";
@ -544,7 +544,7 @@ AND
if ((not exists $anvil->data->{seen}{bridge}{$bridge_name}) or (not $anvil->data->{seen}{bridge}{$bridge_name}))
{
# Mark it as deleted.
my $query = "UPDATE bridges SET bridge_id = 'DELETED' WHERE bridge_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($bridge_uuid).";";
my $query = "UPDATE bridges SET bridge_id = 'DELETED' WHERE bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";
$anvil->Database->write({debug => 2, query => $query, source => $THIS_FILE, line => __LINE__});
# Remove it from the hash so we don't add it to the .json and .xml files.
@ -568,7 +568,7 @@ SELECT
FROM
network_interfaces
WHERE
network_interface_host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
network_interface_host_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)."
AND
network_interface_operational != 'DELETED'
ORDER BY
@ -621,7 +621,7 @@ ORDER BY
if ((not exists $anvil->data->{seen}{interface}{$network_interface_name}) or (not $anvil->data->{seen}{interface}{$network_interface_name}))
{
# Mark it as deleted.
my $query = "UPDATE network_interfaces SET network_interface_operational = 'DELETED' WHERE network_interface_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($network_interface_uuid).";";
my $query = "UPDATE network_interfaces SET network_interface_operational = 'DELETED' WHERE network_interface_uuid = ".$anvil->Database->quote($network_interface_uuid).";";
$anvil->Database->write({query => $query, source => $THIS_FILE, line => __LINE__});
# Remove it from the hash so we don't add it to the .json and .xml files.
@ -667,7 +667,7 @@ SELECT
FROM
ip_addresses
WHERE
ip_address_host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
ip_address_host_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)."
AND
ip_address_on_type != 'DELETED'
;";
@ -741,7 +741,7 @@ WHERE
else
{
# Stale, mark it as deleted.
my $query = "UPDATE ip_addresses SET ip_address_on_type = 'DELETED' WHERE ip_address_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($ip_address_uuid).";";
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__});
}
}

@ -802,7 +802,7 @@ LIKE
AND
variable_source_table = 'hosts'
AND
variable_source_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($anvil->Get->host_uuid)."
variable_source_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { query => $query }});

@ -226,7 +226,7 @@ sub process_entry
if ($anvil->data->{sys}{database}{connections})
{
# See if the password is in job_data.
my $query = "SELECT job_data FROM jobs WHERE job_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($job_uuid).";";
my $query = "SELECT job_data FROM jobs WHERE job_uuid = ".$anvil->Database->quote($job_uuid).";";
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
@ -575,7 +575,7 @@ sub process_entry
until($host_seen)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0212"});
my $query = "SELECT host_name FROM hosts WHERE host_uuid = ".$anvil->data->{sys}{database}{use_handle}->quote($host_uuid).";";
my $query = "SELECT host_name FROM hosts WHERE host_uuid = ".$anvil->Database->quote($host_uuid).";";
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {

Loading…
Cancel
Save