Added a global variable to force fresh SSH connections.
Signed-off-by: digimer <mkelly@alteeve.ca>
This commit is contained in:
parent
5517e43a81
commit
a9850bef4e
@ -908,6 +908,9 @@ sub _set_defaults
|
||||
manage => {
|
||||
firewall => 1,
|
||||
},
|
||||
net => {
|
||||
always_reconnect => 0,
|
||||
},
|
||||
password => {
|
||||
algorithm => "sha512",
|
||||
hash_count => 500000,
|
||||
|
@ -339,6 +339,21 @@ sub call
|
||||
}});
|
||||
}
|
||||
|
||||
# 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
|
||||
# If the call is to ourselves, switch to a local system call.
|
||||
|
@ -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…
Reference in New Issue
Block a user