This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fence-agents: master - fence_*.pl: Fix Perl scripts to force stdoutclose


Gitweb:        http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=4be00711b5628af40c05f1e734e85247745e2333
Commit:        4be00711b5628af40c05f1e734e85247745e2333
Parent:        e27ca9503014226b2aaa95c9499d9e5710026b91
Author:        Jan Friesse <jfriesse@redhat.com>
AuthorDate:    Fri Feb 27 10:33:25 2009 +0100
Committer:     Jan Friesse <jfriesse@redhat.com>
CommitterDate: Fri Feb 27 10:33:25 2009 +0100

fence_*.pl: Fix Perl scripts to force stdout close

This feature is advise from Jim Meyering. On the beginning
of script, we register end callback, which close stdout and
show error, if this wasn't successful.
---
 fence/agents/baytech/fence_baytech.pl           |    9 +++++++++
 fence/agents/brocade/fence_brocade.pl           |    9 +++++++++
 fence/agents/bullpap/fence_bullpap.pl           |    9 +++++++++
 fence/agents/cpint/fence_cpint.pl               |    9 +++++++++
 fence/agents/drac/fence_drac.pl                 |    9 +++++++++
 fence/agents/egenera/fence_egenera.pl           |    9 +++++++++
 fence/agents/ibmblade/fence_ibmblade.pl         |    9 +++++++++
 fence/agents/intelmodular/fence_intelmodular.pl |    9 +++++++++
 fence/agents/mcdata/fence_mcdata.pl             |    9 +++++++++
 fence/agents/sanbox2/fence_sanbox2.pl           |    9 +++++++++
 fence/agents/scsi/fence_scsi.pl                 |    9 +++++++++
 fence/agents/vixel/fence_vixel.pl               |    9 +++++++++
 fence/agents/xcat/fence_xcat.pl                 |    9 +++++++++
 fence/agents/zvm/fence_zvm.pl                   |    9 +++++++++
 14 files changed, 126 insertions(+), 0 deletions(-)

diff --git a/fence/agents/baytech/fence_baytech.pl b/fence/agents/baytech/fence_baytech.pl
index 3b07a3c..7325ee6 100644
--- a/fence/agents/baytech/fence_baytech.pl
+++ b/fence/agents/baytech/fence_baytech.pl
@@ -14,6 +14,15 @@
 use Net::Telnet;
 use Getopt::Std;
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and 
 # "#END_VERSION_GENERATION"  It is generated by the Makefile
 
diff --git a/fence/agents/brocade/fence_brocade.pl b/fence/agents/brocade/fence_brocade.pl
index 30a6250..933cecf 100644
--- a/fence/agents/brocade/fence_brocade.pl
+++ b/fence/agents/brocade/fence_brocade.pl
@@ -3,6 +3,15 @@
 use Getopt::Std;
 use Net::Telnet ();
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # Get the program name from $0 and strip directory names
 $_=$0;
 s/.*\///;
diff --git a/fence/agents/bullpap/fence_bullpap.pl b/fence/agents/bullpap/fence_bullpap.pl
index 1013326..b643413 100644
--- a/fence/agents/bullpap/fence_bullpap.pl
+++ b/fence/agents/bullpap/fence_bullpap.pl
@@ -3,6 +3,15 @@
 use Getopt::Std;
 use POSIX;
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # Get the program name from $0 and strip directory names
 $_=$0;
 s/.*\///;
diff --git a/fence/agents/cpint/fence_cpint.pl b/fence/agents/cpint/fence_cpint.pl
index 77d6a54..dc17eed 100644
--- a/fence/agents/cpint/fence_cpint.pl
+++ b/fence/agents/cpint/fence_cpint.pl
@@ -2,6 +2,15 @@
 
 use Getopt::Std;
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # Get the program name from $0 and strip directory names
 $_=$0;
 s/.*\///;
diff --git a/fence/agents/drac/fence_drac.pl b/fence/agents/drac/fence_drac.pl
index f199814..e743aae 100644
--- a/fence/agents/drac/fence_drac.pl
+++ b/fence/agents/drac/fence_drac.pl
@@ -18,6 +18,15 @@
 use Getopt::Std;
 use Net::Telnet ();
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # Get the program name from $0 and strip directory names
 $_=$0;
 s/.*\///;
diff --git a/fence/agents/egenera/fence_egenera.pl b/fence/agents/egenera/fence_egenera.pl
index 67d1d83..dd4f5af 100644
--- a/fence/agents/egenera/fence_egenera.pl
+++ b/fence/agents/egenera/fence_egenera.pl
@@ -3,6 +3,15 @@
 use Getopt::Std;
 use IPC::Open3;
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and 
 # "#END_VERSION_GENERATION"  It is generated by the Makefile
 
diff --git a/fence/agents/ibmblade/fence_ibmblade.pl b/fence/agents/ibmblade/fence_ibmblade.pl
index e2618a7..adf7548 100644
--- a/fence/agents/ibmblade/fence_ibmblade.pl
+++ b/fence/agents/ibmblade/fence_ibmblade.pl
@@ -3,6 +3,15 @@
 use Getopt::Std;
 use Net::SNMP; 
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # Get the program name from $0 and strip directory names
 $_=$0;
 s/.*\///;
diff --git a/fence/agents/intelmodular/fence_intelmodular.pl b/fence/agents/intelmodular/fence_intelmodular.pl
index 95af28f..8561b5c 100644
--- a/fence/agents/intelmodular/fence_intelmodular.pl
+++ b/fence/agents/intelmodular/fence_intelmodular.pl
@@ -16,6 +16,15 @@
 use Getopt::Std;
 use Net::SNMP; 
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # Get the program name from $0 and strip directory names
 $_=$0;
 s/.*\///;
diff --git a/fence/agents/mcdata/fence_mcdata.pl b/fence/agents/mcdata/fence_mcdata.pl
index e16282b..96ab681 100644
--- a/fence/agents/mcdata/fence_mcdata.pl
+++ b/fence/agents/mcdata/fence_mcdata.pl
@@ -9,6 +9,15 @@
 use Getopt::Std;
 use Net::Telnet ();
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # Get the program name from $0 and strip directory names
 $_=$0;
 s/.*\///;
diff --git a/fence/agents/sanbox2/fence_sanbox2.pl b/fence/agents/sanbox2/fence_sanbox2.pl
index 225d640..c8c37a5 100644
--- a/fence/agents/sanbox2/fence_sanbox2.pl
+++ b/fence/agents/sanbox2/fence_sanbox2.pl
@@ -3,6 +3,15 @@
 use Getopt::Std;
 use Net::Telnet ();
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # Get the program name from $0 and strip directory names
 $_=$0;
 s/.*\///;
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 80066a3..7e68dab 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -4,6 +4,15 @@ use Getopt::Std;
 use IPC::Open3;
 use POSIX;
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 my @device_list;
 
 $_ = $0;
diff --git a/fence/agents/vixel/fence_vixel.pl b/fence/agents/vixel/fence_vixel.pl
index c6dc77a..470d4c7 100644
--- a/fence/agents/vixel/fence_vixel.pl
+++ b/fence/agents/vixel/fence_vixel.pl
@@ -3,6 +3,15 @@
 use Getopt::Std;
 use Net::Telnet ();
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # Get the program name from $0 and strip directory names
 $_=$0;
 s/.*\///;
diff --git a/fence/agents/xcat/fence_xcat.pl b/fence/agents/xcat/fence_xcat.pl
index 9e65ff8..2d8166a 100644
--- a/fence/agents/xcat/fence_xcat.pl
+++ b/fence/agents/xcat/fence_xcat.pl
@@ -2,6 +2,15 @@
 
 use Getopt::Std;
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # Get the program name from $0 and strip directory names
 $_=$0;
 s/.*\///;
diff --git a/fence/agents/zvm/fence_zvm.pl b/fence/agents/zvm/fence_zvm.pl
index ce9d813..f90125a 100644
--- a/fence/agents/zvm/fence_zvm.pl
+++ b/fence/agents/zvm/fence_zvm.pl
@@ -3,6 +3,15 @@
 use Getopt::Std;
 use IPC::Open2;
 
+my $ME = $0;
+
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 # Get the program name from $0 and strip directory names
 $_=$0;
 s/.*\///;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]