my ($configured, $variable_uuid, $modified_date) = $anvil->Database->read_variable({
variable_name => "system::configured",
variable_source_uuid => $anvil->Get->host_uuid,
variable_source_table => "hosts",
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
configured => $configured,
variable_uuid => $variable_uuid,
modified_date => $modified_date,
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { configured => $configured }});
return($configured);
}
# This checks to see if anything is running that requires Striker being unavailable. If not, this returns
# This checks to see if anything is running that requires Striker being unavailable. If not, this returns
# '1'. If there is a job pending/running, it returns '0'
# '1'. If there is a job pending/running, it returns '0'
@ -157,23 +210,36 @@ sub check_availability
my ($anvil) = @_;
my ($anvil) = @_;
my $available = 1;
my $available = 1;
my $query = "SELECT count(*) FROM jobs WHERE job_name = 'configure::network' AND job_progress != 100 AND job_host_uuid = ".$anvil->data->{sys}{use_db_fh}->quote($anvil->Get->host_uuid).";";
my $query = "SELECT job_progress, modified_date, extract(epoch from modified_date) FROM jobs WHERE job_name = 'configure::network' AND job_progress != 100 AND job_host_uuid = ".$anvil->data->{sys}{use_db_fh}->quote($anvil->Get->host_uuid).";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
my $count = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__})->[0]->[0];
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
$count = 0 if not defined $count;
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { count => $count }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
results => $results,
count => $count,
}});
if ($count)
if ($count)
{
{
# We're waiting for the network configuration
# We're waiting for the network configuration
$available = 0;
my $percent = $results->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { available => $available }});
my $timestamp = $results->[0]->[1];
my $unixtime = $results->[0]->[2];
my $seconds_ago = $anvil->Convert->add_commas({number => (time - $unixtime)});
$available = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
@ -348,7 +348,8 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st
<keyname="striker_0044">Done!</key>
<keyname="striker_0044">Done!</key>
<keyname="striker_0045">The network will be reconfigured momentarily. You may need to reconnect using the new network address you chose.</key>
<keyname="striker_0045">The network will be reconfigured momentarily. You may need to reconnect using the new network address you chose.</key>
<keyname="striker_0046">Offline...</key>
<keyname="striker_0046">Offline...</key>
<keyname="striker_0047">A job to reconfigure the network on this machine is underway. Please try again soon.</key>
<keyname="striker_0047">A job to reconfigure this Striker is underway. It is: [#!variable!percent!#%] done. It last updated its progress at: [#!variable!timestamp!#] (#!variable!seconds_ago!# seconds ago). Please try again shortly.</key>
<keyname="striker_0048">This indicates that this machine has been configured. After an initial install, this variable won't exist. If it is set to '0', it will trigger a reconfiguration of the local system.</key>