* Renamed 'primary_slave' to 'primary_interface' for the bond table.

* Got more work done on parsing the all_status.json (and fixing related bugs).

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent d5672e77eb
commit 12b0cc28f0
  1. 20
      Anvil/Tools/Database.pm
  2. 10
      Anvil/Tools/Network.pm
  3. 20
      Anvil/Tools/Striker.pm
  4. 20
      Anvil/Tools/System.pm
  5. 8
      share/anvil.sql
  6. 26
      tools/anvil-update-states

@ -2366,7 +2366,7 @@ This is the MTU for the bonded interface.
This is set to C<< up >>, C<< down >> or C<< unknown >>. It indicates whether the bond has a working slaved interface or not. This is set to C<< up >>, C<< down >> or C<< unknown >>. It indicates whether the bond has a working slaved interface or not.
=head2 bond_primary_slave (optional) =head2 bond_primary_interface (optional)
This is the primary interface name in the bond. This is the primary interface name in the bond.
@ -2409,7 +2409,7 @@ sub insert_or_update_bonds
my $bond_name = defined $parameter->{bond_name} ? $parameter->{bond_name} : ""; my $bond_name = defined $parameter->{bond_name} ? $parameter->{bond_name} : "";
my $bond_mode = defined $parameter->{bond_mode} ? $parameter->{bond_mode} : ""; my $bond_mode = defined $parameter->{bond_mode} ? $parameter->{bond_mode} : "";
my $bond_mtu = defined $parameter->{bond_mtu} ? $parameter->{bond_mtu} : ""; my $bond_mtu = defined $parameter->{bond_mtu} ? $parameter->{bond_mtu} : "";
my $bond_primary_slave = defined $parameter->{bond_primary_slave} ? $parameter->{bond_primary_slave} : ""; my $bond_primary_interface = defined $parameter->{bond_primary_interface} ? $parameter->{bond_primary_interface} : "";
my $bond_primary_reselect = defined $parameter->{bond_primary_reselect} ? $parameter->{bond_primary_reselect} : ""; my $bond_primary_reselect = defined $parameter->{bond_primary_reselect} ? $parameter->{bond_primary_reselect} : "";
my $bond_active_slave = defined $parameter->{bond_active_slave} ? $parameter->{bond_active_slave} : ""; my $bond_active_slave = defined $parameter->{bond_active_slave} ? $parameter->{bond_active_slave} : "";
my $bond_mii_polling_interval = defined $parameter->{bond_mii_polling_interval} ? $parameter->{bond_mii_polling_interval} : ""; my $bond_mii_polling_interval = defined $parameter->{bond_mii_polling_interval} ? $parameter->{bond_mii_polling_interval} : "";
@ -2426,7 +2426,7 @@ sub insert_or_update_bonds
bond_name => $bond_name, bond_name => $bond_name,
bond_mode => $bond_mode, bond_mode => $bond_mode,
bond_mtu => $bond_mtu, bond_mtu => $bond_mtu,
bond_primary_slave => $bond_primary_slave, bond_primary_interface => $bond_primary_interface,
bond_primary_reselect => $bond_primary_reselect, bond_primary_reselect => $bond_primary_reselect,
bond_active_slave => $bond_active_slave, bond_active_slave => $bond_active_slave,
bond_mii_polling_interval => $bond_mii_polling_interval, bond_mii_polling_interval => $bond_mii_polling_interval,
@ -2516,7 +2516,7 @@ INSERT INTO
bond_name, bond_name,
bond_mode, bond_mode,
bond_mtu, bond_mtu,
bond_primary_slave, bond_primary_interface,
bond_primary_reselect, bond_primary_reselect,
bond_active_slave, bond_active_slave,
bond_mii_polling_interval, bond_mii_polling_interval,
@ -2531,7 +2531,7 @@ INSERT INTO
".$anvil->Database->quote($bond_name).", ".$anvil->Database->quote($bond_name).",
".$anvil->Database->quote($bond_mode).", ".$anvil->Database->quote($bond_mode).",
".$anvil->Database->quote($bond_mtu).", ".$anvil->Database->quote($bond_mtu).",
".$anvil->Database->quote($bond_primary_slave).", ".$anvil->Database->quote($bond_primary_interface).",
".$anvil->Database->quote($bond_primary_reselect).", ".$anvil->Database->quote($bond_primary_reselect).",
".$anvil->Database->quote($bond_active_slave).", ".$anvil->Database->quote($bond_active_slave).",
".$anvil->Database->quote($bond_mii_polling_interval).", ".$anvil->Database->quote($bond_mii_polling_interval).",
@ -2554,7 +2554,7 @@ SELECT
bond_name, bond_name,
bond_mode, bond_mode,
bond_mtu, bond_mtu,
bond_primary_slave, bond_primary_interface,
bond_primary_reselect, bond_primary_reselect,
bond_active_slave, bond_active_slave,
bond_mii_polling_interval, bond_mii_polling_interval,
@ -2587,7 +2587,7 @@ WHERE
my $old_bond_name = $row->[1]; my $old_bond_name = $row->[1];
my $old_bond_mode = $row->[2]; my $old_bond_mode = $row->[2];
my $old_bond_mtu = $row->[3]; my $old_bond_mtu = $row->[3];
my $old_bond_primary_slave = $row->[4]; my $old_bond_primary_interface = $row->[4];
my $old_bond_primary_reselect = $row->[5]; my $old_bond_primary_reselect = $row->[5];
my $old_bond_active_slave = $row->[6]; my $old_bond_active_slave = $row->[6];
my $old_bond_mii_polling_interval = $row->[7]; my $old_bond_mii_polling_interval = $row->[7];
@ -2600,7 +2600,7 @@ WHERE
old_bond_name => $old_bond_name, old_bond_name => $old_bond_name,
old_bond_mode => $old_bond_mode, old_bond_mode => $old_bond_mode,
old_bond_mtu => $old_bond_mtu, old_bond_mtu => $old_bond_mtu,
old_bond_primary_slave => $old_bond_primary_slave, old_bond_primary_interface => $old_bond_primary_interface,
old_bond_primary_reselect => $old_bond_primary_reselect, old_bond_primary_reselect => $old_bond_primary_reselect,
old_bond_active_slave => $old_bond_active_slave, old_bond_active_slave => $old_bond_active_slave,
old_bond_mii_polling_interval => $old_bond_mii_polling_interval, old_bond_mii_polling_interval => $old_bond_mii_polling_interval,
@ -2615,7 +2615,7 @@ WHERE
($old_bond_name ne $bond_name) or ($old_bond_name ne $bond_name) or
($old_bond_mode ne $bond_mode) or ($old_bond_mode ne $bond_mode) or
($old_bond_mtu ne $bond_mtu) or ($old_bond_mtu ne $bond_mtu) or
($old_bond_primary_slave ne $bond_primary_slave) or ($old_bond_primary_interface ne $bond_primary_interface) or
($old_bond_primary_reselect ne $bond_primary_reselect) or ($old_bond_primary_reselect ne $bond_primary_reselect) or
($old_bond_active_slave ne $bond_active_slave) or ($old_bond_active_slave ne $bond_active_slave) or
($old_bond_mii_polling_interval ne $bond_mii_polling_interval) or ($old_bond_mii_polling_interval ne $bond_mii_polling_interval) or
@ -2633,7 +2633,7 @@ SET
bond_name = ".$anvil->Database->quote($bond_name).", bond_name = ".$anvil->Database->quote($bond_name).",
bond_mode = ".$anvil->Database->quote($bond_mode).", bond_mode = ".$anvil->Database->quote($bond_mode).",
bond_mtu = ".$anvil->Database->quote($bond_mtu).", bond_mtu = ".$anvil->Database->quote($bond_mtu).",
bond_primary_slave = ".$anvil->Database->quote($bond_primary_slave).", bond_primary_interface = ".$anvil->Database->quote($bond_primary_interface).",
bond_primary_reselect = ".$anvil->Database->quote($bond_primary_reselect).", bond_primary_reselect = ".$anvil->Database->quote($bond_primary_reselect).",
bond_active_slave = ".$anvil->Database->quote($bond_active_slave).", bond_active_slave = ".$anvil->Database->quote($bond_active_slave).",
bond_mii_polling_interval = ".$anvil->Database->quote($bond_mii_polling_interval).", bond_mii_polling_interval = ".$anvil->Database->quote($bond_mii_polling_interval).",

@ -793,7 +793,7 @@ SELECT
bond_name, bond_name,
bond_mode, bond_mode,
bond_mtu, bond_mtu,
bond_primary_slave, bond_primary_interface,
bond_primary_reselect, bond_primary_reselect,
bond_active_slave, bond_active_slave,
bond_mii_polling_interval, bond_mii_polling_interval,
@ -819,7 +819,7 @@ AND
my $bond_name = defined $row->[1] ? $row->[1] : ""; my $bond_name = defined $row->[1] ? $row->[1] : "";
my $bond_mode = defined $row->[2] ? $row->[2] : ""; my $bond_mode = defined $row->[2] ? $row->[2] : "";
my $bond_mtu = defined $row->[3] ? $row->[3] : ""; my $bond_mtu = defined $row->[3] ? $row->[3] : "";
my $bond_primary_slave = defined $row->[4] ? $row->[4] : ""; my $bond_primary_interface = defined $row->[4] ? $row->[4] : "";
my $bond_primary_reselect = defined $row->[5] ? $row->[5] : ""; my $bond_primary_reselect = defined $row->[5] ? $row->[5] : "";
my $bond_active_slave = defined $row->[6] ? $row->[6] : ""; my $bond_active_slave = defined $row->[6] ? $row->[6] : "";
my $bond_mii_polling_interval = defined $row->[7] ? $row->[7] : ""; my $bond_mii_polling_interval = defined $row->[7] ? $row->[7] : "";
@ -832,7 +832,7 @@ AND
bond_name => $bond_name, bond_name => $bond_name,
bond_mode => $bond_mode, bond_mode => $bond_mode,
bond_mtu => $bond_mtu, bond_mtu => $bond_mtu,
bond_primary_slave => $bond_primary_slave, bond_primary_interface => $bond_primary_interface,
bond_primary_reselect => $bond_primary_reselect, bond_primary_reselect => $bond_primary_reselect,
bond_active_slave => $bond_active_slave, bond_active_slave => $bond_active_slave,
bond_mii_polling_interval => $bond_mii_polling_interval, bond_mii_polling_interval => $bond_mii_polling_interval,
@ -852,7 +852,7 @@ AND
$anvil->data->{network}{$host}{interface}{$bond_name}{uuid} = $bond_uuid; $anvil->data->{network}{$host}{interface}{$bond_name}{uuid} = $bond_uuid;
$anvil->data->{network}{$host}{interface}{$bond_name}{mode} = $bond_mode; $anvil->data->{network}{$host}{interface}{$bond_name}{mode} = $bond_mode;
$anvil->data->{network}{$host}{interface}{$bond_name}{mtu} = $bond_mtu; $anvil->data->{network}{$host}{interface}{$bond_name}{mtu} = $bond_mtu;
$anvil->data->{network}{$host}{interface}{$bond_name}{primary_slave} = $bond_primary_slave; $anvil->data->{network}{$host}{interface}{$bond_name}{primary_interface} = $bond_primary_interface;
$anvil->data->{network}{$host}{interface}{$bond_name}{primary_reselect} = $bond_primary_reselect; $anvil->data->{network}{$host}{interface}{$bond_name}{primary_reselect} = $bond_primary_reselect;
$anvil->data->{network}{$host}{interface}{$bond_name}{active_slave} = $bond_active_slave; $anvil->data->{network}{$host}{interface}{$bond_name}{active_slave} = $bond_active_slave;
$anvil->data->{network}{$host}{interface}{$bond_name}{mii_polling_interval} = $bond_mii_polling_interval; $anvil->data->{network}{$host}{interface}{$bond_name}{mii_polling_interval} = $bond_mii_polling_interval;
@ -866,7 +866,7 @@ AND
"network::${host}::interface::${bond_name}::uuid" => $anvil->data->{network}{$host}{interface}{$bond_name}{uuid}, "network::${host}::interface::${bond_name}::uuid" => $anvil->data->{network}{$host}{interface}{$bond_name}{uuid},
"network::${host}::interface::${bond_name}::mode" => $anvil->data->{network}{$host}{interface}{$bond_name}{mode}, "network::${host}::interface::${bond_name}::mode" => $anvil->data->{network}{$host}{interface}{$bond_name}{mode},
"network::${host}::interface::${bond_name}::mtu" => $anvil->data->{network}{$host}{interface}{$bond_name}{mtu}, "network::${host}::interface::${bond_name}::mtu" => $anvil->data->{network}{$host}{interface}{$bond_name}{mtu},
"network::${host}::interface::${bond_name}::primary_slave" => $anvil->data->{network}{$host}{interface}{$bond_name}{primary_slave}, "network::${host}::interface::${bond_name}::primary_interface" => $anvil->data->{network}{$host}{interface}{$bond_name}{primary_interface},
"network::${host}::interface::${bond_name}::primary_reselect" => $anvil->data->{network}{$host}{interface}{$bond_name}{primary_reselect}, "network::${host}::interface::${bond_name}::primary_reselect" => $anvil->data->{network}{$host}{interface}{$bond_name}{primary_reselect},
"network::${host}::interface::${bond_name}::active_slave" => $anvil->data->{network}{$host}{interface}{$bond_name}{active_slave}, "network::${host}::interface::${bond_name}::active_slave" => $anvil->data->{network}{$host}{interface}{$bond_name}{active_slave},
"network::${host}::interface::${bond_name}::mii_polling_interval" => $anvil->data->{network}{$host}{interface}{$bond_name}{mii_polling_interval}, "network::${host}::interface::${bond_name}::mii_polling_interval" => $anvil->data->{network}{$host}{interface}{$bond_name}{mii_polling_interval},

@ -371,10 +371,10 @@ sub parse_all_status_json
"json::all_status::hosts::${host_name}::configured" => $anvil->data->{json}{all_status}{hosts}{$host_name}{configured}, "json::all_status::hosts::${host_name}::configured" => $anvil->data->{json}{all_status}{hosts}{$host_name}{configured},
"json::all_status::hosts::${host_name}::ssh_fingerprint" => $anvil->data->{json}{all_status}{hosts}{$host_name}{ssh_fingerprint}, "json::all_status::hosts::${host_name}::ssh_fingerprint" => $anvil->data->{json}{all_status}{hosts}{$host_name}{ssh_fingerprint},
}}); }});
print "Host: [".$host_name." (".$anvil->data->{json}{all_status}{hosts}{$host_name}{short_host_name}.")], Type: [".$anvil->data->{json}{all_status}{hosts}{$host_name}{type}."], Configured: [".$anvil->data->{json}{all_status}{hosts}{$host_name}{configured}."], \n"; # print "Host: [".$host_name." (".$anvil->data->{json}{all_status}{hosts}{$host_name}{short_host_name}.")], Type: [".$anvil->data->{json}{all_status}{hosts}{$host_name}{type}."], Configured: [".$anvil->data->{json}{all_status}{hosts}{$host_name}{configured}."], \n";
print " - Host UUID: ..... [".$anvil->data->{json}{all_status}{hosts}{$host_name}{host_uuid}."]\n"; # print " - Host UUID: ..... [".$anvil->data->{json}{all_status}{hosts}{$host_name}{host_uuid}."]\n";
print " - SSH Fingerprint: [".$anvil->data->{json}{all_status}{hosts}{$host_name}{ssh_fingerprint}."]\n"; # print " - SSH Fingerprint: [".$anvil->data->{json}{all_status}{hosts}{$host_name}{ssh_fingerprint}."]\n";
print Dumper @{$host_hash->{network_interfaces}}; # print Dumper @{$host_hash->{network_interfaces}};
foreach my $interface_hash (@{$host_hash->{network_interfaces}}) foreach my $interface_hash (@{$host_hash->{network_interfaces}})
{ {
my $interface_name = $interface_hash->{name}; my $interface_name = $interface_hash->{name};
@ -394,8 +394,12 @@ sub parse_all_status_json
dns => $dns, dns => $dns,
}}); }});
# This lets us easily map interface names to types.
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface_name_to_type}{$interface_name} = $interface_type;
# Record the rest of the data.
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{uuid} = $interface_hash->{uuid}; $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{uuid} = $interface_hash->{uuid};
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{mtu} = $interface_hash->{mtu}." ".$anvil->Words->string({key => "suffix_0014"}); $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{mtu} = $interface_hash->{mtu};
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{ip} = $interface_hash->{ip}; $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{ip} = $interface_hash->{ip};
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{subnet_mask} = $interface_hash->{subnet_mask}; $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{subnet_mask} = $interface_hash->{subnet_mask};
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{default_gateway} = $interface_hash->{default_gateway}; $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{default_gateway} = $interface_hash->{default_gateway};
@ -411,9 +415,9 @@ sub parse_all_status_json
"json::all_status::hosts::${host_name}::network_interface::${interface_type}::${interface_name}::dns" => $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{dns}, "json::all_status::hosts::${host_name}::network_interface::${interface_type}::${interface_name}::dns" => $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{dns},
}}); }});
if ((exists $interface_hash->{connected}) && (ref($interface_hash->{connected}) eq "ARRAY")) if ((exists $interface_hash->{interfaces}) && (ref($interface_hash->{interfaces}) eq "ARRAY"))
{ {
foreach my $interface_name (sort {$a cmp $b} @{$interface_hash->{connected}}) foreach my $interface_name (sort {$a cmp $b} @{$interface_hash->{interfaces}})
{ {
# We'll sort out the types after # We'll sort out the types after
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{connected}{$interface_name}{type} = ""; $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{connected}{$interface_name}{type} = "";
@ -427,7 +431,7 @@ sub parse_all_status_json
{ {
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{mode} = $interface_hash->{mode}; $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{mode} = $interface_hash->{mode};
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{active_interface} = $interface_hash->{active_slave}; $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{active_interface} = $interface_hash->{active_slave};
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{primary_interface} = $interface_hash->{primary_slave}; $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{primary_interface} = $interface_hash->{primary_interface};
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{primary_reselect} = $interface_hash->{primary_reselect}; $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{primary_reselect} = $interface_hash->{primary_reselect};
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{up_delay} = $interface_hash->{up_delay}; $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{up_delay} = $interface_hash->{up_delay};
$anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{down_delay} = $interface_hash->{down_delay}; $anvil->data->{json}{all_status}{hosts}{$host_name}{network_interface}{$interface_type}{$interface_name}{down_delay} = $interface_hash->{down_delay};

@ -834,10 +834,7 @@ sub generate_state_json
}}); }});
$anvil->Network->load_interfces({ $anvil->Network->load_interfces({
host_uuid => $host_uuid, debug => 2,
host => $short_host_name,
});
$anvil->Network->load_interfces({
host_uuid => $host_uuid, host_uuid => $host_uuid,
host => $short_host_name, host => $short_host_name,
}); });
@ -852,9 +849,10 @@ sub generate_state_json
"s1:interface" => $interface, "s1:interface" => $interface,
"s2:mac_address" => $mac_address, "s2:mac_address" => $mac_address,
"s3:type" => $type, "s3:type" => $type,
"s4:configured" => $configured, "s4:mtu" => $mtu,
"s5:host_uuid" => $host_uuid, "s5:configured" => $configured,
"s6:host_key" => $host_key, "s6:host_uuid" => $host_uuid,
"s7:host_key" => $host_key,
}}); }});
$iface_hash->{name} = $interface; $iface_hash->{name} = $interface;
$iface_hash->{type} = $type; $iface_hash->{type} = $type;
@ -863,7 +861,7 @@ sub generate_state_json
if ($type eq "bond") if ($type eq "bond")
{ {
my $mode = $anvil->data->{network}{$host}{interface}{$interface}{mode}; my $mode = $anvil->data->{network}{$host}{interface}{$interface}{mode};
my $primary_slave = $anvil->data->{network}{$host}{interface}{$interface}{primary_slave}; my $primary_interface = $anvil->data->{network}{$host}{interface}{$interface}{primary_interface};
my $primary_reselect = $anvil->data->{network}{$host}{interface}{$interface}{primary_reselect}; my $primary_reselect = $anvil->data->{network}{$host}{interface}{$interface}{primary_reselect};
my $active_slave = $anvil->data->{network}{$host}{interface}{$interface}{active_slave}; my $active_slave = $anvil->data->{network}{$host}{interface}{$interface}{active_slave};
my $mii_polling_interval = $anvil->Convert->add_commas({number => $anvil->data->{network}{$host}{interface}{$interface}{mii_polling_interval}}); my $mii_polling_interval = $anvil->Convert->add_commas({number => $anvil->data->{network}{$host}{interface}{$interface}{mii_polling_interval}});
@ -932,7 +930,7 @@ sub generate_state_json
say_mode => $say_mode, say_mode => $say_mode,
mode => $mode, mode => $mode,
active_interface => $active_slave, active_interface => $active_slave,
primary_interface => $primary_slave, primary_interface => $primary_interface,
say_primary_reselect => $say_primary_reselect, say_primary_reselect => $say_primary_reselect,
primary_reselect => $primary_reselect, primary_reselect => $primary_reselect,
say_up_delay => $up_delay, say_up_delay => $up_delay,
@ -952,7 +950,7 @@ sub generate_state_json
$iface_hash->{say_mode} = $say_mode; $iface_hash->{say_mode} = $say_mode;
$iface_hash->{mode} = $mode; $iface_hash->{mode} = $mode;
$iface_hash->{active_interface} = $active_slave; $iface_hash->{active_interface} = $active_slave;
$iface_hash->{primary_interface} = $primary_slave; $iface_hash->{primary_interface} = $primary_interface;
$iface_hash->{primary_reselect} = $primary_reselect; $iface_hash->{primary_reselect} = $primary_reselect;
$iface_hash->{say_up_delay} = $say_up_delay; $iface_hash->{say_up_delay} = $say_up_delay;
$iface_hash->{up_delay} = $up_delay; $iface_hash->{up_delay} = $up_delay;
@ -1124,6 +1122,8 @@ sub generate_state_json
}; };
} }
# Write out the JSON file.
my $json = JSON->new->utf8->encode($anvil->data->{json}{all_systems}); my $json = JSON->new->utf8->encode($anvil->data->{json}{all_systems});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { json => $json }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { json => $json }});

@ -896,7 +896,7 @@ CREATE TABLE bonds (
bond_name text not null, bond_name text not null,
bond_mode text not null, -- This is the numerical bond type (will translate to the user's language in the Anvil!) bond_mode text not null, -- This is the numerical bond type (will translate to the user's language in the Anvil!)
bond_mtu bigint not null, bond_mtu bigint not null,
bond_primary_slave text not null, bond_primary_interface text not null,
bond_primary_reselect text not null, bond_primary_reselect text not null,
bond_active_slave text not null, bond_active_slave text not null,
bond_mii_polling_interval bigint not null, bond_mii_polling_interval bigint not null,
@ -917,7 +917,7 @@ CREATE TABLE history.bonds (
bond_name text, bond_name text,
bond_mode text, bond_mode text,
bond_mtu bigint, bond_mtu bigint,
bond_primary_slave text, bond_primary_interface text,
bond_primary_reselect text, bond_primary_reselect text,
bond_active_slave text, bond_active_slave text,
bond_mii_polling_interval bigint, bond_mii_polling_interval bigint,
@ -941,7 +941,7 @@ BEGIN
bond_name, bond_name,
bond_mode, bond_mode,
bond_mtu, bond_mtu,
bond_primary_slave, bond_primary_interface,
bond_primary_reselect, bond_primary_reselect,
bond_active_slave, bond_active_slave,
bond_mii_polling_interval, bond_mii_polling_interval,
@ -956,7 +956,7 @@ BEGIN
history_bonds.bond_name, history_bonds.bond_name,
history_bonds.bond_mode, history_bonds.bond_mode,
history_bonds.bond_mtu, history_bonds.bond_mtu,
history_bonds.bond_primary_slave, history_bonds.bond_primary_interface,
history_bonds.bond_primary_reselect, history_bonds.bond_primary_reselect,
history_bonds.bond_active_slave, history_bonds.bond_active_slave,
history_bonds.bond_mii_polling_interval, history_bonds.bond_mii_polling_interval,

@ -110,7 +110,7 @@ sub update_network
my $ip_address = ""; my $ip_address = "";
my $subnet_mask = ""; my $subnet_mask = "";
my $bond_mode = ""; my $bond_mode = "";
my $primary_slave = ""; my $primary_interface = "";
my $primary_reselect = ""; my $primary_reselect = "";
my $active_slave = ""; my $active_slave = "";
my $mii_polling_interval = ""; my $mii_polling_interval = "";
@ -175,7 +175,7 @@ sub update_network
# Read the bond mode. # Read the bond mode.
$bond_mode = $anvil->Storage->read_file({file => "/sys/devices/virtual/net/".$interface."/bonding/mode"}); $bond_mode = $anvil->Storage->read_file({file => "/sys/devices/virtual/net/".$interface."/bonding/mode"});
$primary_slave = $anvil->Storage->read_file({file => "/sys/devices/virtual/net/".$interface."/bonding/primary"}); $primary_interface = $anvil->Storage->read_file({file => "/sys/devices/virtual/net/".$interface."/bonding/primary"});
$primary_reselect = $anvil->Storage->read_file({file => "/sys/devices/virtual/net/".$interface."/bonding/primary_reselect"}); $primary_reselect = $anvil->Storage->read_file({file => "/sys/devices/virtual/net/".$interface."/bonding/primary_reselect"});
$active_slave = $anvil->Storage->read_file({file => "/sys/devices/virtual/net/".$interface."/bonding/active_slave"}); $active_slave = $anvil->Storage->read_file({file => "/sys/devices/virtual/net/".$interface."/bonding/active_slave"});
$mii_polling_interval = $anvil->Storage->read_file({file => "/sys/devices/virtual/net/".$interface."/bonding/miimon"}); $mii_polling_interval = $anvil->Storage->read_file({file => "/sys/devices/virtual/net/".$interface."/bonding/miimon"});
@ -183,7 +183,7 @@ sub update_network
$down_delay = $anvil->Storage->read_file({file => "/sys/devices/virtual/net/".$interface."/bonding/downdelay"}); $down_delay = $anvil->Storage->read_file({file => "/sys/devices/virtual/net/".$interface."/bonding/downdelay"});
$bond_mode =~ s/\s.*//; $bond_mode =~ s/\s.*//;
$bond_mode =~ s/\n$//; $bond_mode =~ s/\n$//;
$primary_slave =~ s/\n$//; $primary_interface =~ s/\n$//;
$primary_reselect =~ s/\s.*//; $primary_reselect =~ s/\s.*//;
$primary_reselect =~ s/\n$//; $primary_reselect =~ s/\n$//;
$active_slave =~ s/\n$//; $active_slave =~ s/\n$//;
@ -195,7 +195,7 @@ sub update_network
bond_mode => $bond_mode, bond_mode => $bond_mode,
mii_polling_interval => $mii_polling_interval, mii_polling_interval => $mii_polling_interval,
primary_reselect => $primary_reselect, primary_reselect => $primary_reselect,
primary_slave => $primary_slave, primary_interface => $primary_interface,
type => $type, type => $type,
}}); }});
} }
@ -251,7 +251,7 @@ sub update_network
mtu => $mtu, mtu => $mtu,
operational => $operational, operational => $operational,
primary_reselect => $primary_reselect, primary_reselect => $primary_reselect,
primary_slave => $primary_slave, primary_interface => $primary_interface,
speed => $speed, speed => $speed,
subnet_mask => $subnet_mask, subnet_mask => $subnet_mask,
type => $type, type => $type,
@ -315,7 +315,7 @@ sub update_network
$anvil->data->{network}{'local'}{interface}{$interface}{mtu} = $mtu; $anvil->data->{network}{'local'}{interface}{$interface}{mtu} = $mtu;
$anvil->data->{network}{'local'}{interface}{$interface}{operational} = $operational; $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_reselect} = $primary_reselect;
$anvil->data->{network}{'local'}{interface}{$interface}{primary_slave} = $primary_slave; $anvil->data->{network}{'local'}{interface}{$interface}{primary_interface} = $primary_interface;
$anvil->data->{network}{'local'}{interface}{$interface}{speed} = $speed; $anvil->data->{network}{'local'}{interface}{$interface}{speed} = $speed;
$anvil->data->{network}{'local'}{interface}{$interface}{subnet_mask} = $subnet_mask; $anvil->data->{network}{'local'}{interface}{$interface}{subnet_mask} = $subnet_mask;
$anvil->data->{network}{'local'}{interface}{$interface}{type} = $type; $anvil->data->{network}{'local'}{interface}{$interface}{type} = $type;
@ -336,7 +336,7 @@ sub update_network
"network::local::interface::${interface}::mtu" => $anvil->data->{network}{'local'}{interface}{$interface}{mtu}, "network::local::interface::${interface}::mtu" => $anvil->data->{network}{'local'}{interface}{$interface}{mtu},
"network::local::interface::${interface}::operational" => $anvil->data->{network}{'local'}{interface}{$interface}{operational}, "network::local::interface::${interface}::operational" => $anvil->data->{network}{'local'}{interface}{$interface}{operational},
"network::local::interface::${interface}::primary_reselect" => $anvil->data->{network}{'local'}{interface}{$interface}{primary_reselect}, "network::local::interface::${interface}::primary_reselect" => $anvil->data->{network}{'local'}{interface}{$interface}{primary_reselect},
"network::local::interface::${interface}::primary_slave" => $anvil->data->{network}{'local'}{interface}{$interface}{primary_slave}, "network::local::interface::${interface}::primary_interface" => $anvil->data->{network}{'local'}{interface}{$interface}{primary_interface},
"network::local::interface::${interface}::speed" => $anvil->data->{network}{'local'}{interface}{$interface}{speed}, "network::local::interface::${interface}::speed" => $anvil->data->{network}{'local'}{interface}{$interface}{speed},
"network::local::interface::${interface}::subnet_mask" => $anvil->data->{network}{'local'}{interface}{$interface}{subnet_mask}, "network::local::interface::${interface}::subnet_mask" => $anvil->data->{network}{'local'}{interface}{$interface}{subnet_mask},
"network::local::interface::${interface}::type" => $anvil->data->{network}{'local'}{interface}{$interface}{type}, "network::local::interface::${interface}::type" => $anvil->data->{network}{'local'}{interface}{$interface}{type},
@ -378,7 +378,7 @@ sub update_network
my $mtu = $anvil->data->{network}{'local'}{interface}{$interface}{mtu}; my $mtu = $anvil->data->{network}{'local'}{interface}{$interface}{mtu};
my $operational = $anvil->data->{network}{'local'}{interface}{$interface}{operational}; my $operational = $anvil->data->{network}{'local'}{interface}{$interface}{operational};
my $primary_reselect = $anvil->data->{network}{'local'}{interface}{$interface}{primary_reselect}; my $primary_reselect = $anvil->data->{network}{'local'}{interface}{$interface}{primary_reselect};
my $primary_slave = $anvil->data->{network}{'local'}{interface}{$interface}{primary_slave}; my $primary_interface = $anvil->data->{network}{'local'}{interface}{$interface}{primary_interface};
my $speed = $anvil->data->{network}{'local'}{interface}{$interface}{speed}; my $speed = $anvil->data->{network}{'local'}{interface}{$interface}{speed};
my $subnet_mask = $anvil->data->{network}{'local'}{interface}{$interface}{subnet_mask}; my $subnet_mask = $anvil->data->{network}{'local'}{interface}{$interface}{subnet_mask};
my $up_delay = $anvil->data->{network}{'local'}{interface}{$interface}{up_delay}; my $up_delay = $anvil->data->{network}{'local'}{interface}{$interface}{up_delay};
@ -403,7 +403,7 @@ sub update_network
mtu => $mtu, mtu => $mtu,
operational => $operational, operational => $operational,
primary_reselect => $primary_reselect, primary_reselect => $primary_reselect,
primary_slave => $primary_slave, primary_interface => $primary_interface,
speed => $speed, speed => $speed,
subnet_mask => $subnet_mask, subnet_mask => $subnet_mask,
up_delay => $up_delay, up_delay => $up_delay,
@ -421,7 +421,7 @@ sub update_network
bond_link_state => $link_state, bond_link_state => $link_state,
bond_operational => $operational, bond_operational => $operational,
bond_mac_address => $mac_address, bond_mac_address => $mac_address,
bond_primary_slave => $primary_slave, bond_primary_interface => $primary_interface,
bond_primary_reselect => $primary_reselect, bond_primary_reselect => $primary_reselect,
bond_active_slave => $active_slave, bond_active_slave => $active_slave,
bond_mii_polling_interval => $mii_polling_interval, bond_mii_polling_interval => $mii_polling_interval,
@ -540,7 +540,7 @@ SELECT
bond_name, bond_name,
bond_mode, bond_mode,
bond_mtu, bond_mtu,
bond_primary_slave, bond_primary_interface,
bond_primary_reselect, bond_primary_reselect,
bond_active_slave, bond_active_slave,
bond_mii_polling_interval, bond_mii_polling_interval,
@ -570,7 +570,7 @@ AND
bond_name => $bond_name, bond_name => $bond_name,
bond_mode => $row->[2], bond_mode => $row->[2],
bond_mtu => $row->[3], bond_mtu => $row->[3],
bond_primary_slave => $row->[4], bond_primary_interface => $row->[4],
bond_primary_reselect => $row->[5], bond_primary_reselect => $row->[5],
bond_active_slave => $row->[6], bond_active_slave => $row->[6],
bond_mii_polling_interval => $row->[7], bond_mii_polling_interval => $row->[7],
@ -583,7 +583,7 @@ AND
"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},
"bonds::${bond_uuid}::bond_primary_slave" => $anvil->data->{bonds}{$bond_uuid}{bond_primary_slave}, "bonds::${bond_uuid}::bond_primary_interface" => $anvil->data->{bonds}{$bond_uuid}{bond_primary_interface},
"bonds::${bond_uuid}::bond_primary_reselect" => $anvil->data->{bonds}{$bond_uuid}{bond_primary_reselect}, "bonds::${bond_uuid}::bond_primary_reselect" => $anvil->data->{bonds}{$bond_uuid}{bond_primary_reselect},
"bonds::${bond_uuid}::bond_active_slave" => $anvil->data->{bonds}{$bond_uuid}{bond_active_slave}, "bonds::${bond_uuid}::bond_active_slave" => $anvil->data->{bonds}{$bond_uuid}{bond_active_slave},
"bonds::${bond_uuid}::bond_mii_polling_interval" => $anvil->data->{bonds}{$bond_uuid}{bond_mii_polling_interval}, "bonds::${bond_uuid}::bond_mii_polling_interval" => $anvil->data->{bonds}{$bond_uuid}{bond_mii_polling_interval},

Loading…
Cancel
Save