Added a global variable to force fresh SSH connections.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 11 months ago
parent 5517e43a81
commit a9850bef4e
  1. 3
      Anvil/Tools.pm
  2. 15
      Anvil/Tools/Remote.pm
  3. 6
      tools/anvil-configure-host
  4. 3
      tools/anvil-provision-server

@ -908,6 +908,9 @@ sub _set_defaults
manage => {
firewall => 1,
},
net => {
always_reconnect => 0,
},
password => {
algorithm => "sha512",
hash_count => 500000,

@ -338,6 +338,21 @@ sub call
password => $anvil->Log->is_secure($password),
}});
}
# Is the global "always reconnect" is set, set 'close' to 1 and clear any cached connections.
$anvil->data->{sys}{net}{always_reconnect} = 0 if not defined $anvil->data->{sys}{net}{always_reconnect};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"sys::net::always_reconnect" => $anvil->data->{sys}{net}{always_reconnect},
}});
if ($anvil->data->{sys}{net}{always_reconnect})
{
$close = 1;
$no_cache = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
'close' => $close,
no_cache => $no_cache,
}});
}
### NOTE: This caused problems that are currently unsolved.
=cut

@ -52,6 +52,12 @@ if (($< != 0) && ($> != 0))
$anvil->nice_exit({exit_code => 1});
}
# Because we're working with the network config, we can't reliable use cached connections.
$anvil->data->{sys}{net}{always_reconnect} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, secure => 1, list => {
"sys::net::always_reconnect" => $anvil->data->{sys}{net}{always_reconnect},
}});
# Connect
$anvil->Database->connect({debug => 2, check_for_resync => 1});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, 'print' => 1, key => "message_0031"});

@ -139,6 +139,9 @@ sub check_Storage_groups
debug => 2,
anvil_uuid => $anvil_uuid,
});
# Reload in case we created one.
$anvil->Database->get_storage_group_data({debug => 2});
}
return(0);

Loading…
Cancel
Save