* Fixed a bug in Striker->load_manifest where when a single fence device or UPS was defined, the XML would fail to parse.

* Added a null entry when editing a manifest when no UPSes have been defined.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent 82acb4e104
commit f8a466a963
  1. 86
      Anvil/Tools/Striker.pm
  2. 7
      cgi-bin/striker
  3. 30
      html/skins/alteeve/anvil.html
  4. 3
      share/words.xml

@ -933,23 +933,49 @@ WHERE
"manifests::manifest_uuid::${manifest_uuid}::parsed::sequence" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{sequence},
}});
foreach my $hash_ref (@{$parsed_xml->{upses}{ups}})
if (ref($parsed_xml->{upses}{ups}) eq "HASH")
{
my $ups_name = $hash_ref->{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{upses}{$ups_name}{uuid} = $hash_ref->{uuid};
# Only a single ups device
my $ups_name = $parsed_xml->{upses}{ups}{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{upses}{$ups_name}{uuid} = $parsed_xml->{upses}{ups}{uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"manifests::manifest_uuid::${manifest_uuid}::parsed::upses::${ups_name}::uuid" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{upses}{$ups_name}{uuid},
}});
}
elsif (ref($parsed_xml->{fences}{fence}) eq "ARRAY")
{
# Two or more UPSes
foreach my $hash_ref (@{$parsed_xml->{upses}{ups}})
{
my $ups_name = $hash_ref->{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{upses}{$ups_name}{uuid} = $hash_ref->{uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"manifests::manifest_uuid::${manifest_uuid}::parsed::upses::${ups_name}::uuid" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{upses}{$ups_name}{uuid},
}});
}
}
foreach my $hash_ref (@{$parsed_xml->{fences}{fence}})
if (ref($parsed_xml->{fences}{fence}) eq "HASH")
{
my $fence_name = $hash_ref->{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{fences}{$fence_name}{uuid} = $hash_ref->{uuid};
# Only a single fence device
my $fence_name = $parsed_xml->{fences}{fence}{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{fences}{$fence_name}{uuid} = $parsed_xml->{fences}{fence}{uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"manifests::manifest_uuid::${manifest_uuid}::parsed::fences::${fence_name}::uuid" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{fences}{$fence_name}{uuid},
}});
}
elsif (ref($parsed_xml->{fences}{fence}) eq "ARRAY")
{
# Two or more fence devices.
foreach my $hash_ref (@{$parsed_xml->{fences}{fence}})
{
my $fence_name = $hash_ref->{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{fences}{$fence_name}{uuid} = $hash_ref->{uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"manifests::manifest_uuid::${manifest_uuid}::parsed::fences::${fence_name}::uuid" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{fences}{$fence_name}{uuid},
}});
}
}
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{dns} = $parsed_xml->{networks}{dns};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{networks}{ntp} = $parsed_xml->{networks}{ntp};
@ -995,23 +1021,51 @@ WHERE
"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}})
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"ref(parsed_xml->{machines}{$machine}{upses}{ups})" => ref($parsed_xml->{machines}{$machine}{upses}{ups}),
}});
if (ref($parsed_xml->{machines}{$machine}{upses}{ups}) eq "HASH")
{
my $fence_name = $hash_ref->{name};
$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::${machine}::fence::${fence_name}::port" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{fence}{$fence_name}{port},
my $ups_name = $parsed_xml->{machines}{$machine}{upses}{ups}{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{ups}{$ups_name}{used} = $parsed_xml->{machines}{$machine}{upses}{ups}{used};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"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},
}});
}
elsif (ref($parsed_xml->{machines}{$machine}{upses}{ups}) eq "ARRAY")
{
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}{$machine}{ups}{$ups_name}{used} = $hash_ref->{used};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"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}{upses}{ups}})
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"ref(parsed_xml->{machines}{$machine}{fences}{fence})" => ref($parsed_xml->{machines}{$machine}{fences}{fence}),
}});
if (ref($parsed_xml->{machines}{$machine}{fences}{fence}) eq "HASH")
{
my $ups_name = $hash_ref->{name};
$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::${machine}::ups::${ups_name}::used" => $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{ups}{$ups_name}{used},
my $fence_name = $parsed_xml->{machines}{$machine}{fences}{fence}{name};
$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine}{fence}{$fence_name}{port} = $parsed_xml->{machines}{$machine}{fences}{fence}{port};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"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},
}});
}
elsif (ref($parsed_xml->{machines}{$machine}{fences}{fence}) eq "ARRAY")
{
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}{$machine}{fence}{$fence_name}{port} = $hash_ref->{port};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"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}{networks}{network}})
{

@ -2910,6 +2910,13 @@ sub handle_manifest
my $ups_form = "";
$anvil->Database->get_upses({});
my $ups_count = keys %{$anvil->data->{upses}{ups_name}};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { ups_count => $ups_count }});
if (not $ups_count)
{
# No UPSes, add a blank entry.
$ups_form .= $anvil->Template->get({file => "anvil.html", name => "manifest-step3-ups-null-entry"});
}
foreach my $ups_name (sort {$a cmp $b} keys %{$anvil->data->{upses}{ups_name}})
{
### NOTE: For now, we don't care about DR UPSes. As such, the code to track it is

@ -972,6 +972,24 @@
</tr>
<!-- end manifest-step3-ups-entry -->
<!-- start manifest-step3-ups-null-entry -->
<tr>
<td class="column_header">
<!-- No UPS -->
#!string!striker_0277!#: &nbsp;
</td>
<td class="fixed_width_no_wrap">
<input type="checkbox" name="null" disabled /> &nbsp;
</td>
<td class="fixed_width_no_wrap">
<input type="checkbox" name="null" disabled /> &nbsp;
</td>
<td class="fixed_width_no_wrap">
&nbsp;
</td>
</tr>
<!-- end manifest-step3-ups-null-entry -->
<!-- start manifest-step3 -->
<table align="center" class="anvil_main_menu">
<script type="text/javascript" src="/skins/alteeve/anvil.js"></script>
@ -1107,6 +1125,12 @@
<tr>
<td colspan="2">
<table class="centered">
#!variable!network_note!#
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- IPMI IP -->
@ -1143,12 +1167,6 @@
#!string!striker_0265!#
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
#!variable!network_note!#
</table>
</td>
</tr>

@ -1578,7 +1578,7 @@ If you are comfortable that the target has changed for a known reason, you can s
<key name="striker_0258">IPMI IP</key>
<key name="striker_0259"><![CDATA[<span class="notice">Note</span>: The password to use for an #!string!brand_0006!# will be asked when the manifest is actually run. The password is not stored in the manifest.]]></key>
<key name="striker_0260">IPMI Details</key>
<key name="striker_0261"><![CDATA[<span class="notice">Note</span>: The IPMI information is set when a node is initialized. The only thing set here is the IP address.]]></key>
<key name="striker_0261"><![CDATA[<span class="notice">Note</span>: The IPMI information is set when a node is initialized if an IPMI BMC is found. Only the IP address is needed.]]></key>
<key name="striker_0262">Fence Port</key>
<key name="striker_0263">This is the "port" (outlet, name or other ID) that the associated fence device uses to terminate the target node. This could be the outlet number on a PDU, VM name on a hypervisor host, etc.</key>
<key name="striker_0264">Powered By UPS</key>
@ -1594,6 +1594,7 @@ If you are comfortable that the target has changed for a known reason, you can s
<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>
<key name="striker_0275">Free-form description of this system.</key>
<key name="striker_0276">This tracks the last time a given mail server was configured for use. It allows for a round-robin switching of mail servers when one mail server stops working and two or more mail servers have been configured.</key>
<key name="striker_0277">No UPSes</key>
<!-- These are generally units and appended to numbers -->
<key name="suffix_0001">#!variable!number!#/sec</key>

Loading…
Cancel
Save