Fixed a couple bugs

* Network->collect_data() wasn't deleting old data before rescans.
* anvil-configure-host wasn't checking links that should be in a bond if
  the bond already existed.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 11 months ago
parent ebd96c7eb3
commit d7aa7966dc
  1. 5
      Anvil/Tools/Network.pm
  2. 2
      share/words.xml
  3. 47
      tools/anvil-configure-host

@ -980,6 +980,11 @@ sub collect_data
start => $start, start => $start,
}}); }});
if (exists $anvil->data->{nmcli})
{
delete $anvil->data->{nmcli};
}
# Use nmcli to collect the data. # Use nmcli to collect the data.
my $shell_call = $anvil->data->{path}{exe}{nmcli}." --get-values uuid,type,active,state,name connection show"; my $shell_call = $anvil->data->{path}{exe}{nmcli}." --get-values uuid,type,active,state,name connection show";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});

@ -3330,7 +3330,7 @@ proceeding.
<key name="message_0399"> - Connecting the interface: [#!variable!link_name!#] to the bond: [#!variable!bond_name!#].</key> <key name="message_0399"> - Connecting the interface: [#!variable!link_name!#] to the bond: [#!variable!bond_name!#].</key>
<key name="message_0400">Checking if the bridge: [#!variable!bridge_name!#] exists and that it is on: [#!variable!on_device!#]</key> <key name="message_0400">Checking if the bridge: [#!variable!bridge_name!#] exists and that it is on: [#!variable!on_device!#]</key>
<key name="message_0401">- The bridge exists!</key> <key name="message_0401">- The bridge exists!</key>
<key name="message_0402">- The IP address is on: [#!variable!current_device!#], will move the IP.</key> <key name="message_0402">- The IP address is on: [#!variable!device!#], will move the IP.</key>
<key name="message_0403"> - Resetting the device: [#!variable!device!#] (#!variable!device_uuid!#) to make sure the new config takes effect.</key> <key name="message_0403"> - Resetting the device: [#!variable!device!#] (#!variable!device_uuid!#) to make sure the new config takes effect.</key>
<key name="message_0404">- Checking that the device: [#!variable!on_device!#] is connected to this bridge.</key> <key name="message_0404">- Checking that the device: [#!variable!on_device!#] is connected to this bridge.</key>
<key name="message_0405">- The device is connected to the bridge already.</key> <key name="message_0405">- The device is connected to the bridge already.</key>

@ -944,11 +944,31 @@ sub reconfigure_bonds
# No bond on this network. # No bond on this network.
next; next;
} }
my $link_nm_uuids = [];
my $link1_name = $network_type.$i."_link1";
my $link1_mac_key = $network_type.$i."_link1_mac_to_set";
my $link1_mac = $anvil->data->{config}{$link1_mac_key};
my $link1_nm_uuid = $anvil->data->{nmcli}{mac_address}{$link1_mac}{uuid};
my $link2_name = $network_type.$i."_link2";
my $link2_mac_key = $network_type.$i."_link2_mac_to_set";
my $link2_mac = $anvil->data->{config}{$link2_mac_key};
my $link2_nm_uuid = $anvil->data->{nmcli}{mac_address}{$link2_mac}{uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"config::${bond_name}" => $anvil->data->{config}{$bond_name}, link1_name => $link1_name,
link1_mac_key => $link1_mac_key,
link1_mac => $link1_mac,
link1_nm_uuid => $link1_nm_uuid,
link2_name => $link2_name,
link2_mac_key => $link2_mac_key,
link2_mac => $link2_mac,
link2_nm_uuid => $link2_nm_uuid,
}}); }});
my $link_nm_uuids = []; # Push the two nm_uuids into the array for later checking/adding to the bond.
push @{$link_nm_uuids}, $link1_nm_uuid;
push @{$link_nm_uuids}, $link2_nm_uuid;
# Check if the bond exists or not. # Check if the bond exists or not.
$anvil->Job->update_progress({ $anvil->Job->update_progress({
@ -978,29 +998,6 @@ sub reconfigure_bonds
else else
{ {
# It doesn't, create it. # It doesn't, create it.
my $link1_name = $network_type.$i."_link1";
my $link1_mac_key = $network_type.$i."_link1_mac_to_set";
my $link1_mac = $anvil->data->{config}{$link1_mac_key};
my $link1_nm_uuid = $anvil->data->{nmcli}{mac_address}{$link1_mac}{uuid};
my $link2_name = $network_type.$i."_link2";
my $link2_mac_key = $network_type.$i."_link2_mac_to_set";
my $link2_mac = $anvil->data->{config}{$link2_mac_key};
my $link2_nm_uuid = $anvil->data->{nmcli}{mac_address}{$link2_mac}{uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
link1_name => $link1_name,
link1_mac_key => $link1_mac_key,
link1_mac => $link1_mac,
link1_nm_uuid => $link1_nm_uuid,
link2_name => $link2_name,
link2_mac_key => $link2_mac_key,
link2_mac => $link2_mac,
link2_nm_uuid => $link2_nm_uuid,
}});
push @{$link_nm_uuids}, $link1_nm_uuid;
push @{$link_nm_uuids}, $link2_nm_uuid;
$anvil->Job->update_progress({ $anvil->Job->update_progress({
progress => $anvil->Job->bump_progress({steps => 2}), progress => $anvil->Job->bump_progress({steps => 2}),
message => "message_0392", message => "message_0392",

Loading…
Cancel
Save