* Finished the ability to load an install manifest to edit it.

* Renamed to clarify the IP address field from ..._network to _ip.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent f0f949bcf0
commit 1e8982704e
  1. 72
      Anvil/Tools/Striker.pm
  2. 269
      cgi-bin/striker
  3. 11
      html/skins/alteeve/anvil.html

@ -766,23 +766,26 @@ The following hash is used to facilitate manifest name to UUID look up.
manifests::name_to_uuid::<manifest_name> = <manifest_uuid>
The parsed manifest XML is stored as:
manifests::manifest_uuid::<manifest_uuid>::parsed::name = <Anvil! name>
manifests::manifest_uuid::<manifest_uuid>::parsed::domain = <Anvil! domain name>
manifests::manifest_uuid::<manifest_uuid>::parsed::upses::<ups_name>::uuid = <upses -> ups_uuid of named UPS>
manifests::manifest_uuid::<manifest_uuid>::parsed::fences::<fence_name>::uuid = <fences -> fence_uuid of named fence device>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::dns = <DNS to use, default is '8.8.8.8,8.8.4.4'>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::ntp = <NTP to use, if any>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::mtu = <MTU of network>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::name::<network_name>::network = <base network ip, ie: 10.255.0.0>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::name::<network_name>::subnet = <subnet mask>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::name::<network_name>::gateway = <gateway ip, if any>
manifests::manifest_uuid::<manifest_uuid>::parsed::machine::<host_name>::type = <node1, node2 or dr1>
manifests::manifest_uuid::<manifest_uuid>::parsed::machine::<host_name>::ipmi_ip = <ip of IPMI BMC, if any>
manifests::manifest_uuid::<manifest_uuid>::parsed::machine::<host_name>::fence::<fence_name>::port = <'port' name/number (see fence agent man page)
manifests::manifest_uuid::<manifest_uuid>::parsed::machine::<host_name>::ups::<ups_name>::used = <1 if powered by USB, 0 if not>
manifests::manifest_uuid::<manifest_uuid>::parsed::machine::<host_name>::network::<network_name>::ip = <ip used on network>
The parsed manifest XML is stored as (<machine> == node1, node2 or dr1):
manifests::manifest_uuid::<manifest_uuid>::parsed::name = <Anvil! name>
manifests::manifest_uuid::<manifest_uuid>::parsed::domain = <Anvil! domain name>
manifests::manifest_uuid::<manifest_uuid>::parsed::upses::<ups_name>::uuid = <upses -> ups_uuid of named UPS>
manifests::manifest_uuid::<manifest_uuid>::parsed::fences::<fence_name>::uuid = <fences -> fence_uuid of named fence device>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::dns = <DNS to use, default is '8.8.8.8,8.8.4.4'>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::ntp = <NTP to use, if any>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::mtu = <MTU of network>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::bcn_count = <number of BCNs>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::sn_count = <number of SNs>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::ifn_count = <number of IFNs>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::name::<network_name>::network = <base network ip, ie: 10.255.0.0>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::name::<network_name>::subnet = <subnet mask>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::name::<network_name>::gateway = <gateway ip, if any>
manifests::manifest_uuid::<manifest_uuid>::parsed::machine::<machine>::name = <host name>
manifests::manifest_uuid::<manifest_uuid>::parsed::machine::<machine>::ipmi_ip = <ip of IPMI BMC, if any>
manifests::manifest_uuid::<manifest_uuid>::parsed::machine::<machine>::fence::<fence_name>::port = <'port' name/number (see fence agent man page)
manifests::manifest_uuid::<manifest_uuid>::parsed::machine::<machine>::ups::<ups_name>::used = <1 if powered by USB, 0 if not>
manifests::manifest_uuid::<manifest_uuid>::parsed::machine::<machine>::network::<network_name>::ip = <ip used on network>
B<Note>: The machines to use in each role is selected when the manifest is run. Unlike in M2, the manifest does not store machine-specific information (like MAC addresses, etc). The chosen machines at run time contain that information. Similarly, passwords are NOT stored in the manifest, and passed when the manifest is run.
@ -923,6 +926,9 @@ WHERE
"manifests::manifest_uuid::${manifest_uuid}::parsed::networks::ntp" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{ntp},
"manifests::manifest_uuid::${manifest_uuid}::parsed::networks::mtu" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{mtu},
}});
my $bcn_count = 0;
my $sn_count = 0;
my $ifn_count = 0;
foreach my $hash_ref (@{$parsed_xml->{networks}{network}})
{
my $network_name = $hash_ref->{name};
@ -934,42 +940,52 @@ WHERE
"manifests::manifest_uuid::${manifest_uuid}::parsed::networks::name::${network_name}::subnet" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{name}{$network_name}{subnet},
"manifests::manifest_uuid::${manifest_uuid}::parsed::networks::name::${network_name}::gateway" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{name}{$network_name}{gateway},
}});
if ($network_name =~ /^bcn/) { $bcn_count++; }
elsif ($network_name =~ /^sn/) { $sn_count++; }
elsif ($network_name =~ /^ifn/) { $ifn_count++; }
}
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{bcn_count} = $bcn_count;
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{sn_count} = $sn_count;
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{ifn_count} = $ifn_count;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"manifests::manifest_uuid::${manifest_uuid}::parsed::networks::bcn_count" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{bcn_count},
"manifests::manifest_uuid::${manifest_uuid}::parsed::networks::sn_count" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{sn_count},
"manifests::manifest_uuid::${manifest_uuid}::parsed::networks::ifn_count" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{ifn_count},
}});
foreach my $machine (sort {$a cmp $b} keys %{$parsed_xml->{machines}})
{
my $host_name = $parsed_xml->{machines}{$machine}{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$host_name}{type} = $machine;
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$host_name}{ipmi_ip} = $parsed_xml->{machines}{$machine}{ipmi_ip};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{name} = $parsed_xml->{machines}{$machine}{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{ipmi_ip} = $parsed_xml->{machines}{$machine}{ipmi_ip};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"manifests::manifest_uuid::${manifest_uuid}::parsed::machine::${host_name}::type" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$host_name}{type},
"manifests::manifest_uuid::${manifest_uuid}::parsed::machine::${host_name}::ipmi_ip" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$host_name}{ipmi_ip},
"manifests::manifest_uuid::${manifest_uuid}::parsed::machine::${machine}::type" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{type},
"manifests::manifest_uuid::${manifest_uuid}::parsed::machine::${machine}::ipmi_ip" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{ipmi_ip},
}});
foreach my $hash_ref (@{$parsed_xml->{machines}{$machine}{fences}{fence}})
{
my $fence_name = $hash_ref->{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$host_name}{fence}{$fence_name}{port} = $hash_ref->{port};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{fence}{$fence_name}{port} = $hash_ref->{port};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"manifests::manifest_uuid::${manifest_uuid}::parsed::machine::${host_name}::fence::${fence_name}::port" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$host_name}{fence}{$fence_name}{port},
"manifests::manifest_uuid::${manifest_uuid}::parsed::machine::${machine}::fence::${fence_name}::port" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{fence}{$fence_name}{port},
}});
}
foreach my $hash_ref (@{$parsed_xml->{machines}{$machine}{upses}{ups}})
{
my $ups_name = $hash_ref->{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$host_name}{ups}{$ups_name}{used} = $hash_ref->{used};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{ups}{$ups_name}{used} = $hash_ref->{used};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"manifests::manifest_uuid::${manifest_uuid}::parsed::machine::${host_name}::ups::${ups_name}::used" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$host_name}{ups}{$ups_name}{used},
"manifests::manifest_uuid::${manifest_uuid}::parsed::machine::${machine}::ups::${ups_name}::used" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{ups}{$ups_name}{used},
}});
}
foreach my $hash_ref (@{$parsed_xml->{machines}{$machine}{networks}{network}})
{
my $network_name = $hash_ref->{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$host_name}{network}{$network_name}{ip} = $hash_ref->{ip};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{network}{$network_name}{ip} = $hash_ref->{ip};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"manifests::manifest_uuid::${manifest_uuid}::parsed::machine::${host_name}::network::${network_name}::ip" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$host_name}{network}{$network_name}{ip},
"manifests::manifest_uuid::${manifest_uuid}::parsed::machine::${machine}::network::${network_name}::ip" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{network}{$network_name}{ip},
}});
}
}

@ -1541,11 +1541,11 @@ sub handle_manifest
$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}{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}{value} = 0 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}{sn_count}{value} = 1 if not defined $anvil->data->{cgi}{sn_count}{value};
$anvil->data->{cgi}{sn_count}{value} = 0 if not defined $anvil->data->{cgi}{sn_count}{value};
$anvil->data->{cgi}{sn_count}{alert} = 0 if not defined $anvil->data->{cgi}{sn_count}{alert};
$anvil->data->{cgi}{ifn_count}{value} = 1 if not defined $anvil->data->{cgi}{ifn_count}{value};
$anvil->data->{cgi}{ifn_count}{value} = 0 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->data->{cgi}{dns}{value} = "8.8.8.8,8.8.4.4" if not defined $anvil->data->{cgi}{dns}{value};
$anvil->data->{cgi}{dns}{alert} = 0 if not defined $anvil->data->{cgi}{dns}{alert};
@ -1624,6 +1624,162 @@ sub handle_manifest
}
}
# If we have an actual manifest_uuid, load it and preset values.
if ((exists $anvil->data->{cgi}{manifest_uuid}) && ($anvil->data->{cgi}{manifest_uuid}{value} ne "new"))
{
my $manifest_uuid = $anvil->data->{cgi}{manifest_uuid}{value};
my $failed = $anvil->Striker->load_manifest({
debug => 2,
manifest_uuid => $manifest_uuid,
});
if (not $failed)
{
# Walk through the parsed manifest and set any undefined CGI.
if ($anvil->data->{cgi}{step}{value} eq "1")
{
if ($anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{name} =~ /^(.*?)-anvil-(\d+)$/)
{
my $prefix = $1;
my $sequence = $2;
$sequence =~ s/^0+//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
prefix => $prefix,
sequence => $sequence,
}});
if (not $anvil->data->{cgi}{prefix}{value})
{
$anvil->data->{cgi}{prefix}{value} = $prefix;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::prefix::value" => $anvil->data->{cgi}{prefix}{value} }});
}
if (not $anvil->data->{cgi}{sequence}{value})
{
$anvil->data->{cgi}{sequence}{value} = $sequence;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::sequence::value" => $anvil->data->{cgi}{sequence}{value} }});
}
}
if (not $anvil->data->{cgi}{domain}{value})
{
$anvil->data->{cgi}{domain}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{domain};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::domain::value" => $anvil->data->{cgi}{domain}{value} }});
}
if (not $anvil->data->{cgi}{ifn_count}{value})
{
$anvil->data->{cgi}{ifn_count}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{ifn_count};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::ifn_count::value" => $anvil->data->{cgi}{ifn_count}{value} }});
}
if (not $anvil->data->{cgi}{sn_count}{value})
{
$anvil->data->{cgi}{sn_count}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{sn_count};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::sn_count::value" => $anvil->data->{cgi}{sn_count}{value} }});
}
if (not $anvil->data->{cgi}{bcn_count}{value})
{
$anvil->data->{cgi}{bcn_count}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{bcn_count};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::bcn_count::value" => $anvil->data->{cgi}{bcn_count}{value} }});
}
}
elsif ($anvil->data->{cgi}{step}{value} eq "2")
{
if (not $anvil->data->{cgi}{dns}{value})
{
$anvil->data->{cgi}{dns}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{dns};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::dns::value" => $anvil->data->{cgi}{dns}{value} }});
}
if (not $anvil->data->{cgi}{ntp}{value})
{
$anvil->data->{cgi}{ntp}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{ntp};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::ntp::value" => $anvil->data->{cgi}{ntp}{value} }});
}
if (not $anvil->data->{cgi}{mtu}{value})
{
$anvil->data->{cgi}{mtu}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{mtu};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::mtu::value" => $anvil->data->{cgi}{mtu}{value} }});
}
foreach my $network ("bcn", "sn", "ifn")
{
my $count_key = $network."_count";
foreach my $i (1..$anvil->data->{cgi}{$count_key}{value})
{
my $network_name = $network.$i;
my $network_key = $network_name."_network";
my $subnet_key = $network_name."_subnet";
my $gateway_key = $network_name."_gateway";
if (not defined $anvil->data->{cgi}{$network_key}{value})
{
$anvil->data->{cgi}{$network_key}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{name}{$network_name}{network};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::${network_key}::value" => $anvil->data->{cgi}{$network_key}{value} }});
}
if (not defined $anvil->data->{cgi}{$subnet_key}{value})
{
$anvil->data->{cgi}{$subnet_key}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{name}{$network_name}{subnet};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::${subnet_key}::value" => $anvil->data->{cgi}{$subnet_key}{value} }});
}
if (not defined $anvil->data->{cgi}{$gateway_key}{value})
{
$anvil->data->{cgi}{$gateway_key}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{name}{$network_name}{gateway};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::${gateway_key}::value" => $anvil->data->{cgi}{$gateway_key}{value} }});
}
}
}
}
elsif ($anvil->data->{cgi}{step}{value} eq "3")
{
foreach my $machine ("node1", "node2", "dr1")
{
my $ipmi_ip_key = $machine."_ipmi_ip";
if (not defined $anvil->data->{cgi}{$ipmi_ip_key}{value})
{
$anvil->data->{cgi}{$ipmi_ip_key}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{ipmi_ip};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::${ipmi_ip_key}::value" => $anvil->data->{cgi}{$ipmi_ip_key}{value} }});
}
foreach my $network ("bcn", "sn", "ifn")
{
my $count_key = $network."_count";
foreach my $i (1..$anvil->data->{cgi}{$count_key}{value})
{
my $network_name = $network.$i;
my $ip_key = $machine."_".$network_name."_ip";
if (not defined $anvil->data->{cgi}{$ip_key}{value})
{
$anvil->data->{cgi}{$ip_key}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{network}{$network_name}{ip};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::${ip_key}::value" => $anvil->data->{cgi}{$ip_key}{value} }});
}
}
}
# UPSes
foreach my $ups_name (sort {$a cmp $b} keys %{$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{ups}})
{
my $checked = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{ups}{$ups_name}{used} ? "checked" : "";
my $ups_key = $machine."_ups_".$ups_name;
if (not defined $anvil->data->{cgi}{$ups_key}{value})
{
$anvil->data->{cgi}{$ups_key}{value} = $checked;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::${ups_key}::value" => $anvil->data->{cgi}{$ups_key}{value} }});
}
}
# Fences
foreach my $fence_name (sort {$a cmp $b} keys %{$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{fence}})
{
my $fence_key = $machine."_fence_".$fence_name;
if (not defined $anvil->data->{cgi}{$fence_key}{value})
{
$anvil->data->{cgi}{$fence_key}{value} = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{fence}{$fence_name}{port};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::${fence_key}::value" => $anvil->data->{cgi}{$fence_key}{value} }});
}
}
}
}
}
}
# 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")
{
@ -1685,14 +1841,17 @@ sub handle_manifest
$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
{
# Load an existing manifest.
#$anvil->Striker->load_manifest({
# debug => 2,
# manifest_uuid => $anvil->data->{cgi}{manifest_uuid}{value},
#});
# NOTE: The user can't choose the BCN or SN yet, but that might change so we treat it as configurable now.
if (not $anvil->data->{cgi}{sn_count}{value})
{
$anvil->data->{cgi}{sn_count}{value} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::sn_count::value" => $anvil->data->{cgi}{sn_count}{value} }});
}
if (not $anvil->data->{cgi}{bcn_count}{value})
{
$anvil->data->{cgi}{bcn_count}{value} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::bcn_count::value" => $anvil->data->{cgi}{bcn_count}{value} }});
}
}
# Step 1 menu.
@ -1708,6 +1867,10 @@ sub handle_manifest
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" : "",
sn_count => $anvil->data->{cgi}{sn_count}{value},
sn_count_class => $anvil->data->{cgi}{sn_count}{alert} ? "input_alert" : "",
bcn_count => $anvil->data->{cgi}{bcn_count}{value},
bcn_count_class => $anvil->data->{cgi}{bcn_count}{alert} ? "input_alert" : "",
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'form::body' => $anvil->data->{form}{body} }});
}
@ -1903,21 +2066,21 @@ sub handle_manifest
if ($network eq "sn") { $say_network_code = "striker_0020"; }
elsif ($network eq "ifn") { $say_network_code = "striker_0022"; }
my $say_network = $anvil->Words->string({key => $say_network_code, variables => { number => $i }});
my $network_key = $network.$i."_network";
my $subnet_key = $network.$i."_subnet";
my $gateway_key = $network.$i."_gateway";
my $node1_network_key = "node1_".$network.$i."_network";
my $node2_network_key = "node2_".$network.$i."_network";
my $dr1_network_key = "dr1_".$network.$i."_network";
my $say_network = $anvil->Words->string({key => $say_network_code, variables => { number => $i }});
my $network_key = $network.$i."_network";
my $subnet_key = $network.$i."_subnet";
my $gateway_key = $network.$i."_gateway";
my $node1_ip_key = "node1_".$network.$i."_ip";
my $node2_ip_key = "node2_".$network.$i."_ip";
my $dr1_ip_key = "dr1_".$network.$i."_ip";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
say_bcn => $say_network,
network_key => $network_key,
subnet_key => $subnet_key,
gateway_key => $gateway_key,
node1_network_key => $node1_network_key,
node2_network_key => $node2_network_key,
dr1_network_key => $dr1_network_key,
say_bcn => $say_network,
network_key => $network_key,
subnet_key => $subnet_key,
gateway_key => $gateway_key,
node1_ip_key => $node1_ip_key,
node2_ip_key => $node2_ip_key,
dr1_ip_key => $dr1_ip_key,
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${network_key}::value" => $anvil->data->{cgi}{$network_key}{value},
@ -1949,13 +2112,13 @@ sub handle_manifest
host_ip => $host_ip,
}});
$anvil->data->{cgi}{$node1_network_key}{value} = $host_ip.".1" if not defined $anvil->data->{cgi}{$node1_network_key}{value};
$anvil->data->{cgi}{$node2_network_key}{value} = $host_ip.".2" if not defined $anvil->data->{cgi}{$node2_network_key}{value};
$anvil->data->{cgi}{$dr1_network_key}{value} = $host_ip.".3" if not defined $anvil->data->{cgi}{$dr1_network_key}{value};
$anvil->data->{cgi}{$node1_ip_key}{value} = $host_ip.".1" if not defined $anvil->data->{cgi}{$node1_ip_key}{value};
$anvil->data->{cgi}{$node2_ip_key}{value} = $host_ip.".2" if not defined $anvil->data->{cgi}{$node2_ip_key}{value};
$anvil->data->{cgi}{$dr1_ip_key}{value} = $host_ip.".3" if not defined $anvil->data->{cgi}{$dr1_ip_key}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${node1_network_key}::value" => $anvil->data->{cgi}{$node1_network_key}{value},
"cgi::${node2_network_key}::value" => $anvil->data->{cgi}{$node2_network_key}{value},
"cgi::${dr1_network_key}::value" => $anvil->data->{cgi}{$dr1_network_key}{value},
"cgi::${node1_ip_key}::value" => $anvil->data->{cgi}{$node1_ip_key}{value},
"cgi::${node2_ip_key}::value" => $anvil->data->{cgi}{$node2_ip_key}{value},
"cgi::${dr1_ip_key}::value" => $anvil->data->{cgi}{$dr1_ip_key}{value},
}});
# If this is the BCN and $i = 1, build the IPMI IP guess.
@ -1980,31 +2143,31 @@ sub handle_manifest
}
# It should never happen, but in case the regex missed, set the guessed IPs to empty strings.
$anvil->data->{cgi}{$node1_network_key}{value} = "" if not $anvil->data->{cgi}{$node1_network_key}{value};
$anvil->data->{cgi}{$node2_network_key}{value} = "" if not $anvil->data->{cgi}{$node2_network_key}{value};
$anvil->data->{cgi}{$dr1_network_key}{value} = "" if not $anvil->data->{cgi}{$dr1_network_key}{value};
$anvil->data->{cgi}{$node1_ip_key}{value} = "" if not $anvil->data->{cgi}{$node1_ip_key}{value};
$anvil->data->{cgi}{$node2_ip_key}{value} = "" if not $anvil->data->{cgi}{$node2_ip_key}{value};
$anvil->data->{cgi}{$dr1_ip_key}{value} = "" if not $anvil->data->{cgi}{$dr1_ip_key}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${node1_network_key}::value" => $anvil->data->{cgi}{$node1_network_key}{value},
"cgi::${node2_network_key}::value" => $anvil->data->{cgi}{$node2_network_key}{value},
"cgi::${dr1_network_key}::value" => $anvil->data->{cgi}{$dr1_network_key}{value},
"cgi::${node1_ip_key}::value" => $anvil->data->{cgi}{$node1_ip_key}{value},
"cgi::${node2_ip_key}::value" => $anvil->data->{cgi}{$node2_ip_key}{value},
"cgi::${dr1_ip_key}::value" => $anvil->data->{cgi}{$dr1_ip_key}{value},
}});
$network_form .= $anvil->Template->get({file => "anvil.html", name => "manifest-step3-network-entry", variables => {
network => $say_network,
network_name => $network_key,
network_value => $anvil->data->{cgi}{$network_key}{value},
subnet_name => $subnet_key,
subnet_value => $anvil->data->{cgi}{$subnet_key}{value},
gateway_name => $gateway_key,
gateway_value => $anvil->data->{cgi}{$gateway_key}{value},
node1_network_name => $node1_network_key,
node1_network_value => $anvil->data->{cgi}{$node1_network_key}{value},
node1_network_class => $anvil->data->{cgi}{$node1_network_key}{alert} ? "input_alert" : "",
node2_network_name => $node2_network_key,
node2_network_value => $anvil->data->{cgi}{$node2_network_key}{value},
node2_network_class => $anvil->data->{cgi}{$node2_network_key}{alert} ? "input_alert" : "",
dr1_network_name => $dr1_network_key,
dr1_network_value => $anvil->data->{cgi}{$dr1_network_key}{value},
dr1_network_class => $anvil->data->{cgi}{$dr1_network_key}{alert} ? "input_alert" : "",
network => $say_network,
network_name => $network_key,
network_value => $anvil->data->{cgi}{$network_key}{value},
subnet_name => $subnet_key,
subnet_value => $anvil->data->{cgi}{$subnet_key}{value},
gateway_name => $gateway_key,
gateway_value => $anvil->data->{cgi}{$gateway_key}{value},
node1_ip_name => $node1_ip_key,
node1_ip_value => $anvil->data->{cgi}{$node1_ip_key}{value},
node1_ip_class => $anvil->data->{cgi}{$node1_ip_key}{alert} ? "input_alert" : "",
node2_ip_name => $node2_ip_key,
node2_ip_value => $anvil->data->{cgi}{$node2_ip_key}{value},
node2_ip_class => $anvil->data->{cgi}{$node2_ip_key}{alert} ? "input_alert" : "",
dr1_ip_name => $dr1_ip_key,
dr1_ip_value => $anvil->data->{cgi}{$dr1_ip_key}{value},
dr1_ip_class => $anvil->data->{cgi}{$dr1_ip_key}{alert} ? "input_alert" : "",
}});
}
}

@ -82,7 +82,7 @@
<!-- start create-menu-existing-manifest-entry -->
<tr style="border: 1px dotted #7f7f7f;">
<td>
<a href="?anvil=true&task=manifest&edit=true&manifest_uuid=#!variable!manifest_uuid!#" class="fixed_link_highlight">#!variable!manifest_name!#</a> &nbsp;
<a href="?anvil=true&task=manifests&manifest_uuid=#!variable!manifest_uuid!#&step=1" class="fixed_link_highlight">#!variable!manifest_name!#</a> &nbsp;
</td>
<td style="text-align: center;">
<a href="?anvil=true&task=manifest&run=true&manifest_uuid=#!variable!manifest_uuid!#"><img src="#!data!skin::url!#/images/run.png" alt="#!string!striker_0206!#" style="height: .8em;"></a>
@ -159,6 +159,9 @@
</td>
<td>
<input type="number" name="ifn_count" id="ifn_count" value="#!variable!ifn_count!#" placeholder="1" class="#!variable!ifn_count_class!#"/>
<!-- Note: Currently, the user can't choose the number of BCN and SNs. However, this may change later, so we already setup for it. -->
<input type="hidden" name="sn_count" id="sn_count" value="#!variable!sn_count!#" />
<input type="hidden" name="bcn_count" id="bcn_count" value="#!variable!bcn_count!#" />
</td>
</tr>
<tr>
@ -502,13 +505,13 @@
<input type="hidden" name="#!variable!gateway_name!#" id="#!variable!gateway_name!#" value="#!variable!gateway_value!#" />
</td>
<td class="fixed_width_no_wrap">
<input type="text" name="#!variable!node1_network_name!#" id="#!variable!node1_network_name!#" value="#!variable!node1_network_value!#" width="15" style="width: 15em;" class="#!variable!node1_network_class!#" /> &nbsp;
<input type="text" name="#!variable!node1_ip_name!#" id="#!variable!node1_ip_name!#" value="#!variable!node1_ip_value!#" width="15" style="width: 15em;" class="#!variable!node1_ip_class!#" /> &nbsp;
</td>
<td class="fixed_width_no_wrap">
&nbsp; <input type="text" name="#!variable!node2_network_name!#" id="#!variable!node2_network_name!#" value="#!variable!node2_network_value!#" width="15" style="width: 15em;" class="#!variable!node2_network_class!#" /> &nbsp;
&nbsp; <input type="text" name="#!variable!node2_ip_name!#" id="#!variable!node2_ip_name!#" value="#!variable!node2_ip_value!#" width="15" style="width: 15em;" class="#!variable!node2_ip_class!#" /> &nbsp;
</td>
<td class="fixed_width_no_wrap">
&nbsp; <input type="text" name="#!variable!dr1_network_name!#" id="#!variable!dr1_network_name!#" value="#!variable!dr1_network_value!#" width="15" style="width: 15em;" class="#!variable!dr1_network_class!#" />
&nbsp; <input type="text" name="#!variable!dr1_ip_name!#" id="#!variable!dr1_ip_name!#" value="#!variable!dr1_ip_value!#" width="15" style="width: 15em;" class="#!variable!dr1_ip_class!#" />
</td>
</tr>
<!-- end manifest-step3-network-entry -->

Loading…
Cancel
Save