* Added a loop when calling 'anvil-change-password' in a loop as there appears to be an unknown condition where during setup, this is called but never actually runs.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 2 years ago
parent ab3e8afe6e
commit 147f31aeeb
  1. 37
      tools/anvil-configure-host

@ -174,22 +174,49 @@ sub update_passwords
}
else
{
my ($output, $return_code) = $anvil->System->call({debug => 2, shell_call => $anvil->data->{path}{exe}{'anvil-change-password'}." -y --password-file ".$temp_file.$anvil->Log->switches });
my $wait_until = time + 120;
my $waiting = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
waiting => $waiting,
wait_until => $wait_until,
}});
while ($waiting)
{
my $shell_call = $anvil->data->{path}{exe}{'anvil-change-password'}." -y --password-file ".$temp_file.$anvil->Log->switches;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({debug => 2, timeout => 15, shell_call => $shell_call });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { output => $output, return_code => $return_code }});
foreach my $line (split/\n/, $output)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }});
}
# Unlink the temp file.
unlink $temp_file;
if ($return_code)
{
# Something went wrong
if (time > $wait_until)
{
# Give up.
$waiting = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { waiting => $waiting }});
}
else
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, 'print' => 1, key => "error_0011", variables => { return_code => $return_code }});
}
}
else
{
# Success
$waiting = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { waiting => $waiting }});
}
}
# Unlink the temp file.
unlink $temp_file;
}
}
$anvil->Job->update_progress({
@ -408,7 +435,7 @@ ORDER BY
}});
# An undefined interface will have the MAC address value set to '1', ignore those.
next if $variable_value = 1;
next if $variable_value == 1;
if ($variable_name =~ /form::config_step2::(.*?)_mac_to_set::value/)
{

Loading…
Cancel
Save