@ -20,10 +20,11 @@ if (($running_directory =~ /^\./) && ($ENV{PWD}))
my $anvil = Anvil::Tools->new();
my $anvil = Anvil::Tools->new();
$anvil->Log->level({set => 2});
$anvil->Log->level({set => 2});
$anvil->Log->secure({set => 0});
$anvil->Log->secure({set => 0});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3 , secure => 0, key => "log_0115", variables => { program => $THIS_FILE }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2 , secure => 0, key => "log_0115", variables => { program => $THIS_FILE }});
$anvil->Database->connect;
$anvil->Database->connect({debug => 3});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"});
die;
if (not $anvil->data->{sys}{database}{connections})
if (not $anvil->data->{sys}{database}{connections})
{
{
# No databases, exit.
# No databases, exit.
@ -52,7 +53,7 @@ sub update_network
# * 'network::local::interface::<iface_name>::ip' - If an IP address is set
# * 'network::local::interface::<iface_name>::ip' - If an IP address is set
# * 'network::local::interface::<iface_name>::subnet' - If an IP is set
# * 'network::local::interface::<iface_name>::subnet' - If an IP is set
my $directory = "/sys/class/net";
my $directory = "/sys/class/net";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { directory => $directory }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { directory => $directory }});
# 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.
@ -64,7 +65,7 @@ sub update_network
# Walk through the sysfs files.
# Walk through the sysfs files.
local(*DIRECTORY);
local(*DIRECTORY);
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3 , key => "log_0018", variables => { directory => $directory }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2 , key => "log_0018", variables => { directory => $directory }});
opendir(DIRECTORY, $directory);
opendir(DIRECTORY, $directory);
while(my $file = readdir(DIRECTORY))
while(my $file = readdir(DIRECTORY))
{
{
@ -73,7 +74,7 @@ sub update_network
next if $file eq "lo";
next if $file eq "lo";
next if $file =~ /virbr\d/;
next if $file =~ /virbr\d/;
my $full_path = "$directory/$file";
my $full_path = "$directory/$file";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { full_path => $full_path }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { full_path => $full_path }});
if (-d $full_path)
if (-d $full_path)
{
{
# Pull out the data I want. Note that some of these don't exist with virtio-net interfaces.
# Pull out the data I want. Note that some of these don't exist with virtio-net interfaces.
@ -94,7 +95,7 @@ sub update_network
$duplex =~ s/\n$//;
$duplex =~ s/\n$//;
$operational =~ s/\n$//;
$operational =~ s/\n$//;
$speed =~ s/\n$//;
$speed =~ s/\n$//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => {
interface => $interface,
interface => $interface,
speed => $speed,
speed => $speed,
mac_address => $mac_address,
mac_address => $mac_address,
@ -120,7 +121,7 @@ sub update_network
{
{
$ip_address = $anvil->data->{network}{'local'}{interface}{$interface}{ip} ? $anvil->data->{network}{'local'}{interface}{$interface}{ip} : "";
$ip_address = $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 = $anvil->data->{network}{'local'}{interface}{$interface}{subnet} ? $anvil->data->{network}{'local'}{interface}{$interface}{subnet} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , 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,
}});
}});
@ -134,7 +135,7 @@ sub update_network
# It's a slave.
# It's a slave.
$mac_address = $anvil->Storage->read_file({file => $mac_bond_file});
$mac_address = $anvil->Storage->read_file({file => $mac_bond_file});
$mac_address =~ s/\n$//;
$mac_address =~ s/\n$//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { mac_address => $mac_address }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { mac_address => $mac_address }});
}
}
# If this is a virtual interface, set some fake values that don't actually exist on
# If this is a virtual interface, set some fake values that don't actually exist on
@ -145,7 +146,7 @@ sub update_network
# Speed is "as fast as possible", so we'll record 100 Gbps, but that is really kind of arbitrary.
# Speed is "as fast as possible", so we'll record 100 Gbps, but that is really kind of arbitrary.
$speed = 100000 if ((not $speed) or ($speed eq "-1"));
$speed = 100000 if ((not $speed) or ($speed eq "-1"));
$duplex = "full" if not $duplex;
$duplex = "full" if not $duplex;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => {
speed => $speed,
speed => $speed,
duplex => $duplex,
duplex => $duplex,
}});
}});
@ -154,7 +155,7 @@ sub update_network
if (not $link_state)
if (not $link_state)
{
{
$speed = 0;
$speed = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { speed => $speed }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { speed => $speed }});
}
}
# Is this a bond interface?
# Is this a bond interface?
@ -181,7 +182,7 @@ sub update_network
$mii_polling_interval =~ s/\n$//;
$mii_polling_interval =~ s/\n$//;
$up_delay =~ s/\n$//;
$up_delay =~ s/\n$//;
$down_delay =~ s/\n$//;
$down_delay =~ s/\n$//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => {
active_slave => $active_slave,
active_slave => $active_slave,
bond_mode => $bond_mode,
bond_mode => $bond_mode,
mii_polling_interval => $mii_polling_interval,
mii_polling_interval => $mii_polling_interval,
@ -208,7 +209,7 @@ sub update_network
$bridge_stp_enabled = $anvil->Storage->read_file({debug => 3, file => $full_path."/bridge/stp_state"});
$bridge_stp_enabled = $anvil->Storage->read_file({debug => 3, file => $full_path."/bridge/stp_state"});
$bridge_id =~ s/\n$//;
$bridge_id =~ s/\n$//;
$bridge_stp_enabled =~ s/\n$//;
$bridge_stp_enabled =~ s/\n$//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => {
bridge_id => $bridge_id,
bridge_id => $bridge_id,
bridge_stp_enabled => $bridge_stp_enabled,
bridge_stp_enabled => $bridge_stp_enabled,
type => $type,
type => $type,
@ -225,10 +226,10 @@ sub update_network
{
{
$bridge_stp_enabled = "enabled_userland";
$bridge_stp_enabled = "enabled_userland";
}
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { bridge_stp_enabled => $bridge_stp_enabled }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { bridge_stp_enabled => $bridge_stp_enabled }});
}
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => {
active_slave => $active_slave,
active_slave => $active_slave,
bond_master => $bond_master,
bond_master => $bond_master,
bond_mode => $bond_mode,
bond_mode => $bond_mode,
@ -263,14 +264,14 @@ sub update_network
# NOTE: This is probably 0 now... Though someday >100 Gbps will be reasonable
# NOTE: This is probably 0 now... Though someday >100 Gbps will be reasonable
# and we'll need to change this.
# and we'll need to change this.
$speed = 0;
$speed = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { speed => $speed }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { speed => $speed }});
}
}
# Find the media, if possible.
# Find the media, if possible.
my ($ethtool, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{ethtool}." $interface"});
my ($ethtool, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{ethtool}." $interface"});
foreach my $line (split/\n/, $ethtool)
foreach my $line (split/\n/, $ethtool)
{
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { line => $line }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { line => $line }});
if ($line =~ /Supported ports: \[ (.*?) \]/i)
if ($line =~ /Supported ports: \[ (.*?) \]/i)
{
{
$media = lc($1);
$media = lc($1);
@ -306,7 +307,7 @@ sub update_network
type => $type,
type => $type,
up_delay => $up_delay,
up_delay => $up_delay,
};
};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , 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::interfaces::by_name::${interface}::active_slave" => $anvil->data->{network}{interfaces}{by_name}{$interface}{active_slave},
"network::interfaces::by_name::${interface}::bond_mode" => $anvil->data->{network}{interfaces}{by_name}{$interface}{bond_mode},
"network::interfaces::by_name::${interface}::bond_mode" => $anvil->data->{network}{interfaces}{by_name}{$interface}{bond_mode},
"network::interfaces::by_name::${interface}::bond_master" => $anvil->data->{network}{interfaces}{by_name}{$interface}{bond_master},
"network::interfaces::by_name::${interface}::bond_master" => $anvil->data->{network}{interfaces}{by_name}{$interface}{bond_master},
@ -369,7 +370,7 @@ sub update_network
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};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => {
active_slave => $active_slave,
active_slave => $active_slave,
bond_mode => $bond_mode,
bond_mode => $bond_mode,
bond_master => $bond_master,
bond_master => $bond_master,
@ -537,10 +538,10 @@ WHERE
AND
AND
bond_mode != 'DELETED'
bond_mode != 'DELETED'
;";
;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3 , key => "log_0124", variables => { query => $query }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2 , key => "log_0124", variables => { 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__});
my $count = @{$results};
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,
results => $results,
count => $count,
count => $count,
}});
}});
@ -561,7 +562,7 @@ AND
bond_mac_address => $row->[10],
bond_mac_address => $row->[10],
bond_operational => $row->[11],
bond_operational => $row->[11],
};
};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => {
"bonds::${bond_uuid}::bond_name" => $anvil->data->{bonds}{$bond_uuid}{bond_name},
"bonds::${bond_uuid}::bond_name" => $anvil->data->{bonds}{$bond_uuid}{bond_name},
"bonds::${bond_uuid}::bond_mode" => $anvil->data->{bonds}{$bond_uuid}{bond_mode},
"bonds::${bond_uuid}::bond_mode" => $anvil->data->{bonds}{$bond_uuid}{bond_mode},
"bonds::${bond_uuid}::bond_mtu" => $anvil->data->{bonds}{$bond_uuid}{bond_mtu},
"bonds::${bond_uuid}::bond_mtu" => $anvil->data->{bonds}{$bond_uuid}{bond_mtu},
@ -602,10 +603,10 @@ WHERE
AND
AND
bridge_id != 'DELETED'
bridge_id != 'DELETED'
;";
;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3 , 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__});
$count = @{$results};
$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,
results => $results,
count => $count,
count => $count,
}});
}});
@ -624,7 +625,7 @@ AND
bridge_mtu => $bridge_mtu,
bridge_mtu => $bridge_mtu,
bridge_stp_enabled => $bridge_stp_enabled,
bridge_stp_enabled => $bridge_stp_enabled,
};
};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => {
"bridges::${bridge_uuid}::bridge_name" => $anvil->data->{bridges}{$bridge_uuid}{bridge_name},
"bridges::${bridge_uuid}::bridge_name" => $anvil->data->{bridges}{$bridge_uuid}{bridge_name},
"bridges::${bridge_uuid}::bridge_id" => $anvil->data->{bridges}{$bridge_uuid}{bridge_id},
"bridges::${bridge_uuid}::bridge_id" => $anvil->data->{bridges}{$bridge_uuid}{bridge_id},
"bridges::${bridge_uuid}::bridge_mac" => $anvil->data->{bridges}{$bridge_uuid}{bridge_mac},
"bridges::${bridge_uuid}::bridge_mac" => $anvil->data->{bridges}{$bridge_uuid}{bridge_mac},
@ -666,10 +667,10 @@ AND
ORDER BY
ORDER BY
modified_date DESC
modified_date DESC
;";
;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3 , 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__});
$count = @{$results};
$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,
results => $results,
count => $count,
count => $count,
}});
}});
@ -695,7 +696,7 @@ ORDER BY
network_interface_bond_uuid => defined $row->[9] ? $row->[9] : 'NULL',
network_interface_bond_uuid => defined $row->[9] ? $row->[9] : 'NULL',
network_interface_bridge_uuid => defined $row->[10] ? $row->[10] : 'NULL',
network_interface_bridge_uuid => defined $row->[10] ? $row->[10] : 'NULL',
};
};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => {
"network_interfaces::${network_interface_uuid}::network_interface_mac_address" => $anvil->data->{network_interfaces}{$network_interface_uuid}{network_interface_mac_address},
"network_interfaces::${network_interface_uuid}::network_interface_mac_address" => $anvil->data->{network_interfaces}{$network_interface_uuid}{network_interface_mac_address},
"network_interfaces::${network_interface_uuid}::network_interface_name" => $anvil->data->{network_interfaces}{$network_interface_uuid}{network_interface_name},
"network_interfaces::${network_interface_uuid}::network_interface_name" => $anvil->data->{network_interfaces}{$network_interface_uuid}{network_interface_name},
"network_interfaces::${network_interface_uuid}::network_interface_speed" => $anvil->data->{network_interfaces}{$network_interface_uuid}{network_interface_speed},
"network_interfaces::${network_interface_uuid}::network_interface_speed" => $anvil->data->{network_interfaces}{$network_interface_uuid}{network_interface_speed},
@ -763,10 +764,10 @@ WHERE
AND
AND
ip_address_on_type != 'DELETED'
ip_address_on_type != 'DELETED'
;";
;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3 , 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__});
$count = @{$results};
$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,
results => $results,
count => $count,
count => $count,
}});
}});
@ -780,7 +781,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];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , 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,
ip_address_address => $ip_address_address,
ip_address_address => $ip_address_address,
@ -794,7 +795,7 @@ WHERE
my $found = 0;
my $found = 0;
foreach my $interface (sort {$a cmp $b} keys %{$anvil->data->{network}{'local'}{interface}})
foreach my $interface (sort {$a cmp $b} keys %{$anvil->data->{network}{'local'}{interface}})
{
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => {
interface => $interface,
interface => $interface,
ip_address_address => $ip_address_address,
ip_address_address => $ip_address_address,
"network::local::interface::${interface}::ip" => $anvil->data->{network}{'local'}{interface}{$interface}{ip},
"network::local::interface::${interface}::ip" => $anvil->data->{network}{'local'}{interface}{$interface}{ip},
@ -802,29 +803,29 @@ WHERE
if ((defined $anvil->data->{network}{'local'}{interface}{$interface}{ip}) && ($anvil->data->{network}{'local'}{interface}{$interface}{ip} eq $ip_address_address))
if ((defined $anvil->data->{network}{'local'}{interface}{$interface}{ip}) && ($anvil->data->{network}{'local'}{interface}{$interface}{ip} eq $ip_address_address))
{
{
$found = 1;
$found = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { found => $found }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { found => $found }});
last;
last;
}
}
}
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { found => $found }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { found => $found }});
if ($found)
if ($found)
{
{
my $say_on = "";
my $say_on = "";
if ($ip_address_on_type eq "interface")
if ($ip_address_on_type eq "interface")
{
{
$say_on = $anvil->data->{network_interfaces}{$ip_address_on_uuid}{network_interface_name};
$say_on = $anvil->data->{network_interfaces}{$ip_address_on_uuid}{network_interface_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { say_on => $say_on }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { say_on => $say_on }});
}
}
elsif ($ip_address_on_type eq "bond")
elsif ($ip_address_on_type eq "bond")
{
{
$say_on = $anvil->data->{bonds}{$ip_address_on_uuid}{bond_name};
$say_on = $anvil->data->{bonds}{$ip_address_on_uuid}{bond_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { say_on => $say_on }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { say_on => $say_on }});
}
}
elsif ($ip_address_on_type eq "bridge")
elsif ($ip_address_on_type eq "bridge")
{
{
$say_on = $anvil->data->{bridges}{$ip_address_on_uuid}{bridge_name};
$say_on = $anvil->data->{bridges}{$ip_address_on_uuid}{bridge_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { say_on => $say_on }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { say_on => $say_on }});
}
}
$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";
@ -869,18 +870,16 @@ WHERE
}
}
}
}
die;
$network_json =~ s/,$//s;
$network_json =~ s/,$//s;
$network_json .= "]}\n";
$network_json .= "]}\n";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { network_json => $network_json }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { network_json => $network_json }});
$network_xml .= "</network>\n";
$network_xml .= "</network>\n";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { network_xml => $network_xml }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { network_xml => $network_xml }});
# Write the JSON file.
# Write the JSON file.
my $output_json = $anvil->data->{path}{directories}{html}."/status/network.json";
my $output_json = $anvil->data->{path}{directories}{html}."/status/network.json";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { output_xml => $output_json }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { output_xml => $output_json }});
$anvil->Storage->write_file({
$anvil->Storage->write_file({
file => $output_json,
file => $output_json,
body => $network_json,
body => $network_json,
@ -892,7 +891,7 @@ WHERE
# Write the XML file.
# Write the XML file.
my $output_xml = $anvil->data->{path}{directories}{html}."/status/network.xml";
my $output_xml = $anvil->data->{path}{directories}{html}."/status/network.xml";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3 , list => { output_xml => $output_xml }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2 , list => { output_xml => $output_xml }});
$anvil->Storage->write_file({
$anvil->Storage->write_file({
file => $output_xml,
file => $output_xml,
body => $network_xml,
body => $network_xml,