|
|
|
#!/usr/bin/perl
|
|
|
|
#
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Anvil::Tools;
|
|
|
|
use XML::Simple;
|
|
|
|
use JSON;
|
|
|
|
use Math::BigInt;
|
|
|
|
use Data::Dumper;
|
|
|
|
use Net::Netmask;
|
|
|
|
|
|
|
|
my $THIS_FILE = ($0 =~ /^.*\/(.*)$/)[0];
|
|
|
|
my $running_directory = ($0 =~ /^(.*?)\/$THIS_FILE$/)[0];
|
|
|
|
if (($running_directory =~ /^\./) && ($ENV{PWD}))
|
|
|
|
{
|
|
|
|
$running_directory =~ s/^\./$ENV{PWD}/;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Turn off buffering so that the pinwheel will display while waiting for the SSH call(s) to complete.
|
|
|
|
$| = 1;
|
|
|
|
|
|
|
|
print "Starting test.\n";
|
|
|
|
my $anvil = Anvil::Tools->new({debug => 3});
|
|
|
|
$anvil->Log->secure({set => 1});
|
|
|
|
$anvil->Log->level({set => 2});
|
|
|
|
|
* Moved the fences_unified_metadata file from /tmp, which apache can not read, to /var/www/html/.
* Fixed a bug (well, made a work-around for an issue without a known reproducer) where, on some occassion, a record will end up in the public table without being copied into the history schema. When this happens, the next resync would crash out because the resynd reads in the history table only. Now, when about to INSERT a record into the public schema during a resync, an explicit check is made to see if the record alread
y exists. If it does, the INSERT is instead redirected to the history schema.
* Cleaned up the fence agent metadata when displaying to a user, converting the shell codes to underline a string with square brackets instead. We also now replace newlines with <br /> tags. Lastly, to help fence_azure_arm's metadata description to display cleanly, a check is made to format the table correctly.
* Began work on the Striker menu for handling fence device management
Signed-off-by: Digimer <digimer@alteeve.ca>
5 years ago
|
|
|
#print "Connecting to the database(s);\b";
|
|
|
|
$anvil->Database->connect({debug => 3});
|
|
|
|
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"});
|
* Moved the fences_unified_metadata file from /tmp, which apache can not read, to /var/www/html/.
* Fixed a bug (well, made a work-around for an issue without a known reproducer) where, on some occassion, a record will end up in the public table without being copied into the history schema. When this happens, the next resync would crash out because the resynd reads in the history table only. Now, when about to INSERT a record into the public schema during a resync, an explicit check is made to see if the record alread
y exists. If it does, the INSERT is instead redirected to the history schema.
* Cleaned up the fence agent metadata when displaying to a user, converting the shell codes to underline a string with square brackets instead. We also now replace newlines with <br /> tags. Lastly, to help fence_azure_arm's metadata description to display cleanly, a check is made to format the table correctly.
* Began work on the Striker menu for handling fence device management
Signed-off-by: Digimer <digimer@alteeve.ca>
5 years ago
|
|
|
#print "DB Connections: [".$anvil->data->{sys}{database}{connections}."]\n";
|
|
|
|
#$anvil->Network->load_interfces({debug => 2});
|
|
|
|
#$anvil->System->generate_state_json({debug => 2});
|
|
|
|
|
* Moved the fences_unified_metadata file from /tmp, which apache can not read, to /var/www/html/.
* Fixed a bug (well, made a work-around for an issue without a known reproducer) where, on some occassion, a record will end up in the public table without being copied into the history schema. When this happens, the next resync would crash out because the resynd reads in the history table only. Now, when about to INSERT a record into the public schema during a resync, an explicit check is made to see if the record alread
y exists. If it does, the INSERT is instead redirected to the history schema.
* Cleaned up the fence agent metadata when displaying to a user, converting the shell codes to underline a string with square brackets instead. We also now replace newlines with <br /> tags. Lastly, to help fence_azure_arm's metadata description to display cleanly, a check is made to format the table correctly.
* Began work on the Striker menu for handling fence device management
Signed-off-by: Digimer <digimer@alteeve.ca>
5 years ago
|
|
|
#$anvil->Words->language_list();
|
|
|
|
#foreach my $iso (sort {$a cmp $b} keys %{$anvil->data->{sys}{languages}})
|
|
|
|
#{
|
|
|
|
# print "iso: [".$iso."] -> [".$anvil->data->{sys}{languages}{$iso}."]\n";
|
|
|
|
#}
|
|
|
|
|
|
|
|
$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,
|
|
|
|
}});
|
|
|
|
}
|
* Moved the fences_unified_metadata file from /tmp, which apache can not read, to /var/www/html/.
* Fixed a bug (well, made a work-around for an issue without a known reproducer) where, on some occassion, a record will end up in the public table without being copied into the history schema. When this happens, the next resync would crash out because the resynd reads in the history table only. Now, when about to INSERT a record into the public schema during a resync, an explicit check is made to see if the record alread
y exists. If it does, the INSERT is instead redirected to the history schema.
* Cleaned up the fence agent metadata when displaying to a user, converting the shell codes to underline a string with square brackets instead. We also now replace newlines with <br /> tags. Lastly, to help fence_azure_arm's metadata description to display cleanly, a check is made to format the table correctly.
* Began work on the Striker menu for handling fence device management
Signed-off-by: Digimer <digimer@alteeve.ca>
5 years ago
|
|
|
|
|
|
|
# foreach my $fence_agent (sort {$a cmp $b} keys %{$anvil->data->{fences}})
|
|
|
|
# {
|
|
|
|
# # We skip fence_ipmilan, that's handled in the host.
|
|
|
|
# next if $fence_agent eq "fence_ipmilan";
|
|
|
|
#
|
|
|
|
# my $agent_description = $anvil->data->{fences}{$fence_agent}{description};
|
|
|
|
# print "Agent: [".$fence_agent."]\n";
|
|
|
|
# print "==========\n";
|
|
|
|
# print $agent_description."\n";
|
|
|
|
# print "==========\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 $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'} : "";
|
|
|
|
# print "- [".$name."]".$star.": Type: [".$type."], default: [".$default."], switches: [".$switches."]: [".$description."]\n";
|
|
|
|
# print " - Unique!\n" if $unique;
|
|
|
|
#
|
|
|
|
# if ($type eq "select")
|
|
|
|
# {
|
|
|
|
# # Build the select box
|
|
|
|
# my $options = "";
|
|
|
|
# foreach my $option (sort @{$anvil->data->{fences}{$fence_agent}{parameters}{$name}{options}})
|
|
|
|
# {
|
|
|
|
# if (($default) && ($option eq $default))
|
|
|
|
# {
|
|
|
|
# $options .= " - [".$option."]*\n";
|
|
|
|
# }
|
|
|
|
# else
|
|
|
|
# {
|
|
|
|
# $options .= " - [".$option."]\n";
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
# print $options;
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# }
|