ktbyers / netmiko_tools

Command line tools built on Netmiko to simplify information gathering
Apache License 2.0
93 stars 32 forks source link

Problem witch netmiko-show --cmd #33

Closed thiagosagara closed 6 years ago

thiagosagara commented 6 years ago

Hi Kirk,

I've been trying use netmiko-tools, but i get some erros with netmiko-show and netmiko-grep.

I did the step-by-step on (https://pynet.twb-tech.com/blog/automation/netmiko-tools.html), but when i try run _netmiko-show --cmd "show ver" pynetrtr1 show the error:

[root@localhost ~]# netmiko-show --cmd "show ver" pynet_rtr1
Unknown exception: object of type 'int' has no len()
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/paramiko/transport.py", line 1860, in run
    handler(self.auth_handler, m)
  File "/usr/local/lib/python3.5/site-packages/paramiko/auth_handler.py", line 244, in _parse_service_accept
    m.add_string(password)
  File "/usr/local/lib/python3.5/site-packages/paramiko/message.py", line 274, in add_string
    self.add_int(len(s))
TypeError: object of type 'int' has no len()

with netmiko-show --list-devices its normal:

[root@localhost ~]# netmiko-show --list-devices

Devices:
----------------------------------------
pynet_rtr1                   (cisco_ios)
pynet_rtr2                   (cisco_ios)
pynet_rtr3                   (cisco_ios)

Groups:
----------------------------------------
all
cisco

[root@localhost ~]#

on .netmiko.yml i have:

[root@localhost ~]# cat ~/.netmiko.yml
---
#Dictionaries are devices

pynet_rtr1:
  device_type: cisco_ios
  ip: 192.168.139.138
  username: carlos
  password: 1234
  port: 22

pynet_rtr2:
  device_type: cisco_ios
  ip: 192.168.139.139
  username: carlos
  password: 1234
  port: 22

pynet_rtr3:
  device_type: cisco_ios
  ip: 192.168.139.140
  username: carlos
  password: 1234
  port: 22

# Lists are groups of devices
cisco:
    - pynet_rtr1
    - pynet_rtr2
    - pynet_rtr3
#
[root@localhost ~]#

Are there something that i should do?

ktbyers commented 6 years ago

@thiagosagara I think you need to quote your passwords in your .netmiko.yml file. Since your passwords are entirely numbers the YAML parser is thinking they are integers and not strings.

Just re-open this issue, if that is not the problem.