Gitweb:
http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=a98e0b...
Commit: a98e0b19e31a05e69c4347f6cd39714e8a2c72a3
Parent: fec1c4b83857a302a8423ef2070977a7e900ca99
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Jul 12 18:30:48 2012 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Oct 8 14:06:51 2012 +0200
fence agents: Some agents do not support action=metadata on STDIN
Resolves rhbz#837174
---
fence/agents/baytech/fence_baytech.pl | 9 +++++----
fence/agents/brocade/fence_brocade.pl | 5 +++++
fence/agents/bullpap/fence_bullpap.pl | 7 ++++++-
fence/agents/cpint/fence_cpint.pl | 10 ++++++++++
fence/agents/drac/fence_drac.pl | 5 +++++
fence/agents/egenera/fence_egenera.pl | 9 +++++----
fence/agents/mcdata/fence_mcdata.pl | 7 ++++++-
fence/agents/rackswitch/do_rack.c | 9 +++++++++
fence/agents/xcat/fence_xcat.pl | 5 +++++
fence/agents/zvm/fence_zvm.pl | 10 ++++++++++
10 files changed, 66 insertions(+), 10 deletions(-)
diff --git a/fence/agents/baytech/fence_baytech.pl
b/fence/agents/baytech/fence_baytech.pl
index c978ec5..e218b78 100644
--- a/fence/agents/baytech/fence_baytech.pl
+++ b/fence/agents/baytech/fence_baytech.pl
@@ -166,14 +166,15 @@ sub get_options
fail_usage "Unkown parameter." if (@ARGV > 0);
- if ((defined $opt_o) && ($opt_o =~ /metadata/i)) {
- print_metadata();
- exit 0;
- }
} else {
get_options_stdin();
}
+ if ((defined $opt_o) && ($opt_o =~ /metadata/i)) {
+ print_metadata();
+ exit 0;
+ }
+
fail "failed: must specify hostname" unless defined $opt_a;
$host=$opt_a;
$port=23 unless ($opt_a =~ /:/);
diff --git a/fence/agents/brocade/fence_brocade.pl
b/fence/agents/brocade/fence_brocade.pl
index e3d1612..e3f7290 100644
--- a/fence/agents/brocade/fence_brocade.pl
+++ b/fence/agents/brocade/fence_brocade.pl
@@ -162,6 +162,11 @@ if (@ARGV > 0) {
} else {
get_options_stdin();
+ if ((defined $opt_o) && ($opt_o =~ /metadata/i)) {
+ print_metadata();
+ exit 0;
+ }
+
fail "failed: no IP address" unless defined $opt_a;
fail "failed: no plug number" unless defined $opt_n;
fail "failed: no login name" unless defined $opt_l;
diff --git a/fence/agents/bullpap/fence_bullpap.pl
b/fence/agents/bullpap/fence_bullpap.pl
index 3309c18..e31ab6d 100644
--- a/fence/agents/bullpap/fence_bullpap.pl
+++ b/fence/agents/bullpap/fence_bullpap.pl
@@ -179,7 +179,7 @@ sub get_options_stdin
{
$login = $val;
}
- elsif ($name eq "option" )
+ elsif (($name eq "option" ) || ($name eq "action"))
{
$action = $val;
}
@@ -312,6 +312,11 @@ else
{
get_options_stdin();
+ if ((defined $action) && ($action =~ /metadata/i)) {
+ print_metadata();
+ exit 0;
+ }
+
fail "failed: no IP address" unless defined $host;
fail "failed: no domain" unless defined $domain;
fail "failed: no login name" unless defined $login;
diff --git a/fence/agents/cpint/fence_cpint.pl b/fence/agents/cpint/fence_cpint.pl
index d3c016a..eb2ad3a 100644
--- a/fence/agents/cpint/fence_cpint.pl
+++ b/fence/agents/cpint/fence_cpint.pl
@@ -142,6 +142,11 @@ sub get_options_stdin
$opt_u = $val;
}
+ elsif ($name eq "action" )
+ {
+ $opt_o = $val;
+ }
+
else
{
print stderr "parse error: unknown option \"$opt\"\n";
@@ -166,6 +171,11 @@ if (@ARGV > 0){
} else {
get_options_stdin();
+ if ((defined $opt_o) && ($opt_o =~ /metadata/i)) {
+ print_metadata();
+ exit 0;
+ }
+
fail "no userid" unless defined $opt_u;
}
diff --git a/fence/agents/drac/fence_drac.pl b/fence/agents/drac/fence_drac.pl
index 825391f..b26fbcb 100644
--- a/fence/agents/drac/fence_drac.pl
+++ b/fence/agents/drac/fence_drac.pl
@@ -717,6 +717,11 @@ if (@ARGV > 0) {
} else {
get_options_stdin();
+ if ((defined $action) && ($action =~ /metadata/i)) {
+ print_metadata();
+ exit 0;
+ }
+
fail "failed: no IP address" unless defined $address;
fail "failed: no login name" unless defined $login;
diff --git a/fence/agents/egenera/fence_egenera.pl
b/fence/agents/egenera/fence_egenera.pl
index 30eaca1..308338b 100644
--- a/fence/agents/egenera/fence_egenera.pl
+++ b/fence/agents/egenera/fence_egenera.pl
@@ -139,10 +139,6 @@ if (@ARGV > 0)
fail_usage "Unkown parameter." if (@ARGV > 0);
- if ((defined $opt_o) && ($opt_o =~ /metadata/i)) {
- print_metadata();
- exit 0;
- }
$cserv = $opt_c if defined $opt_c;
$lpan = $opt_l if defined $opt_l;
@@ -156,6 +152,11 @@ else
get_options_stdin();
}
+if (((defined $opt_o) && ($opt_o =~ /metadata/i)) || ((defined $action)
&& ($action =~ /metadata/i))) {
+ print_metadata();
+ exit 0;
+}
+
$action = "reboot" unless defined $action;
$user = "root" unless defined $user;
diff --git a/fence/agents/mcdata/fence_mcdata.pl b/fence/agents/mcdata/fence_mcdata.pl
index a469a1c..5bc9dcf 100644
--- a/fence/agents/mcdata/fence_mcdata.pl
+++ b/fence/agents/mcdata/fence_mcdata.pl
@@ -176,7 +176,7 @@ sub get_options_stdin
{
$opt_l = $val;
}
- elsif ($name eq "option" )
+ elsif (($name eq "option" ) || ($name eq "action"))
{
$opt_o = $val;
}
@@ -235,6 +235,11 @@ if (@ARGV > 0) {
} else {
get_options_stdin();
+ if ((defined $opt_o) && ($opt_o =~ /metadata/i)) {
+ print_metadata();
+ exit 0;
+ }
+
fail "failed: no IP address" unless defined $opt_a;
fail "failed: no plug number" unless defined $opt_n;
fail "failed: no login name" unless defined $opt_l;
diff --git a/fence/agents/rackswitch/do_rack.c b/fence/agents/rackswitch/do_rack.c
index 67d24a2..d8050bf 100644
--- a/fence/agents/rackswitch/do_rack.c
+++ b/fence/agents/rackswitch/do_rack.c
@@ -301,6 +301,15 @@ static void get_options(int argc, char **argv)
strcpy(name, pname);
if (!strcmp(arg, "ipaddr"))
strcpy(ipaddr, value);
+
+ if (!strcmp(arg, "action"))
+ if (strncasecmp(value, "metadata", 254) == 0) {
+ print_metadata();
+ exit(DID_SUCCESS);
+ } else {
+ fprintf(stderr, "Only 'metadata' option is aviable for this fence
agent\n");
+ exit(DID_FAILURE);
+ }
if (!strcmp(arg, "portnumber"))
strcpy(portnumber, value);
diff --git a/fence/agents/xcat/fence_xcat.pl b/fence/agents/xcat/fence_xcat.pl
index f984ec1..3cd16aa 100644
--- a/fence/agents/xcat/fence_xcat.pl
+++ b/fence/agents/xcat/fence_xcat.pl
@@ -184,6 +184,11 @@ if (@ARGV > 0) {
} else {
get_options_stdin();
+ if ((defined $opt_o) && ($opt_o =~ /metadata/i)) {
+ print_metadata();
+ exit 0;
+ }
+
fail "failed: no plug number" unless defined $opt_n;
$opt_o=lc($opt_o);
fail "failed: unrecognised action: $opt_o"
diff --git a/fence/agents/zvm/fence_zvm.pl b/fence/agents/zvm/fence_zvm.pl
index e6386e4..04a29e2 100644
--- a/fence/agents/zvm/fence_zvm.pl
+++ b/fence/agents/zvm/fence_zvm.pl
@@ -299,6 +299,11 @@ sub get_options_stdin
{
$opt_r = $val;
}
+
+ elsif ($name eq "action")
+ {
+ $opt_o = $val;
+ }
# FIXME -- depreicated residue of old fencing system
elsif ($name eq "name" ) { }
@@ -352,6 +357,11 @@ if (@ARGV > 0){
} else {
get_options_stdin();
+ if ((defined $opt_o) && ($opt_o =~ /metadata/i)) {
+ print_metadata();
+ exit 0;
+ }
+
fail "no IP address" unless defined $opt_a;
fail "no userid" unless defined $opt_u;