cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] cluster/fence/agents/apc fence_apc_snmp.py
@ 2006-08-09 19:22 jparsons
  0 siblings, 0 replies; 4+ messages in thread
From: jparsons @ 2006-08-09 19:22 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	jparsons at sourceware.org	2006-08-09 19:22:02

Modified files:
	fence/agents/apc: fence_apc_snmp.py 

Log message:
	addresses bz193065

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/apc/fence_apc_snmp.py.diff?cvsroot=cluster&r1=1.1&r2=1.2

--- cluster/fence/agents/apc/fence_apc_snmp.py	2006/05/16 17:06:20	1.1
+++ cluster/fence/agents/apc/fence_apc_snmp.py	2006/08/09 19:22:02	1.2
@@ -38,18 +38,18 @@
 POWER_REBOOT="outletReboot"
 
 def usage():
-        print "Usage:\n";
-        print "\n";
-        print "Options:\n";
-        print "  -a <ip>          IP address or hostname of MasterSwitch\n";
-        print "  -h               usage\n";
-        print "  -l <name>        Login name\n";
-        print "  -n <num>         Outlet number to change\n";
-        print "  -o <string>      Action: Reboot (default), Off or On\n";
-        print "  -p <string>      Login password\n";
-        print "  -q               quiet mode\n";
-        print "  -V               version\n";
-        print "  -v               Log to file /tmp/apclog\n";
+        print "Usage:";
+        print "";
+        print "Options:";
+        print "  -a <ip>          IP address or hostname of MasterSwitch";
+        print "  -h               usage";
+        print "  -l <name>        Login name";
+        print "  -n <num>         Outlet number to change";
+        print "  -o <string>      Action: Reboot (default), Off or On";
+        print "  -p <string>      Login password";
+        print "  -q               quiet mode";
+        print "  -V               version";
+        print "  -v               Log to file /tmp/apclog";
                                                                                 
         sys.exit(0);
 



^ permalink raw reply	[flat|nested] 4+ messages in thread
* [Cluster-devel] cluster/fence/agents/apc fence_apc_snmp.py
@ 2007-02-14 16:23 kupcevic
  0 siblings, 0 replies; 4+ messages in thread
From: kupcevic @ 2007-02-14 16:23 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	kupcevic at sourceware.org	2007-02-14 16:23:21

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&only_with_tag=RHEL4&r1=1.1.2.2&r2=1.1.2.3

--- cluster/fence/agents/apc/fence_apc_snmp.py	2006/08/09 19:17:26	1.1.2.2
+++ cluster/fence/agents/apc/fence_apc_snmp.py	2007/02/14 16:23:21	1.1.2.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__":



^ permalink raw reply	[flat|nested] 4+ messages in thread
* [Cluster-devel] cluster/fence/agents/apc fence_apc_snmp.py
@ 2007-02-14  9:37 kupcevic
  0 siblings, 0 replies; 4+ messages in thread
From: kupcevic @ 2007-02-14  9:37 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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__":



^ permalink raw reply	[flat|nested] 4+ messages in thread
* [Cluster-devel] cluster/fence/agents/apc fence_apc_snmp.py
@ 2006-08-09 19:17 jparsons
  0 siblings, 0 replies; 4+ messages in thread
From: jparsons @ 2006-08-09 19:17 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	jparsons at sourceware.org	2006-08-09 19:17:26

Modified files:
	fence/agents/apc: fence_apc_snmp.py 

Log message:
	addresses bz193065

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/apc/fence_apc_snmp.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.1&r2=1.1.2.2

--- cluster/fence/agents/apc/fence_apc_snmp.py	2006/05/16 17:07:32	1.1.2.1
+++ cluster/fence/agents/apc/fence_apc_snmp.py	2006/08/09 19:17:26	1.1.2.2
@@ -38,18 +38,18 @@
 POWER_REBOOT="outletReboot"
 
 def usage():
-        print "Usage:\n";
-        print "\n";
-        print "Options:\n";
-        print "  -a <ip>          IP address or hostname of MasterSwitch\n";
-        print "  -h               usage\n";
-        print "  -l <name>        Login name\n";
-        print "  -n <num>         Outlet number to change\n";
-        print "  -o <string>      Action: Reboot (default), Off or On\n";
-        print "  -p <string>      Login password\n";
-        print "  -q               quiet mode\n";
-        print "  -V               version\n";
-        print "  -v               Log to file /tmp/apclog\n";
+        print "Usage:";
+        print "";
+        print "Options:";
+        print "  -a <ip>          IP address or hostname of MasterSwitch";
+        print "  -h               usage";
+        print "  -l <name>        Login name";
+        print "  -n <num>         Outlet number to change";
+        print "  -o <string>      Action: Reboot (default), Off or On";
+        print "  -p <string>      Login password";
+        print "  -q               quiet mode";
+        print "  -V               version";
+        print "  -v               Log to file /tmp/apclog";
                                                                                 
         sys.exit(0);
 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-14 16:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-09 19:22 [Cluster-devel] cluster/fence/agents/apc fence_apc_snmp.py jparsons
  -- strict thread matches above, loose matches on Subject: below --
2007-02-14 16:23 kupcevic
2007-02-14  9:37 kupcevic
2006-08-09 19:17 jparsons

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).