From: kupcevic@sourceware.org <kupcevic@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/fence/agents/apc fence_apc_snmp.py
Date: 14 Feb 2007 09:37:12 -0000 [thread overview]
Message-ID: <20070214093712.32537.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: kupcevic at sourceware.org 2007-02-14 09:37:11
Modified files:
fence/agents/apc: fence_apc_snmp.py
Log message:
fence_apc_snmp ignores "port" parameter
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/apc/fence_apc_snmp.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
--- cluster/fence/agents/apc/fence_apc_snmp.py 2006/08/09 19:22:02 1.2
+++ cluster/fence/agents/apc/fence_apc_snmp.py 2007/02/14 09:37:10 1.3
@@ -17,7 +17,7 @@
## located in /usr/share/snmp/mibs/
#############################################################################
#############################################################################
-
+
import getopt, sys
@@ -50,7 +50,7 @@
print " -q quiet mode";
print " -V version";
print " -v Log to file /tmp/apclog";
-
+
sys.exit(0);
@@ -89,7 +89,7 @@
sys.exit(0)
if o in ("-h", "--help"):
usage()
- sys.exit()
+ sys.exit(0)
if o == "-n":
port = a
if o == "-o":
@@ -123,8 +123,9 @@
#place params in dict
for line in sys.stdin:
val = line.split("=")
- params[val[0]] = val[1]
-
+ if len(val) == 2:
+ params[val[0].strip()] = val[1].strip()
+
try:
address = params["ipaddr"]
except KeyError, e:
@@ -135,13 +136,20 @@
except KeyError, e:
sys.stderr.write("FENCE: Missing login param for fence_apc...exiting")
sys.exit(1)
-
+
try:
passwd = params["passwd"]
except KeyError, e:
sys.stderr.write("FENCE: Missing passwd param for fence_apc...exiting")
sys.exit(1)
-
+
+ try:
+ port = params["port"]
+ except KeyError, e:
+ sys.stderr.write("FENCE: Missing port param for fence_apc...exiting")
+ sys.exit(1)
+
+
try:
a = params["option"]
if a == "Off" or a == "OFF" or a == "off":
@@ -300,13 +308,13 @@
sys.exit(1)
def execWithCaptureStatus(command, argv, searchPath = 0, root = '/', stdin = 0,
- catchfd = 1, closefd = -1):
-
+ catchfd = 1, closefd = -1):
+
if not os.access (root + command, os.X_OK):
- raise RuntimeError, command + " can not be run"
-
+ raise RuntimeError, command + " cannot be run"
+
(read, write) = os.pipe()
-
+
childpid = os.fork()
if (not childpid):
if (root and root != '/'): os.chroot (root)
@@ -317,42 +325,42 @@
os.dup2(write, catchfd)
os.close(write)
os.close(read)
-
+
if closefd != -1:
os.close(closefd)
-
+
if stdin:
os.dup2(stdin, 0)
os.close(stdin)
-
+
if (searchPath):
os.execvp(command, argv)
else:
os.execv(command, argv)
-
+
sys.exit(1)
-
+
os.close(write)
-
+
rc = ""
s = "1"
while (s):
select.select([read], [], [])
s = os.read(read, 1000)
rc = rc + s
-
+
os.close(read)
-
+
try:
(pid, status) = os.waitpid(childpid, 0)
except OSError, (errno, msg):
print __name__, "waitpid:", msg
-
+
if os.WIFEXITED(status) and (os.WEXITSTATUS(status) == 0):
status = os.WEXITSTATUS(status)
else:
status = -1
-
+
return (rc, status)
if __name__ == "__main__":
next reply other threads:[~2007-02-14 9:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-14 9:37 kupcevic [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-02-14 16:23 [Cluster-devel] cluster/fence/agents/apc fence_apc_snmp.py kupcevic
2006-08-09 19:22 jparsons
2006-08-09 19:17 jparsons
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070214093712.32537.qmail@sourceware.org \
--to=kupcevic@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).