After the "try..finally.." statement is executed, the ssh_client is
closed by the "finally" statement. So the out.channel.in_buffer is
not readable and the testcases failed.
Change-Id: I3fbf620cb9ccee62c515b83fed9fd01238ad3262
Signed-off-by: Alex Yang <yangyang1@zte.com.cn>
if ssh_client:
try:
out = ssh_client.exec_command('pwd')[1]
+ channel = out.channel
+ in_buffer = channel.in_buffer
+ pwd_out = in_buffer.read(1024)
+ if not pwd_out or len(pwd_out) < 10:
+ return False
+ return True
finally:
ssh_client.close()
else:
return False
- channel = out.channel
- in_buffer = channel.in_buffer
- pwd_out = in_buffer.read(1024)
- if not pwd_out or len(pwd_out) < 10:
- return False
- return True
-
return False