Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR occurred !! Hostname not given properly 'hosts' #408

Open
tonyesparza opened this issue Feb 1, 2024 · 1 comment
Open

ERROR occurred !! Hostname not given properly 'hosts' #408

tonyesparza opened this issue Feb 1, 2024 · 1 comment

Comments

@tonyesparza
Copy link

Hi,

Running into the following error, ERROR occurred !! Hostname not given properly 'hosts'
read the github documentation, but unable to figure out what the issue is.
Below are some snapshots

root@mypc:/etc/jsnapy/testfiles# ls
device.yml get_config.yml show_config.yml
root@mypc:/etc/jsnapy/testfiles#
root@mypc:/etc/jsnapy/testfiles# cat device.yml
ex:

  • x.x.x.x:
    username: user
    passwd: passwd
    root@mypc:/etc/jsnapy/testfiles# cat get_config.yml
    hosts:
  • include: device.yml
    group: ex

tests:

  • show_config.yml
    root@mypc:/etc/jsnapy/testfiles# cat show_config.yml
    tests_include:
  • test_show_config

test_show_config:

  • command: show configuration | display set | no-more
    root@mypc:/etc/jsnapy/testfiles#
    root@mypc:/etc/jsnapy/testfiles# uname -a
    Linux mypc 4.4.0-19041-Microsoft #3636-Microsoft Thu Oct 19 17:41:00 PST 2023 x86_64 x86_64 x86_64 GNU/Linux
    root@mypc:/etc/jsnapy/testfiles#
    root@mypc:/etc/jsnapy/testfiles# which jsnapy
    /usr/local/bin/jsnapy
    root@mypc:/etc/jsnapy/testfiles#
    root@mypc:/etc/jsnapy/testfiles# jsnapy --version
    JSNAPy version: 1.3.8.dev0
    root@mypc:/etc/jsnapy/testfiles# python --version
    Python 3.10.12
    root@mypc:/etc/jsnapy/testfiles#

root@mypc:/etc/jsnapy/testfiles# ssh user@x.x.x.x netconf

(user@x.x.x.x) Password:

urn:ietf:params:netconf:base:1.0 urn:ietf:params:netconf:capability:candidate:1.0 urn:ietf:params:netconf:capability:confirmed-commit:1.0 urn:ietf:params:netconf:capability:validate:1.0 urn:ietf:params:netconf:capability:url:1.0?scheme=http,ftp,file urn:ietf:params:xml:ns:netconf:base:1.0 urn:ietf:params:xml:ns:netconf:capability:candidate:1.0 urn:ietf:params:xml:ns:netconf:capability:confirmed-commit:1.0 urn:ietf:params:xml:ns:netconf:capability:validate:1.0 urn:ietf:params:xml:ns:netconf:capability:url:1.0?protocol=http,ftp,file http://xml.juniper.net/netconf/junos/1.0 http://xml.juniper.net/dmi/system/1.0 74092 ]]>]]> ^Croot@mypc:/etc/jsnapy/testfiles#

root@mypc:/etc/jsnapy/testfiles# jsnapy -vv --snap PRE -f show_config.yml

ERROR occurred !! Hostname not given properly 'hosts'
ERROR!! TypeError
Complete Message: 'NoneType' object is not iterable
root@mypc:/etc/jsnapy/testfiles#

@chidanandpujar
Copy link
Collaborator

chidanandpujar commented May 30, 2024

Hi @tonyesparza,
Please follow the steps specified below .

cat device.yml 

    hosts:
      - device: x.x.x.x
        username : xyz
        passwd: xyz
        port: 22
    tests:
      - test_show_config.yml 


cat test_show_config.yml 
tests_include:
  - test_show_config

test_show_config:
  - command: show configuration | display set  


jsnapy --snap pre -f device.yml -v
jsnapy.cfg file location used : /root/jsnapy_test1/venv/etc/jsnapy
Configuration file location used : /root/jsnapy_test1/venv/etc/jsnapy
Connecting to device x.x.x.x ................
Tests Included: test_show_config 
Taking snapshot of COMMAND: show configuration | display set 


jsnapy --snap post -f device.yml -v
jsnapy.cfg file location used : /root/jsnapy_test1/venv/etc/jsnapy
Configuration file location used : /root/jsnapy_test1/venv/etc/jsnapy
Connecting to device x.x.x.x ................
Tests Included: test_show_config 
Taking snapshot of COMMAND: show configuration | display set 


jsnapy --diff pre post -f device.yml -v
jsnapy.cfg file location used : /root/jsnapy_test1/venv/etc/jsnapy
Configuration file location used : /root/jsnapy_test1/venv/etc/jsnapy
**************************** Device: x.x.x.x ****************************
Tests Included: test_show_config 
************************ Command: show configuration ************************

Thanks
Chidanand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants