* Finished the "run manifest" form / page. Actually saving / pushing the job to nodes is not yet done though.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent e99bfac9be
commit 22e7e8b03e
  1. 18
      Anvil/Tools/Striker.pm
  2. 75
      Anvil/Tools/Words.pm
  3. 210
      cgi-bin/striker
  4. 271
      html/skins/alteeve/anvil.html
  5. 28
      share/words.xml

@ -777,9 +777,9 @@ The parsed manifest XML is stored as (<machine> == node1, node2 or dr1):
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::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::ntp = <NTP to use, if any>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::mtu = <MTU of network> 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::count::bcn = <number of BCNs>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::sn_count = <number of SNs> manifests::manifest_uuid::<manifest_uuid>::parsed::networks::count::sn = <number of SNs>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::ifn_count = <number of IFNs> manifests::manifest_uuid::<manifest_uuid>::parsed::networks::count::ifn = <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>::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>::subnet = <subnet mask>
manifests::manifest_uuid::<manifest_uuid>::parsed::networks::name::<network_name>::gateway = <gateway ip, if any> manifests::manifest_uuid::<manifest_uuid>::parsed::networks::name::<network_name>::gateway = <gateway ip, if any>
@ -955,13 +955,13 @@ WHERE
elsif ($network_name =~ /^sn/) { $sn_count++; } elsif ($network_name =~ /^sn/) { $sn_count++; }
elsif ($network_name =~ /^ifn/) { $ifn_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}{count}{bcn} = $bcn_count;
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{sn_count} = $sn_count; $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{count}{sn} = $sn_count;
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{ifn_count} = $ifn_count; $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{count}{ifn} = $ifn_count;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $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::count::bcn" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{count}{bcn},
"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::count::sn" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{count}{sn},
"manifests::manifest_uuid::${manifest_uuid}::parsed::networks::ifn_count" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{ifn_count}, "manifests::manifest_uuid::${manifest_uuid}::parsed::networks::count::ifn" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{count}{ifn},
}}); }});
foreach my $machine (sort {$a cmp $b} keys %{$parsed_xml->{machines}}) foreach my $machine (sort {$a cmp $b} keys %{$parsed_xml->{machines}})

@ -418,6 +418,11 @@ sub parse_banged_string
my $pair = ($variable_string =~ /^(!!.*?!.*?!!).*$/)[0]; my $pair = ($variable_string =~ /^(!!.*?!.*?!!).*$/)[0];
if (not defined $pair) if (not defined $pair)
{ {
# If we're in a web environment, print the HTML header.
if ($anvil->environment eq "html")
{
print "Content-type: text/html; charset=utf-8\n\n";
}
print $THIS_FILE." ".__LINE__."; Failed to parse the pair from: [".$variable_string."]\n"; print $THIS_FILE." ".__LINE__."; Failed to parse the pair from: [".$variable_string."]\n";
print $THIS_FILE." ".__LINE__."; Was parsing message: [".$message."] from key string: [".$key_string."]\n"; print $THIS_FILE." ".__LINE__."; Was parsing message: [".$message."] from key string: [".$key_string."]\n";
die; die;
@ -680,7 +685,15 @@ sub string
# Die if I've looped too many times. # Die if I've looped too many times.
$loops++; $loops++;
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n" if $loops > $limit; if ($loops > $limit)
{
# If we're in a web environment, print the HTML header.
if ($anvil->environment eq "html")
{
print "Content-type: text/html; charset=utf-8\n\n";
}
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n";
}
} }
my $error = "[ Error ] - The method Words->string() was asked to process the string: [".$string."] which has insertion variables, but nothing was passed to the 'variables' parameter."; my $error = "[ Error ] - The method Words->string() was asked to process the string: [".$string."] which has insertion variables, but nothing was passed to the 'variables' parameter.";
print $THIS_FILE." ".__LINE__."; $error\n" if $test; print $THIS_FILE." ".__LINE__."; $error\n" if $test;
@ -707,7 +720,15 @@ sub string
# Die if I've looped too many times. # Die if I've looped too many times.
$loops++; $loops++;
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n" if $loops > $limit; if ($loops > $limit)
{
# If we're in a web environment, print the HTML header.
if ($anvil->environment eq "html")
{
print "Content-type: text/html; charset=utf-8\n\n";
}
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language]. Is there a bad '#!<variable>!<value>!# replacement key? Exiting.\n";
}
} }
# Now, look for any '#!string!x!#' embedded strings. # Now, look for any '#!string!x!#' embedded strings.
@ -731,7 +752,15 @@ sub string
# Die if I've looped too many times. # Die if I've looped too many times.
$loops++; $loops++;
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n" if $loops > $limit; if ($loops > $limit)
{
# If we're in a web environment, print the HTML header.
if ($anvil->environment eq "html")
{
print "Content-type: text/html; charset=utf-8\n\n";
}
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n";
}
} }
# Now insert variables in the strings. # Now insert variables in the strings.
@ -767,7 +796,15 @@ sub string
# Die if I've looped too many times. # Die if I've looped too many times.
$loops++; $loops++;
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n" if $loops > $limit; if ($loops > $limit)
{
# If we're in a web environment, print the HTML header.
if ($anvil->environment eq "html")
{
print "Content-type: text/html; charset=utf-8\n\n";
}
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n";
}
} }
# Next, convert '#!data!x!#' to the value in '$anvil->data->{x}'. # Next, convert '#!data!x!#' to the value in '$anvil->data->{x}'.
@ -803,11 +840,27 @@ sub string
# Die if I've looped too many times. # Die if I've looped too many times.
$loops++; $loops++;
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n" if $loops > $limit; if ($loops > $limit)
{
# If we're in a web environment, print the HTML header.
if ($anvil->environment eq "html")
{
print "Content-type: text/html; charset=utf-8\n\n";
}
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n";
}
} }
$loops++; $loops++;
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n" if $loops > $limit; if ($loops > $limit)
{
# If we're in a web environment, print the HTML header.
if ($anvil->environment eq "html")
{
print "Content-type: text/html; charset=utf-8\n\n";
}
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n";
}
# If there are no replacement keys left, exit the loop. # If there are no replacement keys left, exit the loop.
if ($string !~ /#!([^\s]+?)!#/) if ($string !~ /#!([^\s]+?)!#/)
@ -824,7 +877,15 @@ sub string
$string =~ s/!#([^\s]+?)#!/#!$1!#/g; $string =~ s/!#([^\s]+?)#!/#!$1!#/g;
$loops++; $loops++;
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n" if $loops > $limit; if ($loops > $limit)
{
# If we're in a web environment, print the HTML header.
if ($anvil->environment eq "html")
{
print "Content-type: text/html; charset=utf-8\n\n";
}
die "$THIS_FILE ".__LINE__."; Infinite loop detected while processing the string: [".$string."] from the key: [$key] in language: [$language], exiting.\n";
}
if ($string !~ /!#[^\s]+?#!/) if ($string !~ /!#[^\s]+?#!/)
{ {

@ -1569,6 +1569,10 @@ sub run_manifest
{ {
my ($anvil) = @_; my ($anvil) = @_;
$anvil->data->{cgi}{password}{value} = "" if not defined $anvil->data->{cgi}{password}{value};
$anvil->data->{cgi}{password}{alert} = 0 if not defined $anvil->data->{cgi}{password}{alert};
$anvil->Database->get_hosts();
my $manifest_uuid = $anvil->data->{cgi}{manifest_uuid}{value}; my $manifest_uuid = $anvil->data->{cgi}{manifest_uuid}{value};
my $problem = $anvil->Striker->load_manifest({ my $problem = $anvil->Striker->load_manifest({
debug => 2, debug => 2,
@ -1587,28 +1591,6 @@ sub run_manifest
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "form::error_massage" => $anvil->data->{form}{error_massage} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "form::error_massage" => $anvil->data->{form}{error_massage} }});
} }
=cut
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::prefix = <Anvil! prefix>
manifests::manifest_uuid::<manifest_uuid>::parsed::sequence = <Anvil! sequence, zero-padded to two digits>
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>
=cut
my $anvil_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{name}; my $anvil_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{name};
my $prefix = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{prefix}; my $prefix = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{prefix};
my $sequence = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{sequence}; my $sequence = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{sequence};
@ -1623,12 +1605,27 @@ sub run_manifest
my $node1_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node1}{name}; my $node1_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node1}{name};
my $node2_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node2}{name}; my $node2_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node2}{name};
my $dr1_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{dr1}{name}; my $dr1_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{dr1}{name};
if ($domain)
{
$node1_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node1}{name}.".".$domain;
$node2_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node2}{name}.".".$domain;
$dr1_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{dr1}{name}.".".$domain;
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
node1_name => $node1_name, node1_name => $node1_name,
node2_name => $node2_name, node2_name => $node2_name,
dr1_name => $dr1_name, dr1_name => $dr1_name,
}}); }});
my $bcn_count = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{count}{bcn};
my $sn_count = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{count}{sn};
my $ifn_count = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{count}{ifn};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
bcn_count => $bcn_count,
sn_count => $sn_count,
ifn_count => $ifn_count,
}});
# If confirmed, run! # If confirmed, run!
$anvil->data->{cgi}{confirm}{value} = "" if not defined $anvil->data->{cgi}{confirm}{value}; $anvil->data->{cgi}{confirm}{value} = "" if not defined $anvil->data->{cgi}{confirm}{value};
if ($anvil->data->{cgi}{confirm}{value}) if ($anvil->data->{cgi}{confirm}{value})
@ -1638,7 +1635,6 @@ sub run_manifest
else else
{ {
# Ask the user to choose the targets and confirm the manifest settings. # Ask the user to choose the targets and confirm the manifest settings.
$anvil->Database->get_hosts();
my $nodes = []; my $nodes = [];
my $dr_hosts = []; my $dr_hosts = [];
foreach my $host_uuid (keys %{$anvil->data->{hosts}{host_uuid}}) foreach my $host_uuid (keys %{$anvil->data->{hosts}{host_uuid}})
@ -1686,7 +1682,7 @@ sub run_manifest
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { host_name => $host_name }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { host_name => $host_name }});
if ((not defined $anvil->data->{cgi}{dr1_host}{value}) && ($host_name eq $dr1_name)) if ((not defined $anvil->data->{cgi}{dr1_host}{value}) && ($host_name eq $dr1_name))
{ {
$anvil->data->{cgi}{node1_host}{value} = $host_name; $anvil->data->{cgi}{dr1_host}{value} = $host_name;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::dr1_host::value" => $anvil->data->{cgi}{dr1_host}{value} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::dr1_host::value" => $anvil->data->{cgi}{dr1_host}{value} }});
} }
} }
@ -1719,17 +1715,173 @@ sub run_manifest
options => $dr_hosts, options => $dr_hosts,
blank => 1, blank => 1,
'sort' => 1, 'sort' => 1,
selected => $anvil->data->{cgi}{dr_host}{value}, selected => $anvil->data->{cgi}{dr1_host}{value},
class => $anvil->data->{cgi}{dr_host}{alert} ? "input_alert" : "input_clear", class => $anvil->data->{cgi}{dr1_host}{alert} ? "input_alert" : "input_clear",
style => "", style => "",
}); });
# Show the networks.
my $networks = "";
my $default_seen = 0;
foreach my $network ("bcn", "sn", "ifn")
{
my $count = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{count}{$network};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
network => $network,
count => $count,
}});
foreach my $i (1..$count)
{
my $network_name = $network.$i;
my $network_range = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{name}{$network_name}{network};
my $subnet = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{name}{$network_name}{subnet};
my $gateway = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{name}{$network_name}{gateway};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
network_name => $network_name,
network_range => $network_range,
subnet => $subnet,
gateway => $gateway,
}});
my $say_default = "";
if (($network eq "ifn") && (not $default_seen) && ($gateway))
{
$default_seen = 1;
$say_default = "(#!string!striker_0249!#)";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
default_seen => $default_seen,
say_default => $say_default,
}});
}
my $network_key = "header_0036";
if ($network eq "sn") { $network_key = "header_0037"; }
elsif ($network eq "ifn") { $network_key = "header_0038"; }
$networks .= $anvil->Template->get({file => "anvil.html", name => "run-manifest-network", variables => {
name => $anvil->Words->string({key => $network_key, variables => { number => $i }}),
network => $network_range,
subnet => $subnet,
gateway => $gateway ? $gateway : "--",
'default' => $say_default,
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { networks => $networks }});
}
}
# Pull out the IPs that will be assigned to servers.
my $machine_ips = "";
foreach my $network ("bcn", "sn", "ifn")
{
if ($network eq "sn")
{
# Inject the IPMI data.
my $node1_ipmi_ip = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node1}{ipmi_ip};
my $node2_ipmi_ip = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node2}{ipmi_ip};
my $dr1_ipmi_ip = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{dr1}{ipmi_ip};
$machine_ips .= $anvil->Template->get({file => "anvil.html", name => "run-manifest-ip", variables => {
name => "#!string!striker_0258!#",
node1 => $node1_ipmi_ip ? $node1_ipmi_ip : "--",
node2 => $node2_ipmi_ip ? $node2_ipmi_ip : "--",
dr1 => $dr1_ipmi_ip ? $dr1_ipmi_ip : "--",
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { networks => $networks }});
}
my $count = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{count}{$network};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
network => $network,
count => $count,
}});
foreach my $i (1..$count)
{
my $network_name = $network.$i;
my $node1_ip = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node1}{network}{$network_name}{ip};
my $node2_ip = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node2}{network}{$network_name}{ip};
my $dr1_ip = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{dr1}{network}{$network_name}{ip};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
network_name => $network_name,
node1_ip => $node1_ip,
node2_ip => $node2_ip,
dr1_ip => $dr1_ip,
}});
my $network_key = "header_0036";
if ($network eq "sn") { $network_key = "header_0037"; }
elsif ($network eq "ifn") { $network_key = "header_0038"; }
$machine_ips .= $anvil->Template->get({file => "anvil.html", name => "run-manifest-ip", variables => {
name => $anvil->Words->string({key => $network_key, variables => { number => $i }}),
node1 => $node1_ip ? $node1_ip : "--",
node2 => $node2_ip ? $node2_ip : "--",
dr1 => $dr1_ip ? $dr1_ip : "--",
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { networks => $networks }});
}
}
=cut
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::name::<network_name>::network = <base network ip, ie: 10.255.0.0>
manifests::manifest_uuid::<manifest_uuid>::parsed::machine::<machine>::name = <host name>
manifests::manifest_uuid::<manifest_uuid>::parsed::machine::<machine>::ups::<ups_name>::used = <1 if powered by USB, 0 if not>
=cut
my $dns = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{dns};
my $ntp = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{ntp};
my $mtu = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{mtu};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
dns => $dns,
ntp => $ntp,
mtu => $mtu,
}});
my $fences = "";
foreach my $fence_name (sort {$a cmp $b} keys %{$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node1}{fence}})
{
my $node1_port = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node1}{fence}{$fence_name}{port};
my $node2_port = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node2}{fence}{$fence_name}{port};
my $dr1_port = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{dr1}{fence}{$fence_name}{port};
$fences .= $anvil->Template->get({file => "anvil.html", name => "run-manifest-fence", variables => {
name => $fence_name,
node1 => $node1_port ? $node1_port : "--",
node2 => $node2_port ? $node2_port : "--",
dr1 => $dr1_port ? $dr1_port : "--",
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { networks => $networks }});
}
my $upses = "";
foreach my $ups_name (sort {$a cmp $b} keys %{$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node1}{ups}})
{
my $node1_uses = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node1}{ups}{$ups_name}{used};
my $node2_uses = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{node2}{ups}{$ups_name}{used};
my $dr1_uses = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{dr1}{ups}{$ups_name}{used};
$upses .= $anvil->Template->get({file => "anvil.html", name => "run-manifest-ups", variables => {
name => $ups_name,
node1 => $node1_uses ? '<span class="available">#!string!unit_0001!#</span>' : '<span class="unavailable">#!string!unit_0002!#</span>',
node2 => $node2_uses ? '<span class="available">#!string!unit_0001!#</span>' : '<span class="unavailable">#!string!unit_0002!#</span>',
dr1 => $dr1_uses ? '<span class="available">#!string!unit_0001!#</span>' : '<span class="unavailable">#!string!unit_0002!#</span>',
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { networks => $networks }});
}
$anvil->data->{form}{back_link} = "?anvil=true&task=create"; $anvil->data->{form}{back_link} = "?anvil=true&task=create";
$anvil->data->{form}{refresh_link} = "?anvil=true&task=manifests&run=true&manifest_uuid=".$anvil->data->{cgi}{manifest_uuid}{value}; $anvil->data->{form}{refresh_link} = "?anvil=true&task=manifests&run=true&manifest_uuid=".$anvil->data->{cgi}{manifest_uuid}{value};
$anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "run-manifest", variables => { $anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "run-manifest", variables => {
select_node1 => $select_node1, debug => 2,
select_node2 => $select_node2, title => $anvil->Words->string({key => "striker_0270", variables => { name => $anvil_name }}),
select_dr1 => $select_dr1, password => $anvil->data->{cgi}{password}{value},
password_class => $anvil->data->{cgi}{password}{alert} ? "input_alert" : "",
fences => $fences,
upses => $upses,
networks => $networks,
dns => $dns ? $dns : "8.8.8.8,8.8.4.4",
ntp => $ntp ? $ntp : "--",
mtu => $mtu ? $mtu : "1500",
select_node1 => $select_node1,
select_node2 => $select_node2,
select_dr1 => $select_dr1,
machine_ips => $machine_ips,
}}); }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'form::body' => $anvil->data->{form}{body} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'form::body' => $anvil->data->{form}{body} }});
} }

@ -79,6 +79,116 @@
</table> </table>
<!-- end create-menu --> <!-- end create-menu -->
<!-- start run-manifest-network -->
<tr>
<td class="column_header">
<!-- Network name -->
#!variable!name!#:
</td>
<td class="column_row_value_fixed">
<!-- Network -->
#!variable!network!#
</td>
<td>
&nbsp;
</td>
<td class="column_row_value_fixed">
<!-- Subnet -->
#!variable!subnet!#
</td>
<td>
&nbsp;
</td>
<td class="column_row_value_fixed">
<!-- Gateway -->
#!variable!gateway!# #!variable!default!#
</td>
</tr>
<!-- end run-manifest-network -->
<!-- start run-manifest-ip -->
<tr>
<td class="column_header">
<!-- Network name -->
#!variable!name!#:
</td>
<td class="column_row_value_fixed">
<!-- Node 1 -->
#!variable!node1!#
</td>
<td>
&nbsp;
</td>
<td class="column_row_value_fixed">
<!-- Node 2 -->
#!variable!node2!#
</td>
<td>
&nbsp;
</td>
<td class="column_row_value_fixed">
<!-- DR Host -->
#!variable!dr1!#
</td>
</tr>
<!-- end run-manifest-ip -->
<!-- start run-manifest-fence -->
<tr>
<td class="column_header">
<!-- Fence name -->
#!variable!name!#:
</td>
<td class="column_row_value_fixed">
<!-- Node 1 -->
#!variable!node1!#
</td>
<td>
&nbsp;
</td>
<td class="column_row_value_fixed">
<!-- Node 2 -->
#!variable!node2!#
</td>
<td>
&nbsp;
</td>
<td class="column_row_value_fixed">
<!-- DR Host isn't tracked yet, but it might be in the future -->
<!-- #!variable!dr1!# -->
&nbsp;
</td>
</tr>
<!-- end run-manifest-fence -->
<!-- start run-manifest-ups -->
<tr>
<td class="column_header">
<!-- UPS name -->
#!variable!name!#:
</td>
<td class="column_row_value_fixed">
<!-- Node 1 -->
#!variable!node1!#
</td>
<td>
&nbsp;
</td>
<td class="column_row_value_fixed">
<!-- Node 2 -->
#!variable!node2!#
</td>
<td>
&nbsp;
</td>
<td class="column_row_value_fixed">
<!-- DR Host isn't tracked yet, but it might be in the future -->
<!-- #!variable!dr1!# -->
&nbsp;
</td>
</tr>
<!-- end run-manifest-ups -->
<!-- start run-manifest --> <!-- start run-manifest -->
<table align="center" class="anvil_main_menu"> <table align="center" class="anvil_main_menu">
<script type="text/javascript" src="/skins/alteeve/anvil.js"></script> <script type="text/javascript" src="/skins/alteeve/anvil.js"></script>
@ -89,7 +199,7 @@
</tr> </tr>
<tr> <tr>
<td class="title"> <td class="title">
#!string!header_0028!# #!variable!title!#
</td> </td>
</tr> </tr>
<tr> <tr>
@ -102,12 +212,6 @@
#!string!striker_0268!# #!string!striker_0268!#
</td> </td>
</tr> </tr>
<tr>
<td>
<!-- Notes -->
#!string!striker_0269!#
</td>
</tr>
<tr> <tr>
<td> <td>
&nbsp; &nbsp;
@ -117,6 +221,29 @@
<td> <td>
<form name="run_manifest" action="" method="post"> <form name="run_manifest" action="" method="post">
<table align="center" class="anvil_main_menu"> <table align="center" class="anvil_main_menu">
<tr>
<td class="column_header">
<!-- Password -->
#!string!header_0030!#:
</td>
<td colspan="5">
<input type="password" name="password1" id="password1" value="#!variable!password!#" placeholder="#!string!striker_0271!#" class="#!variable!password_class!#"/>
</td>
</tr>
<tr>
<td class="column_header">
<!-- Confirm Password -->
#!string!header_0031!#:
</td>
<td colspan="5">
<input type="password" name="password2" id="password2" value="#!variable!password!#" placeholder="#!string!header_0031!#" class="#!variable!password_class!#"/>
</td>
</tr>
<tr>
<td colspan="6">
&nbsp;
</td>
</tr>
<tr> <tr>
<td> <td>
&nbsp; &nbsp;
@ -161,6 +288,102 @@
#!variable!select_dr1!# #!variable!select_dr1!#
</td> </td>
</tr> </tr>
#!variable!machine_ips!#
<tr>
<td colspan="6">
&nbsp;
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td class="column_header" colspan="5">
<!-- Fence Port -->
#!string!striker_0262!#:
</td>
</tr>
#!variable!fences!#
<tr>
<td colspan="6">
&nbsp;
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td class="column_header" colspan="5">
<!-- UPSes -->
#!string!striker_0264!#:
</td>
</tr>
#!variable!upses!#
<tr>
<td colspan="6">
&nbsp;
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td class="column_header">
<!-- Network -->
#!string!striker_0149!#
</td>
<td>
&nbsp;
</td>
<td class="column_header">
<!-- Subnet -->
#!string!striker_0025!#
</td>
<td>
&nbsp;
</td>
<td class="column_header">
<!-- Gateway -->
#!string!striker_0026!#
</td>
</tr>
#!variable!networks!#
<tr>
<td>
&nbsp;
</td>
<td class="column_header" colspan="5">
<!-- Network Common -->
#!string!header_0035!#
</td>
</tr>
<tr>
<td class="column_header">
<!-- DNS -->
#!string!header_0032!#:
</td>
<td class="column_row_value_fixed" colspan="5">
#!variable!dns!#
</td>
</tr>
<tr>
<td class="column_header">
<!-- NTP -->
#!string!header_0033!#:
</td>
<td class="column_row_value_fixed" colspan="5">
#!variable!ntp!#
</td>
</tr>
<tr>
<td class="column_header">
<!-- MTU -->
#!string!header_0034!#:
</td>
<td class="column_row_value_fixed" colspan="5">
#!variable!mtu!#
</td>
</tr>
<tr> <tr>
<td colspan="6"> <td colspan="6">
&nbsp; &nbsp;
@ -192,47 +415,27 @@
<table class="centered"> <table class="centered">
<tr style="border: 1px dotted #7f7f7f;"> <tr style="border: 1px dotted #7f7f7f;">
<td class="column_header"> <td class="column_header">
<!-- Prefix --> <!-- Notes -->
#!string!striker_0228!# &nbsp; #!string!striker_0269!#: &nbsp;
</td> </td>
<td> <td>
#!string!striker_0246!# #!string!striker_0272!#
</td> </td>
</tr> </tr>
<tr style="border: 1px dotted #7f7f7f;"> <tr style="border: 1px dotted #7f7f7f;">
<td class="column_header"> <td class="column_header">
<!-- Domain --> &nbsp;
#!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>
<td> <td>
#!string!striker_0245!# #!string!striker_0273!#
</td> </td>
</tr> </tr>
<tr style="border: 1px dotted #7f7f7f;"> <tr style="border: 1px dotted #7f7f7f;">
<td class="column_header"> <td class="column_header">
<!-- Password note --> &nbsp;
#!string!striker_0051!#
</td> </td>
<td> <td>
#!string!striker_0259!# #!string!striker_0274!#
</td> </td>
</tr> </tr>
</table> </table>

@ -217,7 +217,16 @@ The error was:
<key name="header_0026">Host Name</key> <key name="header_0026">Host Name</key>
<key name="header_0027">Brand</key> <key name="header_0027">Brand</key>
<key name="header_0028">Install Manifest</key> <key name="header_0028">Install Manifest</key>
<key name="header_0029">Machine</key> <key name="header_0029">Select Machine</key>
<key name="header_0030">#!string!brand_0006!# Password</key>
<key name="header_0031">Confirm Password</key>
<key name="header_0032">DNS Server(s)</key>
<key name="header_0033">NTP Server(s)</key>
<key name="header_0034">MTU Size (Bytes)</key>
<key name="header_0035">Network common</key>
<key name="header_0036">BCN link #!variable!number!#</key>
<key name="header_0037">SN link #!variable!number!#</key>
<key name="header_0038">IFN link #!variable!number!#</key>
<!-- Strings used by jobs --> <!-- Strings used by jobs -->
<key name="job_0001">Configure Network</key> <key name="job_0001">Configure Network</key>
@ -1390,16 +1399,13 @@ If you are comfortable that the target has changed for a known reason, you can s
<key name="striker_0265">If the machine is powered by a given UPS, click to check the corresponding box. This information will be used in power loss events to decide what machine should host servers, which should be powered off during load-shed conditions and when to gracefully power off entirely.</key> <key name="striker_0265">If the machine is powered by a given UPS, click to check the corresponding box. This information will be used in power loss events to decide what machine should host servers, which should be powered off during load-shed conditions and when to gracefully power off entirely.</key>
<key name="striker_0266">If your machine has an IPMI BMC, (iDRAC, iLO, iRMC, etc), then you can enter the IP to give it here. Further details will be collected when the manifest runs. Leave blank if the machine doesn't have IPMI.</key> <key name="striker_0266">If your machine has an IPMI BMC, (iDRAC, iLO, iRMC, etc), then you can enter the IP to give it here. Further details will be collected when the manifest runs. Leave blank if the machine doesn't have IPMI.</key>
<key name="striker_0267"><![CDATA[Network: [<span class="code">#!variable!network!#</span>].]]></key> <key name="striker_0267"><![CDATA[Network: [<span class="code">#!variable!network!#</span>].]]></key>
<key name="striker_0268"><![CDATA[Below is the install manifest you've selected to run. Please be sure that the details match how you want the nodes and, optionally, DR host to be set to.]]></key> <key name="striker_0268"><![CDATA[Please be sure that the details match how you want your #!string!brand_0006!# to be configured.]]></key>
<key name="striker_0269"><![CDATA[ <key name="striker_0269">Notes</key>
A few notes:<br /> <key name="striker_0270">Run manifest: [#!variable!name!#]:</key>
<br /> <key name="striker_0271">Set all passwords to...</key>
<ul> <key name="striker_0272"><![CDATA[A node that is found to be running a server will <b>NOT</b> be changed, except to configure passwordless SSH to the peer node and/or DR host. As such, it is safe to run this manifest when adding a rebuilt node or adding a DR host to a live #!string!brand_0006!# system.]]></key>
<li>A node that is found to be running a server will <b>NOT</b> be changed, except to configure passwordless SSH to the peer node and/or DR host. As such, it is safe to run this manifest when adding a rebuilt node or adding a DR host to a live #!string!brand_0006!# system.</li> <key name="striker_0273">Adding a disaster recovery (DR) host is optional. You can add one later if you don't have one now.</key>
<li>Adding a disaster recovery (DR) host is optional. You can add one later if you don't have one now.</li> <key name="striker_0274">If there are no servers on either node (as it a new #!string!brand_0006!# build), the OSes will be updated. Otherwise, they won't be updated. If the kernel is updated, or the network reconfigured, the node will be rebooted.</key>
<li>If there are no servers on either node (as it a new #!string!brand_0006!# build), the OSes will be updated. Otherwise, they won't be updated. If the kernel is updated, or the network reconfigured, the node will be rebooted.</li>
</ul>
]]></key>
<!-- These are generally units and appended to numbers --> <!-- These are generally units and appended to numbers -->
<key name="suffix_0001">#!variable!number!#/sec</key> <key name="suffix_0001">#!variable!number!#/sec</key>

Loading…
Cancel
Save