Make ClusterManagement keywords preserve active SSH connection 93/37793/5
authorJozef Behran <jbehran@cisco.com>
Tue, 19 Apr 2016 10:19:30 +0000 (12:19 +0200)
committerVratko Polák <vrpolak@cisco.com>
Mon, 2 May 2016 10:56:50 +0000 (10:56 +0000)
The question in the documentation of ClusterManagement was
answered as "yes otherwise these keywords will need
boilerplate code around it to be used properly". Especially
when the fix itself turns out to be a two-liner.

Change-Id: I2b70d0a3147ee5aa2205fbd08eb363262c608d1c
Signed-off-by: Jozef Behran <jbehran@cisco.com>
csit/libraries/ClusterManagement.robot
csit/libraries/Utils.robot

index 16713a3b3ef9f09ded73aef9b6e3ca9af070e74b..c2b8ac678722344f19e0b87dad576d57a74cb510 100644 (file)
@@ -16,9 +16,6 @@ Documentation     Resource housing Keywords common to several suites for cluster
 ...
 ...               odl-jolokia is assumed to be installed.
 ...
-...               Keywords which run commands on ODL systems do not preserve active SSH session.
-...               TODO: Should they?
-...
 ...               Keywords are ordered from friendly ones to fiddly ones.
 ...               TODO: Figure out more deterministic but still user-friendly ordering.
 ...
index 783a91a5aceabd3ea2f0c81ce8253c551b024fed..d9bfedfc8231611255c46a0c8f52c63d808524e4 100644 (file)
@@ -232,12 +232,14 @@ Run Command On Remote System
     [Documentation]    Reduces the common work of running a command on a remote system to a single higher level
     ...    robot keyword, taking care to log in with a public key and. The command given is written
     ...    and the output returned. No test conditions are checked.
+    ${current_ssh_connection}=    SSHLibrary.Get Connection
     Log    Attempting to execute ${cmd} on ${system} by ${user} with ${keyfile_pass} and ${prompt}
     ${conn_id}=    SSHLibrary.Open Connection    ${system}    prompt=${prompt}    timeout=${prompt_timeout}
     Flexible SSH Login    ${user}    ${password}
     ${stdout}    ${stderr}    SSHLibrary.Execute Command    ${cmd}    return_stderr=True
     SSHLibrary.Close Connection
     Log    ${stderr}
+    [Teardown]    KarafKeywords.Restore_Current_SSH_Connection_From_Index    ${current_ssh_connection.index}
     [Return]    ${stdout}
 
 Write_Bare_Ctrl_C