* Got the install manifest form step 1 sanity checks done. Got the form for step 2 done.

* Updated Template->select_form() to add the 'style' paramter (for CSS style options), and added the ability to set the 'options' to the special value 'subnet' that builds an options box showing usable CIDR subnets.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent 1351889b4d
commit 5835e49ef4
  1. 112
      Anvil/Tools/Template.pm
  2. 252
      cgi-bin/striker
  3. 173
      html/skins/alteeve/anvil.html
  4. 6
      html/skins/alteeve/main.css
  5. 17
      share/words.xml

@ -313,6 +313,8 @@ This is the name of the select box.
This is an array reference of options to put into the select box.
B<NOTE>: The special value C<< subnet >> is allowed. When C<< options >> is C<< subnet >>, a list of valid subnets with CIDR notaion is returned. The common values C<< 255.255.255.0 >>, C<< 255.255.0.0 >> and C<< 255.0.0.0 >> are the first three options and the rest of the useful values (C<< 128.0.0.0 (/1)>> through to C<< 255.255.255.248 (/29) >>) follow. When used, C<< select >> can be set to the dotted-decimal (ie: C<< 255.255.0.0 >>) to select an entry.
Example;
my $options = ["a", "b", "c"];
@ -337,6 +339,10 @@ If this is set and if it matches one of the C<< options >> array values, then th
By default, the options array will be sorted alphabetically. If this is set to C<< 0 >>, then the order the options were entered into the array is used.
=head3 style (optional)
If desired, this can be set to assign a CSS style to the selection box.
=cut
sub select_form
{
@ -346,29 +352,40 @@ sub select_form
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
my $name = defined $parameter->{name} ? $parameter->{name} : "";
my $options = defined $parameter->{options} ? $parameter->{options} : "";
my $id = defined $parameter->{id} ? $parameter->{id} : $name;
my $sort = defined $parameter->{'sort'} ? $parameter->{'sort'} : 1; # Sort the entries?
my $class = defined $parameter->{class} ? $parameter->{class} : "";
my $blank = defined $parameter->{blank} ? $parameter->{blank} : 0; # Add a blank/null entry?
my $class = defined $parameter->{class} ? $parameter->{class} : "";
my $id = defined $parameter->{id} ? $parameter->{id} : $name;
my $options = defined $parameter->{options} ? $parameter->{options} : "";
my $say_blank = defined $parameter->{say_blank} ? $parameter->{say_blank} : ""; # An optional, grayed-out string in the place of the "blank" option
my $selected = defined $parameter->{selected} ? $parameter->{selected} : ""; # Pre-select an option?
my $sort = defined $parameter->{'sort'} ? $parameter->{'sort'} : 1; # Sort the entries?
my $style = defined $parameter->{style} ? $parameter->{style} : ""; # CSS style attribute
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
blank => $blank,
class => $class,
id => $id,
name => $name,
options => $options,
'sort' => $sort,
class => $class,
blank => $blank,
say_blank => $say_blank,
selected => $selected,
'sort' => $sort,
style => $style,
}});
# Lets start!
my $select = "<select name=\"$name\" id=\"$id\">\n";
if ($class)
if (($class) && ($style))
{
$select = "<select name=\"$name\" id=\"$id\" class=\"$class\" style=\"$style\">\n";
}
elsif ($class)
{
$select = "<select name=\"$name\" id=\"$id\" class=\"$class\">\n";
}
elsif ($style)
{
$select = "<select name=\"$name\" id=\"$id\" style=\"$style\">\n";
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 'select' => $select }});
# Insert a blank line.
@ -395,6 +412,85 @@ sub select_form
}
}
# If 'options' is 'subnet', set ours;
if ($options eq "subnet")
{
=cut
CIDR Total number Network Description:
Notation: of addresses: Mask:
--------------------------------------------------------------
/0 4,294,967,296 0.0.0.0 Every Address
/1 2,147,483,648 128.0.0.0 128 /8 nets
/2 1,073,741,824 192.0.0.0 64 /8 nets
/3 536,870,912 224.0.0.0 32 /8 nets
/4 268,435,456 240.0.0.0 16 /8 nets
/5 134,217,728 248.0.0.0 8 /8 nets
/6 67,108,864 252.0.0.0 4 /8 nets
/7 33,554,432 254.0.0.0 2 /8 nets
/8 16,777,214 255.0.0.0 1 /8 net
--------------------------------------------------------------
/9 8,388,608 255.128.0.0 128 /16 nets
/10 4,194,304 255.192.0.0 64 /16 nets
/11 2,097,152 255.224.0.0 32 /16 nets
/12 1,048,576 255.240.0.0 16 /16 nets
/13 524,288 255.248.0.0 8 /16 nets
/14 262,144 255.252.0.0 4 /16 nets
/15 131.072 255.254.0.0 2 /16 nets
/16 65,536 255.255.0.0 1 /16
--------------------------------------------------------------
/17 32,768 255.255.128.0 128 /24 nets
/18 16,384 255.255.192.0 64 /24 nets
/19 8,192 255.255.224.0 32 /24 nets
/20 4,096 255.255.240.0 16 /24 nets
/21 2,048 255.255.248.0 8 /24 nets
/22 1,024 255.255.252.0 4 /24 nets
/23 512 255.255.254.0 2 /24 nets
/24 256 255.255.255.0 1 /24
--------------------------------------------------------------
/25 128 255.255.255.128 Half of a /24
/26 64 255.255.255.192 Fourth of a /24
/27 32 255.255.255.224 Eighth of a /24
/28 16 255.255.255.240 1/16th of a /24
/29 8 255.255.255.248 5 Usable addresses
/30 4 255.255.255.252 1 Usable address
/31 2 255.255.255.254 Unusable
/32 1 255.255.255.255 Single host
--------------------------------------------------------------
=cut
$sort = 0;
$options = [
"255.255.255.0#!#255.255.255.0 (/24)",
"255.255.0.0#!#255.255.0.0 (/16)",
"255.0.0.0#!#255.0.0.0 (/8)",
"255.255.255.248#!#255.255.255.248 (/29)",
"255.255.255.240#!#255.255.255.240 (/28)",
"255.255.255.224#!#255.255.255.224 (/27)",
"255.255.255.192#!#255.255.255.192 (/26)",
"255.255.255.128#!#255.255.255.128 (/25)",
"255.255.254.0#!#255.255.254.0 (/23)",
"255.255.252.0#!#255.255.252.0 (/22)",
"255.255.248.0#!#255.255.248.0 (/21)",
"255.255.240.0#!#255.255.240.0 (/20)",
"255.255.224.0#!#255.255.224.0 (/19)",
"255.255.192.0#!#255.255.192.0 (/18)",
"255.255.128.0#!#255.255.128.0 (/17)",
"255.254.0.0#!#255.254.0.0 (/15)",
"255.252.0.0#!#255.252.0.0 (/14)",
"255.248.0.0#!#255.248.0.0 (/13)",
"255.240.0.0#!#255.240.0.0 (/12)",
"255.224.0.0#!#255.224.0.0 (/11)",
"255.192.0.0#!#255.192.0.0 (/10)",
"255.128.0.0#!#255.128.0.0 (/9)",
"254.0.0.0#!#254.0.0.0 (/7)",
"252.0.0.0#!#252.0.0.0 (/6)",
"248.0.0.0#!#248.0.0.0 (/5)",
"240.0.0.0#!#240.0.0.0 (/4)",
"224.0.0.0#!#224.0.0.0 (/3)",
"192.0.0.0#!#192.0.0.0 (/2)",
"128.0.0.0#!#128.0.0.0 (/1)",
];
}
# TODO: This needs to be smarter... I shouldn't need two loops for sorted/not sorted.
if ($sort)
{

@ -1534,43 +1534,65 @@ sub handle_manifest
{
my ($anvil) = @_;
$anvil->data->{cgi}{step}{value} = 1 if not defined $anvil->data->{cgi}{step}{value};
$anvil->data->{cgi}{prefix}{value} = "" if not defined $anvil->data->{cgi}{prefix}{value};
$anvil->data->{cgi}{prefix}{alert} = 0 if not defined $anvil->data->{cgi}{prefix}{alert};
$anvil->data->{cgi}{domain}{value} = "" if not defined $anvil->data->{cgi}{domain}{value};
$anvil->data->{cgi}{domain}{alert} = 0 if not defined $anvil->data->{cgi}{domain}{alert};
$anvil->data->{cgi}{sequence}{value} = "" if not defined $anvil->data->{cgi}{sequence}{value};
$anvil->data->{cgi}{ifn_count}{value} = "" if not defined $anvil->data->{cgi}{ifn_count}{value};
$anvil->data->{cgi}{sequence}{alert} = 0 if not defined $anvil->data->{cgi}{sequence}{alert};
$anvil->data->{cgi}{bcn_count}{value} = 1 if not defined $anvil->data->{cgi}{bcn_count}{value};
$anvil->data->{cgi}{bcn_count}{alert} = 0 if not defined $anvil->data->{cgi}{bcn_count}{alert};
$anvil->data->{cgi}{ifn_count}{value} = 1 if not defined $anvil->data->{cgi}{ifn_count}{value};
$anvil->data->{cgi}{ifn_count}{alert} = 0 if not defined $anvil->data->{cgi}{ifn_count}{alert};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::step::value" => $anvil->data->{cgi}{step}{value},
"cgi::prefix::value" => $anvil->data->{cgi}{prefix}{value},
"cgi::domain::value" => $anvil->data->{cgi}{domain}{value},
"cgi::sequence::value" => $anvil->data->{cgi}{sequence}{value},
"cgi::bcn_count::value" => $anvil->data->{cgi}{bcn_count}{value},
"cgi::ifn_count::value" => $anvil->data->{cgi}{ifn_count}{value},
}});
# Step 1 is to ask for the sequence number, prefix, and the number of IFNs (and later, BCNs)
my $prefix = "";
my $sequence = 1;
my $ifn_count = 1;
if (($anvil->data->{cgi}{manifest_uuid}{value} eq "new") && ($anvil->data->{cgi}{step}{value} eq "1"))
if ($anvil->data->{cgi}{step}{value} > 1)
{
# Pre-load values
if ($anvil->data->{cgi}{prefix}{value})
my ($sane) = sanity_check_manifest_step1($anvil);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { sane => $sane }});
if (not $sane)
{
$prefix = $anvil->data->{cgi}{prefix}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { prefix => $prefix }});
# Go back to the first page
$anvil->data->{cgi}{step}{value} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::step::value" => $anvil->data->{cgi}{step}{value} }});
}
else
}
# Step 1 is to ask for the sequence number, prefix, and the number of IFNs (and later, BCNs)
if ($anvil->data->{cgi}{step}{value} eq "1")
{
$prefix = $anvil->_short_host_name() =~ /-/ ? $anvil->_short_host_name() : "xx";
$prefix =~ s/-.*$//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { prefix => $prefix }});
if ($anvil->data->{cgi}{manifest_uuid}{value} eq "new")
{
# Pre-load values
if (not $anvil->data->{cgi}{prefix}{value})
{
$anvil->data->{cgi}{prefix}{value} = $anvil->_short_host_name() =~ /-/ ? $anvil->_short_host_name() : "xx";
$anvil->data->{cgi}{prefix}{value} =~ s/-.*$//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::prefix::value" => $anvil->data->{cgi}{prefix}{value} }});
}
if ($anvil->data->{cgi}{sequence}{value})
if (not $anvil->data->{cgi}{domain}{value})
{
$sequence = $anvil->data->{cgi}{sequence}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { sequence => $sequence }});
$anvil->data->{cgi}{domain}{value} = $anvil->_host_name() =~ /\./ ? $anvil->_host_name() : "example.com";
$anvil->data->{cgi}{domain}{value} =~ s/^.*?\.//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::domain::value" => $anvil->data->{cgi}{domain}{value} }});
}
else
if (not $anvil->data->{cgi}{sequence}{value})
{
# Default to 1
$anvil->data->{cgi}{sequence}{value} = 1;
# Count the number of existing manifests! systems with the default prefix to guess the next sequence.
my $query = "SELECT manifest_name FROM manifests WHERE manifest_name LIKE ".$anvil->Database->quote($prefix."-%")." ORDER BY manifest_name ASC;";
my $query = "SELECT manifest_name FROM manifests WHERE manifest_name LIKE ".$anvil->Database->quote($anvil->data->{cgi}{prefix}{value}."-%")." ORDER BY manifest_name ASC;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
@ -1591,19 +1613,19 @@ sub handle_manifest
manifest_name => $manifest_name,
this_sequence => $this_sequence,
}});
if ($this_sequence >= $sequence)
if ($this_sequence >= $anvil->data->{cgi}{sequence}{value})
{
$sequence = $this_sequence + 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { sequence => $sequence }});
$anvil->data->{cgi}{sequence}{value} = $this_sequence + 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::sequence::value" => $anvil->data->{cgi}{sequence}{value} }});
}
}
}
}
if ($anvil->data->{cgi}{ifn_count}{value})
if (not $anvil->data->{cgi}{ifn_count}{value})
{
$ifn_count = $anvil->data->{cgi}{ifn_count}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { ifn_count => $ifn_count }});
$anvil->data->{cgi}{ifn_count}{value} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::ifn_count::value" => $anvil->data->{cgi}{ifn_count}{value} }});
}
}
else
@ -1615,24 +1637,188 @@ sub handle_manifest
#});
}
# Show the menu
if ($anvil->data->{cgi}{step}{value} eq "1")
{
# Step 1 menu.
$anvil->data->{form}{back_link} = "?anvil=true&task=create";
$anvil->data->{form}{refresh_link} = "?anvil=true&task=create&manifest_uuid=".$anvil->data->{cgi}{manifest_uuid}{value}."&step=".$anvil->data->{cgi}{step}{value};
$anvil->data->{form}{refresh_link} = "?anvil=true&task=manifests&manifest_uuid=".$anvil->data->{cgi}{manifest_uuid}{value}."&step=".$anvil->data->{cgi}{step}{value};
$anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "manifest-step1", variables => {
prefix => $prefix,
sequence => $sequence,
ifn_count => $ifn_count,
title => $anvil->Words->string({key => "striker_0226", variables => { number => 1 }}),
prefix => $anvil->data->{cgi}{prefix}{value},
prefix_class => $anvil->data->{cgi}{prefix}{alert} ? "input_alert" : "",
domain => $anvil->data->{cgi}{domain}{value},
domain_class => $anvil->data->{cgi}{domain}{alert} ? "input_alert" : "",
sequence => $anvil->data->{cgi}{sequence}{value},
sequence_class => $anvil->data->{cgi}{sequence}{alert} ? "input_alert" : "",
ifn_count => $anvil->data->{cgi}{ifn_count}{value},
ifn_count_class => $anvil->data->{cgi}{ifn_count}{alert} ? "input_alert" : "",
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'form::body' => $anvil->data->{form}{body} }});
}
elsif ($anvil->data->{cgi}{step}{value} eq "2")
{
### Ask for the network ranges.
# Eventually, we'll support user-set BCN count. So for now, we treat as such even though it
# will always be '1' for now.
my $network_form = "";
foreach my $i (1..$anvil->data->{cgi}{bcn_count}{value})
{
my $say_bcn = $anvil->Words->string({key => "striker_0018", variables => { number => $i }});
my $network_key = "bcn".$i."_network";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
say_bcn => $say_bcn,
network_key => $network_key,
}});
$anvil->data->{cgi}{$network_key}{value} = "10.20".$i.".0.0" if not defined $anvil->data->{cgi}{$network_key}{value};
$network_form .= $anvil->Template->get({file => "anvil.html", name => "manifest-step2-network-entry", variables => {
network => $say_bcn,
name => $network_key,
class => $anvil->data->{cgi}{$network_key}{alert} ? "input_alert" : "",
value => $anvil->data->{cgi}{$network_key}{value},
subnet => "255.255.0.0",
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'form::body' => $anvil->data->{form}{body} }});
}
# There's only ever 1 SN
my $say_sn = $anvil->Words->string({key => "striker_0020", variables => { number => '1' }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { say_sn => $say_sn }});
$anvil->data->{cgi}{sn1_network}{value} = "10.101.0.0" if not defined $anvil->data->{cgi}{sn1_network}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::sn1_network::value" => $anvil->data->{cgi}{sn1_network}{value} }});
$network_form .= $anvil->Template->get({file => "anvil.html", name => "manifest-step2-network-entry", variables => {
network => $say_sn,
name => "sn1_network",
class => $anvil->data->{cgi}{sn1_network}{alert} ? "input_alert" : "",
value => $anvil->data->{cgi}{sn1_network}{value},
subnet => "255.255.0.0",
}});
# Now IFNs
foreach my $i (1..$anvil->data->{cgi}{ifn_count}{value})
{
my $say_ifn = $anvil->Words->string({key => "striker_0022", variables => { number => $i }});
my $network_key = "ifn".$i."_network";
my $subnet_key = "ifn".$i."_subnet";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { say_ifn => $say_ifn }});
$anvil->data->{cgi}{$network_key}{value} = "10.20".$i.".0.0" if not defined $anvil->data->{cgi}{$network_key}{value};
$anvil->data->{cgi}{$subnet_key}{value} = "255.255.0.0" if not defined $anvil->data->{cgi}{$subnet_key}{value};
my $select = $anvil->Template->select_form({
name => $subnet_key,
options => "subnet",
blank => 0,
'sort' => 0,
selected => $anvil->data->{cgi}{$subnet_key}{value},
class => $anvil->data->{cgi}{$subnet_key}{alert} ? "input_alert" : "input_clear",
style => "width: 15em;",
});
$network_form .= $anvil->Template->get({file => "anvil.html", name => "manifest-step2-network-entry", variables => {
network => $say_ifn,
name => $network_key,
class => $anvil->data->{cgi}{$network_key}{alert} ? "input_alert" : "",
value => $anvil->data->{cgi}{$network_key}{value},
subnet => $select,
}});
}
$anvil->data->{form}{back_link} = "?anvil=true&task=manifests&manifest_uuid=".$anvil->data->{cgi}{manifest_uuid}{value}."&step=1&prefix=".$anvil->data->{cgi}{prefix}{value}."&domain=".$anvil->data->{cgi}{domain}{value}."&sequence=".$anvil->data->{cgi}{sequence}{value}."&ifn_count=".$anvil->data->{cgi}{ifn_count}{value};
$anvil->data->{form}{refresh_link} = "?anvil=true&task=manifests&manifest_uuid=".$anvil->data->{cgi}{manifest_uuid}{value}."&step=2&prefix=".$anvil->data->{cgi}{prefix}{value}."&domain=".$anvil->data->{cgi}{domain}{value}."&sequence=".$anvil->data->{cgi}{sequence}{value}."&ifn_count=".$anvil->data->{cgi}{ifn_count}{value};
$anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "manifest-step2", variables => {
title => $anvil->Words->string({key => "striker_0226", variables => { number => 2 }}),
networks => $network_form,
bcn_message => $anvil->Words->string({key => "message_0131", variables => { number => "X" }}),
sn_message => $anvil->Words->string({key => "message_0132", variables => { number => "X" }}),
ifn_message => $anvil->Words->string({key => "message_0133", variables => { number => "X" }}),
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'form::body' => $anvil->data->{form}{body} }});
}
elsif ($anvil->data->{cgi}{step}{value} eq "3")
{
# Build and show the main manifest page!
}
return(0);
}
sub sanity_check_manifest_step1
{
my ($anvil) = @_;
my $sane = 1;
if ((not $anvil->Validate->is_alphanumeric({string => $anvil->data->{cgi}{prefix}{value}})) or (length($anvil->data->{cgi}{prefix}{value}) > 5))
{
my $message = $anvil->Words->string({key => "error_0020", variables => { field => "#!string!striker_0228!#" }});
if ($anvil->data->{cgi}{prefix}{value})
{
$message = $anvil->Words->string({key => "error_0021"});
}
$anvil->data->{form}{error_massage} = $anvil->Template->get({file => "main.html", name => "error_message", variables => { error_message => $message }});
$anvil->data->{cgi}{prefix}{alert} = 1;
$sane = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => {
sane => $sane,
"cgi::prefix::alert" => $anvil->data->{cgi}{prefix}{alert},
"cgi::prefix::value" => $anvil->data->{cgi}{prefix}{value},
}});
}
# We can use Validate to check the domain.
if (not $anvil->Validate->is_domain_name({name => $anvil->data->{cgi}{domain}{value}, debug => 2}))
{
my $message = $anvil->Words->string({key => "error_0020", variables => { field => "#!string!striker_0007!#" }});
if ($anvil->data->{cgi}{domain}{value})
{
$message = $anvil->Words->string({key => "error_0117", variables => { name => $anvil->data->{cgi}{domain}{value} }});
}
$anvil->data->{form}{error_massage} = $anvil->Template->get({file => "main.html", name => "error_message", variables => { error_message => $message }});
$anvil->data->{cgi}{domain}{alert} = 1;
$sane = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => {
sane => $sane,
"cgi::domain::alert" => $anvil->data->{cgi}{domain}{alert},
"cgi::domain::value" => $anvil->data->{cgi}{domain}{value},
}});
}
# The sequence and IFN count need to be integers.
if (not $anvil->Validate->is_positive_integer({number => $anvil->data->{cgi}{sequence}{value}}))
{
my $message = $anvil->Words->string({key => "error_0020", variables => { field => "#!string!striker_0009!#" }});
if ($anvil->data->{cgi}{sequence}{value})
{
$message = $anvil->Words->string({key => "error_0022", variables => { field => "#!string!striker_0009!#" }});
}
$anvil->data->{form}{error_massage} = $anvil->Template->get({file => "main.html", name => "error_message", variables => { error_message => $message }});
$anvil->data->{cgi}{sequence}{alert} = 1;
$sane = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => {
sane => $sane,
"cgi::sequence::alert" => $anvil->data->{cgi}{sequence}{alert},
"cgi::sequence::value" => $anvil->data->{cgi}{sequence}{value},
}});
}
if (not $anvil->Validate->is_positive_integer({number => $anvil->data->{cgi}{ifn_count}{value}}))
{
my $message = $anvil->Words->string({key => "error_0020", variables => { field => "#!string!striker_0230!#" }});
if ($anvil->data->{cgi}{ifn_count}{value})
{
$message = $anvil->Words->string({key => "error_0022", variables => { field => "#!string!striker_0230!#" }});
}
$anvil->data->{form}{error_massage} = $anvil->Template->get({file => "main.html", name => "error_message", variables => { error_message => $message }});
$anvil->data->{cgi}{ifn_count}{alert} = 1;
$sane = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => {
sane => $sane,
"cgi::ifn_count::alert" => $anvil->data->{cgi}{ifn_count}{alert},
"cgi::ifn_count::value" => $anvil->data->{cgi}{ifn_count}{value},
}});
}
return($sane);
}
# Show the create manifest (and Fence devices and UPSes) menu
sub process_create
{

@ -76,7 +76,7 @@
</tr>
<tr>
<td class="title">
#!string!striker_0226!#
#!variable!title!#
</td>
</tr>
<tr>
@ -104,7 +104,16 @@
#!string!striker_0228!#
</td>
<td>
<input type="text" name="prefix" id="prefix" value="#!variable!prefix!#" placeholder="xx" />
<input type="text" name="prefix" id="prefix" value="#!variable!prefix!#" placeholder="xx" class="#!variable!prefix_class!#"/>
</td>
</tr>
<tr>
<td class="column_header">
<!-- domain -->
#!string!striker_0007!#
</td>
<td>
<input type="text" name="domain" id="domain" value="#!variable!domain!#" placeholder="example.com" class="#!variable!domain_class!#"/>
</td>
</tr>
<tr>
@ -113,7 +122,7 @@
#!string!striker_0229!#
</td>
<td>
<input type="text" name="sequence" id="sequence" value="#!variable!sequence!#" placeholder="1" />
<input type="number" name="sequence" id="sequence" value="#!variable!sequence!#" placeholder="1" class="#!variable!sequence_class!#"/>
</td>
</tr>
<tr>
@ -122,7 +131,7 @@
#!string!striker_0230!#
</td>
<td>
<input type="text" name="ifn_count" id="ifn_count" value="#!variable!ifn_count!#" placeholder="1" />
<input type="number" name="ifn_count" id="ifn_count" value="#!variable!ifn_count!#" placeholder="1" class="#!variable!ifn_count_class!#"/>
</td>
</tr>
<tr>
@ -139,7 +148,8 @@
</td>
<input type="hidden" name="step" id="step" value="2">
<input type="hidden" name="anvil" id="anvil" value="true">
<input type="hidden" name="task" id="task" value="fences">
<input type="hidden" name="task" id="task" value="manifests">
<input type="hidden" name="manifest_uuid" id="manifest_uuid" value="#!data!cgi::manifest_uuid::value!#">
</tr>
</table>
</form>
@ -150,9 +160,162 @@
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
<table class="centered">
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- Prefix -->
#!string!striker_0228!# &nbsp;
</td>
<td>
#!string!striker_0246!#
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- Domain -->
#!string!striker_0007!# &nbsp;
</td>
<td>
#!string!striker_0247!#
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- Sequence -->
#!string!striker_0229!# &nbsp;
</td>
<td>
#!string!striker_0244!#
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- IFN Count -->
#!string!striker_0230!#
</td>
<td>
#!string!striker_0245!#
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- end manifest-step1 -->
<!-- start manifest-step2-network-entry -->
<tr>
<td class="column_header">
<!-- prefix -->
#!variable!network!#: &nbsp;
</td>
<td class="fixed_width_no_wrap">
<input type="text" name="#!variable!name!#" id="#!variable!name!#" value="#!variable!value!#" width="15" style="width: 15em;" class="#!variable!class!#" /> / #!variable!subnet!#
</td>
</tr>
<!-- end manifest-step2-network-entry -->
<!-- start manifest-step2 -->
<table align="center" class="anvil_main_menu">
<script type="text/javascript" src="/skins/alteeve/anvil.js"></script>
<tr>
<td>
&nbsp;
</td>
</tr>
<tr>
<td class="title">
#!variable!title!#
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
</tr>
<tr>
<td class="description">
#!string!striker_0248!#
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
</tr>
<tr>
<td>
<form name="manifest_step2" action="" method="post">
<table align="center" class="anvil_main_menu">
#!variable!networks!#
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td>
<input type="submit" name="back" id="back" value="#!string!striker_0098!#" class="button">
</td>
<td style="text-align: right;">
<input type="submit" name="next" id="next" value="#!string!striker_0013!#" class="button">
</td>
<input type="hidden" name="prefix" id="prefix" value="#!data!cgi::prefix::value!#">
<input type="hidden" name="domain" id="domain" value="#!data!cgi::domain::value!#">
<input type="hidden" name="sequence" id="sequence" value="#!data!cgi::sequence::value!#">
<input type="hidden" name="bcn_count" id="bcn_count" value="#!data!cgi::bcn_count::value!#">
<input type="hidden" name="ifn_count" id="ifn_count" value="#!data!cgi::ifn_count::value!#">
<input type="hidden" name="step" id="step" value="2">
<input type="hidden" name="anvil" id="anvil" value="true">
<input type="hidden" name="task" id="task" value="fences">
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
<table class="centered">
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- BCN -->
#!string!message_0160!# &nbsp;
</td>
<td>
#!variable!bcn_message!#
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- SN -->
#!string!message_0161!# &nbsp;
</td>
<td>
#!variable!sn_message!#
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- IFN -->
#!string!message_0162!# &nbsp;
</td>
<td>
#!variable!ifn_message!#
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- end manifest-step2 -->
<!-- start fence-agent-configuration -->
<table align="center" class="anvil_main_menu">
<script type="text/javascript" src="/skins/alteeve/anvil.js"></script>

@ -59,6 +59,7 @@ body {
text-align: left;
color: #9ba0a5;
padding: 0.15em;
white-space: nowrap;
}
.column_header_veritcal {
@ -105,6 +106,11 @@ body {
font-family: 'Dejavu Sans Mono', Courier;
}
.fixed_width_no_wrap {
font-family: 'Dejavu Sans Mono', Courier;
white-space: nowrap;
}
.footer {
background: #171717;
font-size: 12px;

@ -55,7 +55,7 @@ Author: Madison Kelly <mkelly@alteeve.ca>
<key name="error_0018">Network interfaces can only be selected once.</key>
<key name="error_0019">The gateway appears to have an invalid IPv4 address set.</key>
<key name="error_0020">The: [#!variable!field!#] field can't be empty.</key>
<key name="error_0021">The prefix needs to be set, and be between 1 and 5 characters long.</key>
<key name="error_0021">The prefix needs to be set, and be between 1 and 5 alphanumeric characters long.</key>
<key name="error_0022">The: [#!variable!field!#] must be a positive integer.</key>
<key name="error_0023">There was a problem reading your session details. To be safe, you have been logged out. Please try logging back in.</key>
<key name="error_0024">It appears that your session has expired. To be safe, you have been logged out. Please try logging back in.</key>
@ -175,6 +175,7 @@ The error was:
<key name="error_0114">This row's modified_date wasn't the first column returned in query: [#!variable!query!#]</key>
<key name="error_0115">This row's UUID column: [#!variable!uuid_column!#] wasn't the second column returned in query: [#!variable!query!#]</key>
<key name="error_0116">This is a CentOS machine, and tried to move the directory: [#!variable!source!#] to: [#!variable!target!#], but that renane failed.</key>
<key name="error_0117">The domain name: [#!variable!name!#] does not appear to be valid.</key>
<!-- Table headers -->
<key name="header_0001">Current Network Interfaces and States</key>
@ -1045,7 +1046,7 @@ About to try to download aproximately: [#!variable!packages!#] packages needed t
<key name="message_0130">Updated repository data.</key>
<key name="message_0131">Back-Channel Network ##!variable!number!# - Used for all inter-machine communication in the Anvil!, as well as communication for foundation pack devices. Should be VLAN-isolated from the IFN and, thus, trusted.</key>
<key name="message_0132">Storage Network ##!variable!number!# - Used for DRBD communication between nodes and DR hosts. Should be VLAN-isolated from the IFN and, thus, trusted.</key>
<key name="message_0133">Internet/Intranet-Facing Network ##!variable!number!# - Used for all client/user facing traffic. Likely connected to a semi-trusted network only.</key>
<key name="message_0133">Internet-Facing Network ##!variable!number!# - Used for all client/user facing traffic. Likely connected to a semi-trusted network only.</key>
<key name="message_0134">Updating / configuring the firewall.</key>
<key name="message_0135">It appears like we need to accept the fingerprint. Will do so now and then try to conenct again.</key>
<key name="message_0136">The zone: [#!variable!zone!#] file: [#!variable!file!#] needs to be updated.</key>
@ -1072,6 +1073,9 @@ About to try to download aproximately: [#!variable!packages!#] packages needed t
<key name="message_0157">When a system alert is recorded, any alert recipient interested in that alert will be notified by email. This is determined by the alert's level, and the recipients alert level interest. If the alert's level is equal to or higher than a given alert, an email will be crafted for them, in their chosen language and units.</key>
<key name="message_0158">[ Error ] - The modules.yaml file: [#!variable!modules_yaml!#] was found, but something failed when we tried to copy it to: [#!variable!target_modules!#].</key>
<key name="message_0159">Updated module metadata.</key>
<key name="message_0160">Back-Channel Network</key>
<key name="message_0161">Storage Network</key>
<key name="message_0162">Internet-Facing Network</key>
<!-- Success messages shown to the user -->
<key name="ok_0001">Saved the mail server information successfully!</key>
@ -1097,7 +1101,7 @@ About to try to download aproximately: [#!variable!packages!#] packages needed t
<key name="striker_0003">Organization name</key>
<key name="striker_0004">This is the name of the company, organization or division that owns or maintains this #!string!brand_0006!#. This is a descriptive field and you can enter whatever makes most sense to you.</key>
<key name="striker_0005">Prefix</key>
<key name="striker_0006">This is a two to five character prefix used to identify this organization. It is used as the prefix for host names for dashboards, nodes and foundation pack equipment. You can use letters and numbers and set whatever makes sense to you.</key>
<key name="striker_0006">This is a one to five character prefix used to identify this organization. It is used as the prefix for host names for dashboards, nodes and foundation pack equipment. You can use letters and numbers and set whatever makes sense to you.</key>
<key name="striker_0007">Domain Name</key>
<key name="striker_0008">This is the domain name you would like to use for this dashboard. This will also be used as the default domain used when creating new install manifests.</key>
<key name="striker_0009">Sequence Number</key>
@ -1323,7 +1327,7 @@ If you are comfortable that the target has changed for a known reason, you can s
<key name="striker_0223">This is the unique name (often the host name) of this specific fence device.</key>
<key name="striker_0224">Existing fence devices:</key>
<key name="striker_0225">Confirm deleting '#!variable!name!#'</key>
<key name="striker_0226">Install Manifest; Step 1</key>
<key name="striker_0226">Install Manifest; Step #!variable!number!#</key>
<key name="striker_0227">First step are some simple questions to know what kind of Anvil! this manifest will build.</key>
<key name="striker_0228">Anvil! prefix:</key>
<key name="striker_0229">Anvil! Sequence:</key>
@ -1341,6 +1345,11 @@ If you are comfortable that the target has changed for a known reason, you can s
<key name="striker_0241">This is the IP address of the UPS. This must be reachable by nodes powered by this UPS.</key>
<key name="striker_0242">The only time to change this is if a UPS has been replaced (using the same name/IP) by a UPS of a different brand.</key>
<key name="striker_0243">Saving UPS data</key>
<key name="striker_0244">This is the sequence number for this #!string!brand_0006!#. The first #!string!brand_0006!# will be '1', the second will be '2', etc. This is used to preset IP addresses, PDU outlet positions, etc.</key>
<key name="striker_0245"><![CDATA[In most cases, there is only one <a href="https://www.alteeve.com/w/IFN" target="_new">IFN</a> on an #!string!brand_0006!#. If you have separate networks and plan to restrict certain servers to certain networks, you can install extra network interfaces into the nodes (two per IFN). If this is your plan, set this value to the number of IFNs you plan to use.]]></key>
<key name="striker_0246">This is a one to five character prefix used to identify the department, organization, or company whose servers will run on this #!string!brand_0006!#. You can use letters and numbers and set whatever makes sense to you.</key>
<key name="striker_0247">This is the domain name you would like to use for this #!string!brand_0006!#. This will be used in the next step when setting default hostnames for various devices.</key>
<key name="striker_0248">The second step specified the networks (subnets) that will be used for each network. Generally, you only want to change the IFN(s). The BCN and SN are always '/16' subnets and should only be changed if they conflict with an existing IFN.</key>
<!-- These are generally units and appended to numbers -->
<key name="suffix_0001">#!variable!number!#/sec</key>

Loading…
Cancel
Save