Send Linux-ha-cvs mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."
Today's Topics:
1. Linux-HA CVS: cts by andrew from
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Tue, 18 Apr 2006 10:09:53 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: cts by andrew from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : andrew
Host :
Project : linux-ha
Module : cts
Dir : linux-ha/cts
Modified Files:
CTS.py.in CM_LinuxHAv2.py.in
Log Message:
remote_python_call
- rename
- make it work with commands that have output
transparently run local commands locally (ie. not using ssh)
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cts/CTS.py.in,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -3 -r1.54 -r1.55
--- CTS.py.in 11 Apr 2006 11:16:31 -0000 1.54
+++ CTS.py.in 18 Apr 2006 16:09:53 -0000 1.55
@@ -53,6 +53,8 @@
# -B: batch mode, -q: no stats (quiet)
self.CpCommand = "@SCP@ -B -q"
+ self.OurNode=string.lower(os.uname()[1])
+
def setcmd(self, rshcommand):
'''Set the name of the remote shell command'''
@@ -70,7 +72,11 @@
args= args[0]
sysname = args[0]
command = args[1]
- ret = self.Command + " " + sysname + " '" + self._fixcmd(command) + "'"
+
+ if sysname == self.OurNode or sysname == "localhost":
+ ret = self._fixcmd(command)
+ else:
+ ret = self.Command + " " + sysname + " '" + self._fixcmd(command) +
"'"
#print ("About to run %s\n" % ret)
return ret
@@ -147,19 +153,29 @@
return rc
print "Retrying command %s" % sshnoBlock
return rc
-
- def remote_python_call(self, node, module, func, *args):
+
+ def remote_py(self, node, module, func, *args):
'''Execute a remote python function
If the call success, lastrc == 0 and return result.
If the call fail, lastrc == 1 and return the reason (string)
'''
encode_args = binascii.b2a_base64(pickle.dumps(args))
- result = self.readaline(node, \
+ result = self.readlines(node, \
string.join(["@libdir@/heartbeat/cts/CTSproxy.py",module,func,encode_args]))
- if self.lastrc == 0 :
- return pickle.loads(binascii.a2b_base64(result))
+
+ if result != None:
+ result.pop()
+
+ if self.lastrc == 0:
+ last_line=""
+ if result != None:
+ array_len = len(result)
+ if array_len > 0:
+ last_line=result.pop()
+ #print "result: %s" % repr(last_line)
+ return pickle.loads(binascii.a2b_base64(last_line)), result
- return result
+ return -1, result
class LogWatcher:
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cts/CM_LinuxHAv2.py.in,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -3 -r1.144 -r1.145
--- CM_LinuxHAv2.py.in 11 Apr 2006 11:16:31 -0000 1.144
+++ CM_LinuxHAv2.py.in 18 Apr 2006 16:09:53 -0000 1.145
@@ -137,8 +137,8 @@
def install_config(self, node):
if not self.CIBsync.has_key(node) and self.Env["ClobberCIB"] == 1:
self.CIBsync[node] = 1
- self.rsh.remote_python_call(node, "os", "system", "rm -f
@HA_VARLIBDIR@/heartbeat/crm/cib.xml")
- self.rsh.remote_python_call(node, "os", "system", "rm -f
@HA_VARLIBDIR@/heartbeat/crm/cib.xml.sig")
+ self.rsh.remote_py(node, "os", "system", "rm -f
@HA_VARLIBDIR@/heartbeat/crm/cib.xml")
+ self.rsh.remote_py(node, "os", "system", "rm -f
@HA_VARLIBDIR@/heartbeat/crm/cib.xml.sig")
# Only install the CIB on the first node, all the other ones will
pick it up from there
if self.cib_installed == 1:
@@ -163,7 +163,7 @@
"root@" + (self["CIBfile"]%node)):
raise ValueError("Can not scp file to %s "%node)
- self.rsh.remote_python_call(node, "os", "system", "chown
@HA_CCMUSER@ @HA_VARLIBDIR@/heartbeat/crm/cib.xml")
+ self.rsh.remote_py(node, "os", "system", "chown @HA_CCMUSER@
@HA_VARLIBDIR@/heartbeat/crm/cib.xml")
def prepare(self):
'''Finish the Initialization process. Prepare to test...'''
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 29, Issue 94
********************************************