public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: RHEL55 - fencing: #518622 - Force stdout close for fencing agents in python
@ 2009-08-28 16:13 Marek Grác
0 siblings, 0 replies; only message in thread
From: Marek Grác @ 2009-08-28 16:13 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=66767ee1c9e6d2d9f4cba0b4b5c1fd212222838d
Commit: 66767ee1c9e6d2d9f4cba0b4b5c1fd212222838d
Parent: e27e6148dd6a033a3e0a57e04c06b6242efb3321
Author: Marek 'marx' Grac <mgrac@redhat.com>
AuthorDate: Fri Aug 28 17:21:58 2009 +0200
Committer: Marek 'marx' Grac <mgrac@redhat.com>
CommitterDate: Fri Aug 28 17:21:58 2009 +0200
fencing: #518622 - Force stdout close for fencing agents in python
---
fence/agents/apc/fence_apc.py | 2 ++
fence/agents/baytech/fence_baytech.pl | 9 +++++++++
fence/agents/bladecenter/fence_bladecenter.py | 2 ++
fence/agents/brocade/fence_brocade.pl | 9 +++++++++
fence/agents/bullpap/fence_bullpap.pl | 9 +++++++++
fence/agents/cisco_mds/fence_cisco_mds.py | 2 ++
fence/agents/cpint/fence_cpint.pl | 9 +++++++++
fence/agents/drac/fence_drac.pl | 9 +++++++++
fence/agents/drac/fence_drac5.py | 2 ++
fence/agents/egenera/fence_egenera.pl | 9 +++++++++
fence/agents/eps/fence_eps.py | 2 ++
fence/agents/ibmblade/fence_ibmblade.pl | 9 +++++++++
fence/agents/ilo/fence_ilo.py | 2 ++
fence/agents/lib/fencing.py.py | 9 +++++++++
fence/agents/lpar/fence_lpar.py | 2 ++
fence/agents/mcdata/fence_mcdata.pl | 9 +++++++++
fence/agents/rsa/fence_rsa.py | 2 ++
fence/agents/sanbox2/fence_sanbox2.pl | 9 +++++++++
fence/agents/scsi/fence_scsi.pl | 9 +++++++++
fence/agents/virsh/fence_virsh.py | 2 ++
fence/agents/vixel/fence_vixel.pl | 9 +++++++++
fence/agents/vmware/fence_vmware.py | 2 ++
fence/agents/wti/fence_wti.py | 2 ++
fence/agents/xcat/fence_xcat.pl | 9 +++++++++
fence/agents/zvm/fence_zvm.pl | 9 +++++++++
25 files changed, 148 insertions(+), 0 deletions(-)
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index dfe9913..2868c16 100755
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -177,6 +177,8 @@ def main():
"action", "ipaddr", "login", "passwd", "passwd_script",
"secure", "port", "switch", "test" ]
+ atexit.register(atexit_handler)
+
options = check_input(device_opt, process_input(device_opt))
##
diff --git a/fence/agents/baytech/fence_baytech.pl b/fence/agents/baytech/fence_baytech.pl
index cd65a2b..aac218a 100755
--- a/fence/agents/baytech/fence_baytech.pl
+++ b/fence/agents/baytech/fence_baytech.pl
@@ -27,6 +27,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/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index 518f6a6..65158c4 100755
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -69,6 +69,8 @@ def main():
"action", "ipaddr", "login", "passwd", "passwd_script",
"cmd_prompt", "secure", "port", "identity_file" ]
+ atexit.register(atexit_handler)
+
options = check_input(device_opt, process_input(device_opt))
##
diff --git a/fence/agents/brocade/fence_brocade.pl b/fence/agents/brocade/fence_brocade.pl
index 33b0ce2..abb9204 100755
--- a/fence/agents/brocade/fence_brocade.pl
+++ b/fence/agents/brocade/fence_brocade.pl
@@ -16,6 +16,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 5cad62f..bb02fb8 100755
--- a/fence/agents/bullpap/fence_bullpap.pl
+++ b/fence/agents/bullpap/fence_bullpap.pl
@@ -15,6 +15,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/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index 40faf94..d1838f4 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -88,6 +88,8 @@ def main():
"snmp_priv_prot", "snmp_priv_passwd", "snmp_priv_passwd_script",
"udpport"]
+ atexit.register(atexit_handler)
+
options=process_input(device_opt)
# Emulate enable/disable functionality
diff --git a/fence/agents/cpint/fence_cpint.pl b/fence/agents/cpint/fence_cpint.pl
index ca5eac4..4a7d582 100755
--- a/fence/agents/cpint/fence_cpint.pl
+++ b/fence/agents/cpint/fence_cpint.pl
@@ -15,6 +15,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 7b8f51e..3f3bb76 100755
--- a/fence/agents/drac/fence_drac.pl
+++ b/fence/agents/drac/fence_drac.pl
@@ -30,6 +30,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/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py
index cdea52c..57f94b3 100755
--- a/fence/agents/drac/fence_drac5.py
+++ b/fence/agents/drac/fence_drac5.py
@@ -63,6 +63,8 @@ def main():
"action", "ipaddr", "login", "passwd", "passwd_script",
"cmd_prompt", "secure", "drac_version", "module_name" ]
+ atexit.register(atexit_handler)
+
options = check_input(device_opt, process_input(device_opt))
##
diff --git a/fence/agents/egenera/fence_egenera.pl b/fence/agents/egenera/fence_egenera.pl
index b65ad3e..b516ceb 100755
--- a/fence/agents/egenera/fence_egenera.pl
+++ b/fence/agents/egenera/fence_egenera.pl
@@ -16,6 +16,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/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index 69068b1..19310b9 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -94,6 +94,8 @@ def main():
"action", "ipaddr", "login", "passwd", "passwd_script",
"test", "port", "hidden_page", "no_login", "no_password" ]
+ atexit.register(atexit_handler)
+
eps_define_new_opts()
options = check_input(device_opt,process_input(device_opt))
diff --git a/fence/agents/ibmblade/fence_ibmblade.pl b/fence/agents/ibmblade/fence_ibmblade.pl
index 9d75229..bc1efc8 100755
--- a/fence/agents/ibmblade/fence_ibmblade.pl
+++ b/fence/agents/ibmblade/fence_ibmblade.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/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 6513e2a..e3652bf 100755
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -59,6 +59,8 @@ def main():
"action", "ipaddr", "login", "passwd", "passwd_script",
"ssl", "ribcl" ]
+ atexit.register(atexit_handler)
+
options = check_input(device_opt, process_input(device_opt))
options["-z"] = 1
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 59133a6..809c2e2 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -7,6 +7,7 @@
import sys, getopt, time, os
import pexpect, re
import telnetlib
+import atexit
## do not add code here.
#BEGIN_VERSION_GENERATION
@@ -199,6 +200,14 @@ class fspawn(pexpect.spawn):
options["debug_fh"].write(self.before + self.after)
return result
+def atexit_handler():
+ try:
+ sys.stdout.close()
+ os.close(1)
+ except IOError:
+ sys.stderr.write("%s failed to close standard output\n"%(sys.argv[0]))
+ sys.exit(1)
+
def version(command, release, build_date, copyright_notice):
print command, " ", release, " ", build_date
if len(copyright_notice) > 0:
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 4c6f997..11b0826 100755
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -90,6 +90,8 @@ def main():
"action", "ipaddr", "login", "passwd", "passwd_script",
"secure", "partition", "managed", "hmc_version", "cmd_prompt" ]
+ atexit.register(atexit_handler)
+
options = check_input(device_opt, process_input(device_opt))
##
diff --git a/fence/agents/mcdata/fence_mcdata.pl b/fence/agents/mcdata/fence_mcdata.pl
index 6f3c9ef..fb231f0 100755
--- a/fence/agents/mcdata/fence_mcdata.pl
+++ b/fence/agents/mcdata/fence_mcdata.pl
@@ -23,6 +23,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/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index dab51c1..51feb8a 100755
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -43,6 +43,8 @@ def main():
"action", "ipaddr", "login", "passwd", "passwd_script",
"cmd_prompt", "secure" ]
+ atexit.register(atexit_handler)
+
options = check_input(device_opt, process_input(device_opt))
##
diff --git a/fence/agents/sanbox2/fence_sanbox2.pl b/fence/agents/sanbox2/fence_sanbox2.pl
index d407cf2..b93f8da 100644
--- a/fence/agents/sanbox2/fence_sanbox2.pl
+++ b/fence/agents/sanbox2/fence_sanbox2.pl
@@ -16,6 +16,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 62454c7..fb68ff6 100755
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -5,6 +5,15 @@ use XML::LibXML;
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/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index c5eb935..f623ac7 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -65,6 +65,8 @@ def main():
"action", "ipaddr", "login", "passwd", "passwd_script",
"secure", "identity_file", "test", "port" ]
+ atexit.register(atexit_handler)
+
options = check_input(device_opt, process_input(device_opt))
## Defaults for fence agent
diff --git a/fence/agents/vixel/fence_vixel.pl b/fence/agents/vixel/fence_vixel.pl
index f02e654..d4af394 100755
--- a/fence/agents/vixel/fence_vixel.pl
+++ b/fence/agents/vixel/fence_vixel.pl
@@ -16,6 +16,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/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index 1aa0a1e..a20c51b 100755
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -83,6 +83,8 @@ def main():
"secure", "identity_file", "test" , "vmipaddr", "vmlogin",
"vmpasswd", "port", "vmpasswd_script" ]
+ atexit.register(atexit_handler)
+
options = check_input(device_opt, process_input(device_opt))
##
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index e20a16c..4aec6bc 100755
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -71,6 +71,8 @@ def main():
"cmd_prompt", "secure", "port", "no_login", "no_password",
"test" ]
+ atexit.register(atexit_handler)
+
options = check_input(device_opt, process_input(device_opt))
##
diff --git a/fence/agents/xcat/fence_xcat.pl b/fence/agents/xcat/fence_xcat.pl
index 86af5e9..31168bb 100755
--- a/fence/agents/xcat/fence_xcat.pl
+++ b/fence/agents/xcat/fence_xcat.pl
@@ -11,6 +11,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 a5ee0d0..ec3adc1 100755
--- a/fence/agents/zvm/fence_zvm.pl
+++ b/fence/agents/zvm/fence_zvm.pl
@@ -16,6 +16,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/.*\///;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-08-28 16:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-28 16:13 cluster: RHEL55 - fencing: #518622 - Force stdout close for fencing agents in python Marek Grác
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).