[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/fence/agents/apc fence_apc.py



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL45
Changes by:	rmccabe sourceware org	2007-07-17 18:38:34

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

Log message:
	Fix for 246675

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/apc/fence_apc.py.diff?cvsroot=cluster&only_with_tag=RHEL45&r1=1.1.2.3&r2=1.1.2.3.2.1

--- cluster/fence/agents/apc/fence_apc.py	2007/02/27 16:07:59	1.1.2.3
+++ cluster/fence/agents/apc/fence_apc.py	2007/07/17 18:38:33	1.1.2.3.2.1
@@ -59,6 +59,7 @@
 CONTROL_CONSOLE = "Control Console -----"
 DEVICE_MANAGER = "Device Manager -----"
 OUTLET_CONTROL = "- Outlet Control/Configuration -----"
+OUTLET_MANAGE = "- Outlet Management -----"
 CONTROL_OUTLET = "- Control Outlet -----"
 CONTROL_OUTLET_2 = "- Outlet Control "
 COMMAND_SUCCESS = "Command successfully issued."
@@ -70,9 +71,12 @@
 USERNAME = "User Name :"
 PASSWORD = "Password  :"
 MASTER = "------- MasterSwitch"
+FIRMWARE_STR = "Rack PDU APP"
 
 CONTINUE_INDEX = 0
 
+FIRMWARE_REV = 2
+
 regex_list = list()
 regex_list.append(CONTINUE)
 regex_list.append(SCREEN_END)
@@ -468,6 +472,7 @@
         sys.exit(1)
 
 def log_in(buffer):
+  global FIRMWARE_REV
   lines = buffer.splitlines()
 
   for i in lines:
@@ -480,6 +485,17 @@
         logit("Sending password: %s\n" % passwd)
       return (NOT_COMPLETE, passwd + "\r")
     elif i.find(CONTROL_CONSOLE) != (-1):
+      #while we are here, grab the firmware revision
+      rev_search_lines = buffer.splitlines()
+      for rev_search_line in rev_search_lines: #search screen again
+        rev_dex = rev_search_line.find(FIRMWARE_STR)
+        if rev_dex != (-1): #found revision line
+          scratch_rev = rev_search_line[rev_dex:]
+          v_dex = scratch_rev.find("v")
+          if v_dex != (-1):
+            if scratch_rev[v_dex + 1] == "3": #format is v3.3.4
+              FIRMWARE_REV = 3
+              break
       return (COMPLETE, "1\r") 
 
 def do_status_check(sock):
@@ -537,7 +553,12 @@
       if switchnum != "":
         res = switchnum + "\r"
       else:
-        res = "3\r"
+        if FIRMWARE_REV == 2:
+          res = "3\r"
+        elif FIRMWARE_REV == 3:
+          res = "2\r1\r"
+        else: #placeholder for future revisions 
+          res = "3\r"
       return (NOT_COMPLETE, res, "Status Unknown")
     elif i.find(OUTLET_CONTROL) != (-1):
       ls = buffer.splitlines()
@@ -639,7 +660,12 @@
       if switchnum != "":
         res = switchnum + "\r"
       else:
-        res = "3\r"
+        if FIRMWARE_REV == 2:
+          res = "3\r"
+        elif FIRMWARE_REV == 3:
+          res = "2\r1\r"
+        else: #placeholder for future revisions - sheesh
+          res = "3\r"
       return (NOT_COMPLETE, res)
       
     elif (i.find(master_search_str1) != (-1)):
@@ -660,6 +686,11 @@
     elif i == outlet_search_str5:
       return (NOT_COMPLETE, "1\r")
     
+    elif i.find(OUTLET_MANAGE) != (-1):
+      #return (NOT_COMPLETE, "1\r")
+      return (NOT_COMPLETE, "\r")
+
+    #elif i.find(OUTLET_CONTROL) != (-1) or i.find(OUTLET_MANAGE) != (-1):
     elif i.find(OUTLET_CONTROL) != (-1):
       ls = buffer.splitlines()
       portval = port.strip()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]