[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: 	RHEL5
Changes by:	jparsons sourceware org	2007-07-11 06:37:14

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

Log message:
	Fix for bz238106 - new firmware version delta

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

--- cluster/fence/agents/apc/fence_apc.py	2007/06/27 15:10:27	1.1.4.3
+++ cluster/fence/agents/apc/fence_apc.py	2007/07/11 06:37:14	1.1.4.4
@@ -71,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)
@@ -469,6 +472,7 @@
         sys.exit(1)
 
 def log_in(buffer):
+  global FIRMWARE_REV
   lines = buffer.splitlines()
 
   for i in lines:
@@ -481,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):
@@ -538,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()
@@ -640,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)):
@@ -661,7 +686,12 @@
     elif i == outlet_search_str5:
       return (NOT_COMPLETE, "1\r")
     
-    elif i.find(OUTLET_CONTROL) != (-1) or i.find(OUTLET_MANAGE) != (-1):
+    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()
       portval = " " + portval + " "


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