Revision: 89
Author: janne.t.harkonen
Date: Wed Nov 3 00:02:41 2010
Log: return banner text from login keyword. issue 27
http://code.google.com/p/robotframework-sshlibrary/source/detail?r=89
Modified:
/trunk/atest/connections_and_login.txt
/trunk/src/SSHLibrary/__init__.py
=======================================
--- /trunk/atest/connections_and_login.txt Tue Nov 2 07:12:24 2010
+++ /trunk/atest/connections_and_login.txt Wed Nov 3 00:02:41 2010
@@ -24,6 +24,12 @@
${result} = Read Until Prompt
Should Contain ${result} /home
+Login Returns Banner Value
+ [Setup] Open Connection ${HOST}
+ ${ret}= Login ${USERNAME} ${PASSWORD}
+ Should Contain ${ret} Last login
+
+
Login With Public Key
[Setup] Open Connection ${HOST}
Login With Public Key ${PUBKEY_USERNAME} ${PUBKEY_FILE}
${PUBKEY_PASSWORD}
=======================================
--- /trunk/src/SSHLibrary/__init__.py Tue Nov 2 06:49:31 2010
+++ /trunk/src/SSHLibrary/__init__.py Wed Nov 3 00:02:41 2010
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
import time
import os
import glob
@@ -189,6 +188,7 @@
self._info("Logging into '%s:%s' as '%s'."
% (self._host, self._port, username))
self._client.login(username, password)
+ return self.read_until_prompt() if self._prompt else self.read()
def login_with_public_key(self, username, keyfile, password):
"""Logs into SSH server with given information using key-based
authentication.