--- /usr/lib64/stonith/plugins/external/ibmrsa-telnet   2010-03-25 22:26:21.476805235 +0100
+++ /tmp/ibmrsa-telnet.new  2010-03-25 22:26:08.597800250 +0100
@@ -88,29 +88,29 @@
         return line

     def login(self, user, passwd):
-        self.write("\r")
-        line = self.expect(['^login : ', '^username: '], self._timeout)
+        time.sleep(1)
+        line = self.expect(['\nlogin : ', '\nusername: '], self._timeout)
         self.write(user)
         self.write('\r')
-        line = self.expect(['^Password: ', '^password: '], self._timeout)
+        line = self.expect(['\nPassword: ', '\npassword: '], self._timeout)
         self.write(passwd)
         self.write('\r')
-        line = self.expect(['^system>', '^> '], self._timeout)
+        line = self.expect(['\nsystem>', '> '], self._timeout)

     def reset(self):
         self.write('power cycle\r')
-        line = self.expect(['^ok'], self._timeout)
-        line = self.expect(['^system>', '^> '], self._timeout)
+        line = self.expect(['\nok'], self._timeout)
+        line = self.expect(['\nsystem>', '> '], self._timeout)

     def on(self):
         self.write('power on\r')
-        line = self.expect(['^ok'], self._timeout)
-        line = self.expect(['^system>', '^> '], self._timeout)
+        line = self.expect(['\nok'], self._timeout)
+        line = self.expect(['\nsystem>', '> '], self._timeout)

     def off(self):
         self.write('power off\r')
-        line = self.expect(['^ok'], self._timeout)
-        line = self.expect(['^system>', '^> '], self._timeout)
+        line = self.expect(['\nok'], self._timeout)
+        line = self.expect(['\nsystem>', '> '], self._timeout)

     def exit(self):
         self.write('exit\r')
@@ -154,7 +154,7 @@
                             time.localtime(ct)), msecs)

     def _echo_debug(self, *args):
-        subprocess.call("ha_log.sh debug '%s'" % ' '.join(args), shell=True)
+        self.echo_log('debug', *args)

     def echo(self, *args):
         what = ''.join([str(x) for x in args])
@@ -164,7 +164,7 @@
         self._echo_debug("STDOUT:", what)

     def echo_log(self, level, *args):
-        subprocess.call("ha_log.sh %s '%s'" % (level,' '.join(args)), shell=True)
+        subprocess.call(('ha_log.sh', level) +  args)

     def _get_connection(self):
         if not self._connection:
@@ -172,6 +172,7 @@
             self._echo_debug("Connect to '%s'" %
                   (self._parameters['ip_address'],))
             c.open(self._parameters['ip_address'])
+            self._echo_debug("Connection established")
             c.login(self._parameters['username'],
                     self._parameters['password'])
             self._connection = c
