with it's options that will be shown/hidden basen on the agent
+ # select box.
+ my $agents = [];
+ my $description_form = "";
+ foreach my $fence_agent (sort {$a cmp $b} keys %{$anvil->data->{fences}})
{
- # 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")
+ # We don't care about IPMI-based fence agents here.
+ next if $fence_agent eq "fence_drac5";
+ next if $fence_agent eq "fence_idrac";
+ next if $fence_agent =~ /^fence_ilo/;
+ next if $fence_agent eq "fence_imm";
+ next if $fence_agent eq "fence_ipmilan";
+ next if $fence_agent eq "fence_redfish";
+ next if $fence_agent eq "fence_rsa";
+
+ push @{$agents}, $fence_agent;
+
+ 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
elements.
+ $agent_description =~ s/\n/
/gs;
+ $agent_description =~ s/
/
\n/gs;
+
+ # Handle fence_azure_arm.
+ if ($fence_agent eq "fence_azure_arm")
+ {
+ my $in_pre = 0;
+ my $break_number = 0;
+ my $new_desctiption = "";
+ foreach my $line (split/\n/, $agent_description)
+ {
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }});
+ if ($line =~ /\+---/)
{
- # Build the select box
- my @options = ();
- foreach my $option (sort @{$anvil->data->{fences}{$fence_agent}{parameters}{$name}{options}})
+ $line =~ s/
//g;
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { break_number => $break_number }});
+ if (not $break_number)
{
- push @options, $option;
+ $in_pre = 1;
+ $new_desctiption .= "
\n";
+ $new_desctiption .= $line."\n";
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { new_desctiption => $new_desctiption }});
}
+ elsif ($break_number == 2)
+ {
+ $in_pre = 0;
+ $new_desctiption .= $line."\n";
+ $new_desctiption .= "
\n";
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { new_desctiption => $new_desctiption }});
+ }
+ else
+ {
+ $new_desctiption .= $line."\n";
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { new_desctiption => $new_desctiption }});
+ }
+ $break_number++;
+ }
+ else
+ {
+ if ($in_pre)
+ {
+ $line =~ s/
//g;
+ }
+ $new_desctiption .= $line."\n";
}
}
-=cut
+ $agent_description = $new_desctiption;
}
- 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);
+ return($agent_description);
}
# This handles creating an Anvil! from an existing manifest
diff --git a/html/skins/alteeve/anvil.html b/html/skins/alteeve/anvil.html
index caa35f28..8329efe1 100644
--- a/html/skins/alteeve/anvil.html
+++ b/html/skins/alteeve/anvil.html
@@ -58,6 +58,123 @@
+
+
+
+
+
+
+ |
+
+
+
+
+ |
+
+ #!string!striker_0215!#
+ |
+
+
+
+
+ |
+
+ #!string!striker_0218!#
+ |
+
+
+
+
+ |
+
+ #!variable!description!#
+ |
+
+
+
+
+ |
+
+
+
+ #!string!striker_0219!#
+ |
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ #!variable!device_options!#
+
+
+
+
+
+ #!variable!name!#
+ |
+
+ #!variable!option!#
+ |
+
+ #!variable!description!#
+ |
+
+
+
+
+
+
+ #!variable!name!#
+ |
+
+
+ |
+
+ #!variable!description!#
+ |
+
+
+
+
+
+
+ #!variable!name!#
+ |
+
+
+ |
+
+ #!variable!description!#
+ |
+
+
+
+
-
-
- #!variable!descriptions!#
-
+
+
+
+
+
+ #!string!striker_0214!#
+ |
+
+
+
+
+ #!variable!descriptions!#
|
+
+
+
+ |
+
+
- |
+
- #!variable!fence_agent!#
+ #!variable!name!#
|
#!variable!description!#
diff --git a/html/skins/alteeve/main.css b/html/skins/alteeve/main.css
index 551e39ec..ccdadafb 100644
--- a/html/skins/alteeve/main.css
+++ b/html/skins/alteeve/main.css
@@ -198,6 +198,14 @@ input[type=text].input_alert, input[type=number].input_alert, select.input_alert
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 {
border: 1px solid #9ba0a5;
}
diff --git a/notes b/notes
index 42a42684..3136bb83 100644
--- a/notes
+++ b/notes
@@ -1349,3 +1349,6 @@ Striker Version: 2.0.7
+
+
+
diff --git a/share/words.xml b/share/words.xml
index 2326cbef..26c405a6 100644
--- a/share/words.xml
+++ b/share/words.xml
@@ -836,7 +836,7 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st
Anvil!
Striker
ScanCore
- Alteeve's Niche! Inc., Toronto, Ontario, Canada]]>
+ Alteeve's Niche! Inc., Toronto, Ontario, Canada]]>
Anvil!]]>
Node
DR Host
@@ -1081,7 +1081,13 @@ If you are comfortable that the target has changed for a known reason, you can s
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.
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.
How Many?
- Known fence devices:
+ Configure fence devices:
+ List of fence agents installed on this system:
+ Configuring #!data!cgi::fence_agent::value!#.
+ Configure device #!variable!number!#:
+ Options description (from the agent's metadata):
+ Note: Names and descriptions come from the fence agent itself
+ Required field
#!variable!number!#/sec
diff --git a/tools/test.pl b/tools/test.pl
index 1bd7979c..f90c0971 100755
--- a/tools/test.pl
+++ b/tools/test.pl
@@ -38,7 +38,29 @@ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure =
# 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}})
# {
|