* Fixed several issues with the fence configuration menu in striker.

* Added filters Striker->get_fence_data() for parameters. Manually change 'action' entries from 'string' to 'select' and use the data in the 'actions' element to populate it, with actions that don't make sense filtered out.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent 818ef23634
commit b8c0577b54
  1. 48
      Anvil/Tools/Striker.pm
  2. 248
      cgi-bin/striker
  3. 144
      html/skins/alteeve/anvil.html
  4. 8
      html/skins/alteeve/main.css
  5. 3
      notes
  6. 10
      share/words.xml
  7. 24
      tools/test.pl

@ -129,7 +129,6 @@ sub get_fence_data
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"fences::${fence_agent}::description" => $anvil->data->{fences}{$fence_agent}{description}, "fences::${fence_agent}::description" => $anvil->data->{fences}{$fence_agent}{description},
}}); }});
if (exists $agent_ref->{'resource-agent'}->{'symlink'}) if (exists $agent_ref->{'resource-agent'}->{'symlink'})
{ {
if (ref($agent_ref->{'resource-agent'}->{'symlink'}) eq "ARRAY") if (ref($agent_ref->{'resource-agent'}->{'symlink'}) eq "ARRAY")
@ -155,7 +154,13 @@ sub get_fence_data
foreach my $hash_ref (@{$agent_ref->{'resource-agent'}->{parameters}{parameter}}) foreach my $hash_ref (@{$agent_ref->{'resource-agent'}->{parameters}{parameter}})
{ {
# We ignore some parameters that are not useful parameters in our case.
my $name = $hash_ref->{name}; my $name = $hash_ref->{name};
next if $name eq "help";
next if $name eq "version";
next if $name eq "delay";
next if $name eq "separator";
my $unique = exists $hash_ref->{unique} ? $hash_ref->{unique} : 0; my $unique = exists $hash_ref->{unique} ? $hash_ref->{unique} : 0;
my $required = exists $hash_ref->{required} ? $hash_ref->{required} : 0; my $required = exists $hash_ref->{required} ? $hash_ref->{required} : 0;
my $deprecated = exists $hash_ref->{deprecated} ? $hash_ref->{deprecated} : 0; my $deprecated = exists $hash_ref->{deprecated} ? $hash_ref->{deprecated} : 0;
@ -177,10 +182,39 @@ sub get_fence_data
"fences::${fence_agent}::parameters::${name}::switches" => $anvil->data->{fences}{$fence_agent}{parameters}{$name}{switches}, "fences::${fence_agent}::parameters::${name}::switches" => $anvil->data->{fences}{$fence_agent}{parameters}{$name}{switches},
"fences::${fence_agent}::parameters::${name}::content_type" => $anvil->data->{fences}{$fence_agent}{parameters}{$name}{content_type}, "fences::${fence_agent}::parameters::${name}::content_type" => $anvil->data->{fences}{$fence_agent}{parameters}{$name}{content_type},
}}); }});
if ($anvil->data->{fences}{$fence_agent}{parameters}{$name}{content_type} eq "string")
# 'action' is a string, but it has a set list of allowed values, so we manually switch it to a 'select' for the web interface
if ($name eq "action")
{
$anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} = exists $hash_ref->{content}->{'default'} ? $hash_ref->{content}->{'default'} : "";
$anvil->data->{fences}{$fence_agent}{parameters}{$name}{content_type} = "select";
$anvil->data->{fences}{$fence_agent}{parameters}{$name}{options} = [];
# Read the action
print "Agent: [".$fence_agent."]; actions (default: [".$anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'}."]);\n";
foreach my $array_ref (sort {$a cmp $b} @{$agent_ref->{'resource-agent'}->{actions}->{action}})
{
# There are several options that don't make sense for us.
next if $array_ref->{name} eq "list";
next if $array_ref->{name} eq "monitor";
next if $array_ref->{name} eq "manpage";
next if $array_ref->{name} eq "status";
next if $array_ref->{name} eq "validate-all";
next if $array_ref->{name} eq "list-status";
next if $array_ref->{name} eq "metadata";
next if $array_ref->{name} eq "on";
push @{$anvil->data->{fences}{$fence_agent}{parameters}{$name}{options}}, $array_ref->{name};
}
foreach my $option (sort {$a cmp $b} @{$anvil->data->{fences}{$fence_agent}{parameters}{$name}{options}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { option => $option }});
}
}
elsif ($anvil->data->{fences}{$fence_agent}{parameters}{$name}{content_type} eq "string")
{ {
my $string_default = exists $hash_ref->{content}->{'default'} ? $hash_ref->{content}->{'default'} : ""; $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} = exists $hash_ref->{content}->{'default'} ? $hash_ref->{content}->{'default'} : "";
$anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} = $string_default;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"fences::${fence_agent}::parameters::${name}::default" => $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'}, "fences::${fence_agent}::parameters::${name}::default" => $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'},
}}); }});
@ -205,8 +239,7 @@ sub get_fence_data
elsif ($anvil->data->{fences}{$fence_agent}{parameters}{$name}{content_type} eq "second") elsif ($anvil->data->{fences}{$fence_agent}{parameters}{$name}{content_type} eq "second")
{ {
# Nothing to collect here. # Nothing to collect here.
my $second_default = exists $hash_ref->{content}->{'default'} ? $hash_ref->{content}->{'default'} : ""; $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} = exists $hash_ref->{content}->{'default'} ? $hash_ref->{content}->{'default'} : "";
$anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} = $second_default;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"fences::${fence_agent}::parameters::${name}::default" => $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'}, "fences::${fence_agent}::parameters::${name}::default" => $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'},
}}); }});
@ -214,8 +247,7 @@ sub get_fence_data
elsif ($anvil->data->{fences}{$fence_agent}{parameters}{$name}{content_type} eq "integer") elsif ($anvil->data->{fences}{$fence_agent}{parameters}{$name}{content_type} eq "integer")
{ {
# Nothing to collect here. # Nothing to collect here.
my $integer_default = exists $hash_ref->{content}->{'default'} ? $hash_ref->{content}->{'default'} : ""; $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} = exists $hash_ref->{content}->{'default'} ? $hash_ref->{content}->{'default'} : "";;
$anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} = $integer_default;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"fences::${fence_agent}::parameters::${name}::default" => $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'}, "fences::${fence_agent}::parameters::${name}::default" => $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'},
}}); }});

@ -1543,7 +1543,7 @@ sub process_fences
my ($anvil) = @_; my ($anvil) = @_;
# Read/process the unified fences metadata. # Read/process the unified fences metadata.
$anvil->Striker->get_fence_data({debug => 2}); $anvil->Striker->get_fence_data({debug => 3});
$anvil->data->{cgi}{fence_agent}{value} = "" if not defined $anvil->data->{cgi}{fence_agent}{value}; $anvil->data->{cgi}{fence_agent}{value} = "" if not defined $anvil->data->{cgi}{fence_agent}{value};
$anvil->data->{cgi}{fence_count}{value} = 2 if not defined $anvil->data->{cgi}{fence_count}{value}; $anvil->data->{cgi}{fence_count}{value} = 2 if not defined $anvil->data->{cgi}{fence_count}{value};
@ -1552,6 +1552,131 @@ sub process_fences
"cgi::fence_count::value" => $anvil->data->{cgi}{fence_count}{value}, "cgi::fence_count::value" => $anvil->data->{cgi}{fence_count}{value},
}}); }});
# Are we configuring an agent/device?
if ($anvil->data->{cgi}{fence_agent}{value})
{
my $fence_agent = $anvil->data->{cgi}{fence_agent}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { fence_agent => $fence_agent }});
my $agent_description = format_fence_description($anvil, $fence_agent, $anvil->data->{fences}{$fence_agent}{description});
# Walk through the list of options
my $option_form = "";
foreach my $i (1..$anvil->data->{cgi}{fence_count}{value})
{
my $say_device = $anvil->Words->string({key => "striker_0216", variables => { number => $i }});
my $device_options = "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
i => $i,
say_device => $say_device,
}});
foreach my $name (sort {$a cmp $b} keys %{$anvil->data->{fences}{$fence_agent}{parameters}})
{
# We don't show deprecated or replaced options.
next if $anvil->data->{fences}{$fence_agent}{parameters}{$name}{replacement};
next if $anvil->data->{fences}{$fence_agent}{parameters}{$name}{deprecated};
my $option_key = $name."_".$i;
my $unique = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{unique};
my $required = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{required};
my $description = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{description};
my $type = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{content_type};
my $default = exists $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} ? $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
option_key => $option_key,
unique => $unique,
required => $required,
description => $description,
type => $type,
'default' => $default,
}});
# Set the cgi variable to the default, if not already set.
$anvil->data->{cgi}{$option_key}{value} = $default if not defined $anvil->data->{cgi}{$option_key}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::".$option_key."::value" => $anvil->data->{cgi}{$option_key}{value},
}});
# Set the CGI default if not already set.
$anvil->data->{cgi}{$option_key}{value} = $default if not exists $anvil->data->{cgi}{$option_key}{value};
if ($type eq "select")
{
# Build the select box
my $options = [];
foreach my $option (sort {$a cmp $b} @{$anvil->data->{fences}{$fence_agent}{parameters}{$name}{options}})
{
push @{$options}, $option;
}
my $select_options = $anvil->Template->select_form({
name => $option_key,
options => $options,
blank => $required ? 0 : 1,
'sort' => 1,
selected => $anvil->data->{cgi}{$option_key}{value},
class => $required ? "input_required" : "input_clear",
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { select_options => $select_options }});
# Build the entry
my $select_form .= $anvil->Template->get({file => "anvil.html", name => "fence-agent-option-entry", variables => {
name => $name,
option => $select_options,
description => $description,
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { select_form => $select_form }});
$device_options .= $select_form;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { device_options => $device_options }});
}
elsif ($type eq "boolean")
{
# Build the entry
my $checkbox_form .= $anvil->Template->get({file => "anvil.html", name => "fence-agent-checkbox-entry", variables => {
name => $name,
checkbox_name => $option_key,
checkbox_checked => $anvil->data->{cgi}{$option_key}{value} ? "checked" : "",
description => $description,
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { checkbox_form => $checkbox_form }});
$device_options .= $checkbox_form;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { device_options => $device_options }});
}
else
{
### String, Second or Integer.
# Build the entry
my $string_options .= $anvil->Template->get({file => "anvil.html", name => "fence-agent-input-entry", variables => {
name => $name,
key => $option_key,
value => $anvil->data->{cgi}{$option_key}{value},
'default' => $default,
class => $required ? "input_required" : "input_clear",,
description => $description,
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { string_options => $string_options }});
$device_options .= $string_options;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { device_options => $device_options }});
}
}
$option_form .= $anvil->Template->get({file => "anvil.html", name => "fence-agent-option-menu", variables => {
device_name => $say_device,
device_options => $device_options,
}});
}
$anvil->data->{form}{back_link} = "?anvil=true&task=fences";
$anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "fence-agent-configuration", variables => {
description => $agent_description,
options => $option_form,
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'form::body' => $anvil->data->{form}{body} }});
}
else
{
# For each agent, we'll create a <div> with it's options that will be shown/hidden basen on the agent # For each agent, we'll create a <div> with it's options that will be shown/hidden basen on the agent
# select box. # select box.
my $agents = []; my $agents = [];
@ -1569,15 +1694,53 @@ sub process_fences
push @{$agents}, $fence_agent; push @{$agents}, $fence_agent;
my $agent_description = $anvil->data->{fences}{$fence_agent}{description}; my $agent_description = format_fence_description($anvil, $fence_agent, $anvil->data->{fences}{$fence_agent}{description});
$description_form .= $anvil->Template->get({file => "anvil.html", name => "fence-agent-description", variables => {
name => $fence_agent,
description => $agent_description,
}});
}
my $fence_agent_select = $anvil->Template->select_form({
name => "fence_agent",
options => $agents,
blank => 0,
'sort' => 1,
selected => $anvil->data->{cgi}{fence_agent}{value} ? $anvil->data->{cgi}{fence_agent}{value} : "fence_apc_snmp",
class => "input_clear",
});
my $fence_count_select = $anvil->Template->select_form({
name => "fence_count",
options => [1, 2, 3, 4],
blank => 0,
'sort' => 0,
selected => $anvil->data->{cgi}{fence_count}{value},
class => "input_clear",
});
$anvil->data->{form}{back_link} = "?anvil=true&task=create";
$anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "fence-agent-menu", variables => {
fence_select => $fence_agent_select,
fence_count => $fence_count_select,
descriptions => $description_form,
existing_fences => "",
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'form::body' => $anvil->data->{form}{body} }});
}
return(0);
}
sub format_fence_description
{
my ($anvil, $fence_agent, $agent_description) = @_;
# Replace newlines with <br /> elements.
$agent_description =~ s/\n/<br \/>/gs; $agent_description =~ s/\n/<br \/>/gs;
$agent_description =~ s/<br \/>/<br \/>\n/gs; $agent_description =~ s/<br \/>/<br \/>\n/gs;
$agent_description =~ s/(http:\/\/.*)\n/<a href target="_new" target="$1">$1<\/a>/gs;
$agent_description =~ s/(https:\/\/.*)\n/<a href target="_new" target="$1">$1<\/a>/gs;
$agent_description =~ s/(http:\/\/.*) /<a href target="_new" target="$1">$1<\/a> /gs;
$agent_description =~ s/(https:\/\/.*) /<a href target="_new" target="$1">$1<\/a> /gs;
# There's a table in the fence_azure_arm agent, this formats it # Handle fence_azure_arm.
if ($fence_agent eq "fence_azure_arm") if ($fence_agent eq "fence_azure_arm")
{ {
my $in_pre = 0; my $in_pre = 0;
@ -1585,29 +1748,29 @@ sub process_fences
my $new_desctiption = ""; my $new_desctiption = "";
foreach my $line (split/\n/, $agent_description) foreach my $line (split/\n/, $agent_description)
{ {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }});
if ($line =~ /\+---/) if ($line =~ /\+---/)
{ {
$line =~ s/<br \/>//g; $line =~ s/<br \/>//g;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { break_number => $break_number }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { break_number => $break_number }});
if (not $break_number) if (not $break_number)
{ {
$in_pre = 1; $in_pre = 1;
$new_desctiption .= "<pre>\n"; $new_desctiption .= "<pre>\n";
$new_desctiption .= $line."\n"; $new_desctiption .= $line."\n";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { new_desctiption => $new_desctiption }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { new_desctiption => $new_desctiption }});
} }
elsif ($break_number == 2) elsif ($break_number == 2)
{ {
$in_pre = 0; $in_pre = 0;
$new_desctiption .= $line."\n"; $new_desctiption .= $line."\n";
$new_desctiption .= "</pre>\n"; $new_desctiption .= "</pre>\n";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { new_desctiption => $new_desctiption }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { new_desctiption => $new_desctiption }});
} }
else else
{ {
$new_desctiption .= $line."\n"; $new_desctiption .= $line."\n";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { new_desctiption => $new_desctiption }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { new_desctiption => $new_desctiption }});
} }
$break_number++; $break_number++;
} }
@ -1623,66 +1786,7 @@ sub process_fences
$agent_description = $new_desctiption; $agent_description = $new_desctiption;
} }
$description_form .= $anvil->Template->get({file => "anvil.html", name => "fence-agent-description", variables => { return($agent_description);
fence_agent => $fence_agent,
description => $agent_description,
}});
=cut
foreach my $name (sort {$a cmp $b} keys %{$anvil->data->{fences}{$fence_agent}{parameters}})
{
# We don't show deprecated or replaced options.
next if $anvil->data->{fences}{$fence_agent}{parameters}{$name}{replacement};
next if $anvil->data->{fences}{$fence_agent}{parameters}{$name}{deprecated};
my $unique = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{unique};
my $required = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{required};
my $description = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{description};
my $switches = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{switches};
my $type = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{content_type};
my $star = $required ? "*" : "";
my $default = exists $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} ? $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} : "";
if ($type eq "select")
{
# Build the select box
my @options = ();
foreach my $option (sort @{$anvil->data->{fences}{$fence_agent}{parameters}{$name}{options}})
{
push @options, $option;
}
}
}
=cut
}
my $fence_agent_select = $anvil->Template->select_form({
name => "fence_agent",
options => $agents,
blank => 0,
'sort' => 1,
selected => $anvil->data->{cgi}{fence_agent}{value},
class => "input_clear",
});
my $fence_count_select = $anvil->Template->select_form({
name => "fence_count",
options => [1, 2, 3, 4],
blank => 0,
'sort' => 0,
selected => $anvil->data->{cgi}{fence_count}{value},
class => "input_clear",
});
$anvil->data->{form}{back_link} = "?anvil=true&task=create";
$anvil->data->{cgi}{task}{value} = "" if not defined $anvil->data->{cgi}{task}{value};
$anvil->data->{cgi}{subtask}{value} = "" if not defined $anvil->data->{cgi}{subtask}{value};
$anvil->data->{cgi}{action}{value} = "" if not defined $anvil->data->{cgi}{action}{value};
$anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "fence-agent-menu", variables => {
fence_select => $fence_agent_select,
fence_count => $fence_count_select,
descriptions => $description_form,
existing_fences => "",
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'form::body' => $anvil->data->{form}{body} }});
return(0);
} }
# This handles creating an Anvil! from an existing manifest # This handles creating an Anvil! from an existing manifest

@ -58,6 +58,123 @@
</table> </table>
<!-- end create-menu --> <!-- end create-menu -->
<!-- start fence-agent-configuration -->
<table align="center" class="anvil_main_menu">
<script type="text/javascript" src="/skins/alteeve/anvil.js"></script>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td class="main_option_icon">
<img src="#!data!skin::url!#/images/fence.png" class="top_icon" >
</td>
<td class="title">
#!string!striker_0215!#
</td>
</tr>
<tr>
<td class="main_option_icon">
&nbsp;
</td>
<td class="subtle_text">
#!string!striker_0218!#
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td class="description">
#!variable!description!#
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2" class="subtle_text" style="text-align: right;">
<span class="say_required">#!string!striker_0219!#</span>
</td>
</tr>
<tr>
<td colspan="2">
<form name="conce_configuration" action="" method="post">
<table class="centered">
#!variable!options!#
<tr>
<td colspan="3">
<input type="submit" name="save" id="save" class="button" value="#!string!striker_0067!#">
<input type="hidden" name="anvil" id="anvil" value="true">
<input type="hidden" name="task" id="task" value="fences">
</td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
</table>
<!-- end fence-agent-configuration -->
<!-- start fence-agent-option-menu -->
<tr>
<td colspan="3" class="menu_title">
#!variable!device_name!#
</td>
</tr>
#!variable!device_options!#
<!-- end fence-agent-option-menu -->
<!-- start fence-agent-option-entry -->
<tr>
<td>
#!variable!name!# &nbsp;
</td>
<td>
#!variable!option!#
</td>
<td>
&nbsp; #!variable!description!#
</td>
</tr>
<!-- end fence-agent-option-entry -->
<!-- start fence-agent-checkbox-entry -->
<tr>
<td>
#!variable!name!# &nbsp;
</td>
<td>
<input type="checkbox" id="#!variable!checkbox_name!#" name="#!variable!checkbox_name!#" #!variable!checkbox_checked!# />
</td>
<td>
&nbsp; #!variable!description!#
</td>
</tr>
<!-- end fence-agent-checkbox-entry -->
<!-- start fence-agent-input-entry -->
<tr>
<td>
#!variable!name!# &nbsp;
</td>
<td>
<input type="text" name="#!variable!key!#" id="#!variable!key!#" value="#!variable!value!#" placeholder="#!variable!default!#" class="#!variable!class!#">
</td>
<td>
&nbsp; #!variable!description!#
</td>
</tr>
<!-- end fence-agent-input-entry -->
<!-- start fence-agent-menu --> <!-- start fence-agent-menu -->
<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>
@ -141,28 +258,45 @@
<tr> <tr>
<td colspan="3" class="no_border_right"> <td colspan="3" class="no_border_right">
<input type="submit" name="add" id="add" class="button" value="#!string!striker_0070!#"> <input type="submit" name="add" id="add" class="button" value="#!string!striker_0070!#">
<input type="hidden" name="anvil" id="anvil" value="true">
<input type="hidden" name="task" id="task" value="fences">
</td> </td>
</tr> </tr>
</form> </form>
</table> </table>
</td> </td>
</tr> </tr>
<div id="fence_agent_list">
<tr> <tr>
<td colspan="2"> <td colspan="2">
<table class="data_table"> &nbsp;
<div id="fence_agent_list"> </td>
</tr>
<tr>
<td colspan="2">
#!string!striker_0214!#
</td>
</tr>
<tr>
<td colspan="2">
<table>
#!variable!descriptions!# #!variable!descriptions!#
</div>
</table> </table>
</td> </td>
</tr> </tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
</div>
</table> </table>
<!-- end fence-agent-menu --> <!-- end fence-agent-menu -->
<!-- start fence-agent-description --> <!-- start fence-agent-description -->
<tr> <tr style="border: 1px dotted #7f7f7f;">
<td> <td>
<span class="column_row_value_fixed">#!variable!fence_agent!#</a> <span class="column_row_value_fixed">#!variable!name!#</a>
</td> </td>
<td> <td>
#!variable!description!# #!variable!description!#

@ -198,6 +198,14 @@ input[type=text].input_alert, input[type=number].input_alert, select.input_alert
border: 1px solid #ff3f3f; border: 1px solid #ff3f3f;
} }
input[type=text].input_required, input[type=number].input_required, select.input_required {
border: 1px solid #7f7fff;
}
.say_required {
color: #7f7fff;
}
input[type=text].input_clear, input[type=number].input_clear, select.input_clear { input[type=text].input_clear, input[type=number].input_clear, select.input_clear {
border: 1px solid #9ba0a5; border: 1px solid #9ba0a5;
} }

@ -1349,3 +1349,6 @@ Striker Version: 2.0.7
</tools> </tools>
</common> </common>
</config> </config>

@ -836,7 +836,7 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st
<key name="brand_0002">Anvil!</key> <key name="brand_0002">Anvil!</key>
<key name="brand_0003">Striker</key> <key name="brand_0003">Striker</key>
<key name="brand_0004">ScanCore</key> <key name="brand_0004">ScanCore</key>
<key name="brand_0005"><![CDATA[&copy; 1997 - 2019 <a href="https://alteeve.com/" target="_new">Alteeve's Niche! Inc.</a>, Toronto, Ontario, Canada]]></key> <key name="brand_0005"><![CDATA[&copy; 1997 - 2020 <a href="https://alteeve.com/" target="_new">Alteeve's Niche! Inc.</a>, Toronto, Ontario, Canada]]></key>
<key name="brand_0006"><![CDATA[<i>Anvil!</i>]]></key> <key name="brand_0006"><![CDATA[<i>Anvil!</i>]]></key>
<key name="brand_0007">Node</key> <key name="brand_0007">Node</key>
<key name="brand_0008">DR Host</key> <key name="brand_0008">DR Host</key>
@ -1081,7 +1081,13 @@ If you are comfortable that the target has changed for a known reason, you can s
<key name="striker_0210">Fence devices are used to force a node that has entered an unknown state into a known state. Recovery after a node fault can not proceed until this happens, so this step is critically important.</key> <key name="striker_0210">Fence devices are used to force a node that has entered an unknown state into a known state. Recovery after a node fault can not proceed until this happens, so this step is critically important.</key>
<key name="striker_0211">Note: Any IPMI (iRMC, iLO, DRAC, etc) fence config will be handled in the host's config. This section configures shared devices, like PDUs. The ports/outlets a given node will use will be set in the install manifest later.</key> <key name="striker_0211">Note: Any IPMI (iRMC, iLO, DRAC, etc) fence config will be handled in the host's config. This section configures shared devices, like PDUs. The ports/outlets a given node will use will be set in the install manifest later.</key>
<key name="striker_0212">How Many?</key> <key name="striker_0212">How Many?</key>
<key name="striker_0213">Known fence devices:</key> <key name="striker_0213">Configure fence devices:</key>
<key name="striker_0214">List of fence agents installed on this system:</key>
<key name="striker_0215">Configuring #!data!cgi::fence_agent::value!#.</key>
<key name="striker_0216">Configure device #!variable!number!#:</key>
<key name="striker_0217">Options description (from the agent's metadata):</key>
<key name="striker_0218">Note: Names and descriptions come from the fence agent itself</key>
<key name="striker_0219">Required field</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>

@ -38,7 +38,29 @@ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure =
# print "iso: [".$iso."] -> [".$anvil->data->{sys}{languages}{$iso}."]\n"; # print "iso: [".$iso."] -> [".$anvil->data->{sys}{languages}{$iso}."]\n";
#} #}
# $anvil->Striker->get_fence_data({debug => 3}); $anvil->Striker->get_fence_data({debug => 3});
my $fence_agent = "fence_apc_snmp";
print "Fence agent: [".$fence_agent."]\n";
foreach my $name (sort {$a cmp $b} keys %{$anvil->data->{fences}{$fence_agent}{parameters}})
{
next if $anvil->data->{fences}{$fence_agent}{parameters}{$name}{replacement};
next if $anvil->data->{fences}{$fence_agent}{parameters}{$name}{deprecated};
my $unique = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{unique};
my $required = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{required};
my $description = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{description};
my $type = $anvil->data->{fences}{$fence_agent}{parameters}{$name}{content_type};
my $default = exists $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} ? $anvil->data->{fences}{$fence_agent}{parameters}{$name}{'default'} : "";
print "- name: [$name], default: [".$default."]\n";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
name => $name,
unique => $unique,
required => $required,
description => $description,
type => $type,
'default' => $default,
}});
}
# foreach my $fence_agent (sort {$a cmp $b} keys %{$anvil->data->{fences}}) # foreach my $fence_agent (sort {$a cmp $b} keys %{$anvil->data->{fences}})
# { # {

Loading…
Cancel
Save