* Added error messages to Striker configuration forms.
* Fixed a bug in home->get_network_details() function to handle single IPs in network.xml.
Signed-off-by: Digimer <digimer@alteeve.ca>
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { sane => $sane, "cgi::striker_user::alert" => $anvil->data->{cgi}{striker_user}{alert} }});
}
else
@ -785,8 +789,9 @@ sub sanity_check_step2
# The password
if ((not defined $anvil->data->{cgi}{striker_password}{value}) or (not $anvil->data->{cgi}{striker_password}{value}) or (length($anvil->data->{cgi}{striker_password}{value}) < 6))
@ -267,6 +267,7 @@ The database connection error was:
<keyname="log_0173"><![CDATA[[ Error ] - Asked to valudate a password encoded with the algorithm: [#!variable!user_algorithm!#], which is not recognized. Only 'sha256', 'sha384' and 'sha512' are currently supported.]]></key>
<keyname="log_0174"><![CDATA[[ Error ] - Asked to update the variable: [#!variable!variable!#] in the configuration file: [#!variable!file!#], but that variable was not found.]]></key>
<keyname="log_0175"><![CDATA[[ Error ] - Asked to update the variable: [#!variable!variable!#] in the configuration file: [#!variable!file!#] on the host: [#!variable!target!#], but that variable was not found.]]></key>
<keyname="log_0176">The IP hash key: [#!variable!ip_key!#] does not exist, skipping it.</key>
<!-- Test words. Do NOT change unless you update 't/Words.t' or tests will needlessly fail. -->
<keyname="t_0000">Test</key>
@ -368,6 +369,17 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st
<keyname="error_0009">Failed to add the target: [#!variable!target!#]:[#!variable!port!#]'s RSA fingerprint to: [#!variable!user!#]'s list of known hosts.</key>
<keyname="error_0010">There was a problem adding the local machine to the: [#!data!path::configs::anvil.conf!#] file. Please see the log for details.</key>
<keyname="error_0011">Something went wrong while trying to update the password. The return code was: [#!variable!return_code!#], but '0' was expected.</key>
<keyname="error_0012"><![CDATA[The <a href="https://en.wikipedia.org/wiki/Hostname" target="_new">hostname</a> has to be set to a valid value.]]></key>
<keyname="error_0013">A user name must be set. This is usually 'admin'.</key>
<keyname="error_0014">You must set a password. There are no complexity rules, but a long password is strongly recommended.</key>
<keyname="error_0015">A DNS entry is bad. One or more IPv4 addresses can be specified, with a comma separating multiple IPs.</key>
<keyname="error_0016">The IPv4 address assigned to: [#!variable!network!#] is invalid.</key>
<keyname="error_0017">An interface to use in: [#!variable!network!# - Link #!variable!link!#] must be selected.</key>
<keyname="error_0018">Network interfaces can only be selected once.</key>
<keyname="error_0019">The gateway appears to have an invalid IPv4 address set.</key>
<keyname="error_0020">The: [#!variable!field!#] field can't be empty.</key>
<keyname="error_0021">The prefix needs to be set, and be between 1 and 5 characters long.</key>
<keyname="error_0022">The: [#!variable!field!#] must be a positive integer.</key>
<!-- These are works and strings used by javascript/jqery -->
my $is_gateway = $this_network eq $gateway_interface ? 1 : 0;
my $link1_mac = $anvil->data->{variables}{form}{config_step2}{$link1_key}{value};
my $link2_mac = $anvil->data->{variables}{form}{config_step2}{$link2_key}{value};
my $old_link1_iface = $anvil->data->{sys}{mac}{$link1_mac}{iface} ? $anvil->data->{sys}{mac}{$link1_mac}{iface} : "";
my $old_link2_iface = $anvil->data->{sys}{mac}{$link2_mac}{iface} ? $anvil->data->{sys}{mac}{$link2_mac}{iface} : "";
my $this_network = $network_type.$network_count;
my $link1_key = $this_network."_link1_mac_to_set";
my $link2_key = $this_network."_link2_mac_to_set";
my $subnet_key = $this_network."_subnet";
my $ip_key = $this_network."_ip";
my $is_gateway = $this_network eq $gateway_interface ? 1 : 0;
my $link1_mac = $anvil->data->{variables}{form}{config_step2}{$link1_key}{value};
my $link2_mac = defined $anvil->data->{variables}{form}{config_step2}{$link2_key}{value} ? $anvil->data->{variables}{form}{config_step2}{$link2_key}{value} : "";
my $old_link1_iface = $anvil->data->{sys}{mac}{$link1_mac}{iface} ? $anvil->data->{sys}{mac}{$link1_mac}{iface} : "";
my $old_link2_iface = $link2_mac ? $anvil->data->{sys}{mac}{$link2_mac}{iface} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
ip_key => $ip_key,
is_gateway => $is_gateway,
@ -251,7 +251,15 @@ sub reconfigure_network
}});
# Skip if this doesn't exist or isn't a valid IPv4 address.
next if not exists $anvil->data->{variables}{form}{config_step2}{$ip_key}{value};
if (not exists $anvil->data->{variables}{form}{config_step2}{$ip_key}{value})
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "variables::form::config_step2::${ip_key}::value" => $anvil->data->{variables}{form}{config_step2}{$ip_key}{value} }});
}
if (($anvil->data->{variables}{form}{config_step2}{$ip_key}{value}) and (not $anvil->Validate->is_ipv4({ip => $anvil->data->{variables}{form}{config_step2}{$ip_key}{value}})))
{
# Something was set, but it isn't valid.
@ -269,10 +277,11 @@ sub reconfigure_network
subnet => $subnet,
}});
# Are we building bonded interfaces?
if ($anvil->Validate->is_mac({mac => $link2_mac}))
{
### TODO: Handle when bridges exist. Detect when the host is a node and/or have a "use as bridge" option?