ERROR occurred !! Hostname not given properly 'hosts'
tonyesparza opened this issue · 2 comments
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#
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
I have provided the steps, hence closing this issue for now,
Please feel free to re-open, if issue is reproducible in the latest jsnapy version.