Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
paramiko exit code
#1
Hello,

I would like to ask please what is the correct way to check for exit code in paramiko. For some devices when the "show version" works fine it gives exit code as 0, for other devices where also "show version" works fine it shows the exit code as 255


Example:
>>> ssh.connect(hostname, port, username, password, look_for_keys=False)
>>> stdin,stdout,stderr = ssh.exec_command('show version')
>>> Exit = (stdout.channel.recv_exit_status())
>>> ssh.close()
>>> print (Exit)
255
Here is the device output.
Output:
RP/0/0/CPU0:vPE4-XR#show version Tue Aug 20 12:38:53.982 UTC Cisco IOS XR Software, Version 5.1.3[Default] Copyright (c) 2014 by Cisco Systems, Inc.
Thanks
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020