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

I'm runing nornir 2.0 in a bad way that I couldn't identify the issue, need help. #28

Open
pravinrajPK opened this issue Dec 31, 2019 · 5 comments

Comments

@pravinrajPK
Copy link

Hi Kirk,,

I followed your document of "Introduction to nornir' and facing the issues on nornir with windows OS.

The debugger logs :

c:\users\tkmamja.pycharmce2019.1\venv\scripts\lpthw\test\ktbyers\hey\heyhey.py(1)()
-> from nornir import InitNornir
(Pdb) n

c:\users\tkmamja.pycharmce2019.1\venv\scripts\lpthw\test\ktbyers\hey\heyhey.py(3)()
-> nr = InitNornir()
(Pdb) p nr
*** NameError: name 'nr' is not defined
(Pdb) p
*** SyntaxError: unexpected EOF while parsing
(Pdb) p nr
*** NameError: name 'nr' is not defined
(Pdb) n
ruamel.yaml.scanner.ScannerError: mapping values are not allowed in this context
in "hosts.yaml", line 2, column 5
c:\users\tkmamja.pycharmce2019.1\venv\scripts\lpthw\test\ktbyers\hey\heyhey.py(3)()
-> nr = InitNornir()
(Pdb) n
--Return--
c:\users\tkmamja.pycharmce2019.1\venv\scripts\lpthw\test\ktbyers\hey\heyhey.py(3)()->None
-> nr = InitNornir()
(Pdb) n
ruamel.yaml.scanner.ScannerError: mapping values are not allowed in this context
in "hosts.yaml", line 2, column 5
(1)()->None
(Pdb) p nr.inventory.hosts
*** NameError: name 'nr' is not defined
(Pdb) exit

When I ran the program I get this :

$ python heyhey.py
Traceback (most recent call last):
File "heyhey.py", line 5, in
nr = InitNornir()
File "C:\Users\TKMAMJA.PyCharmCE2019.1\venv\lib\site-packages\nornir\init_nornir.py", line 78, in InitNornir
**conf.inventory.options,
File "C:\Users\TKMAMJA.PyCharmCE2019.1\venv\lib\site-packages\nornir\core\deserializer\inventory.py", line 129, in deserialize
deserialized = cls(*args, **kwargs)
File "C:\Users\TKMAMJA.PyCharmCE2019.1\venv\lib\site-packages\nornir\plugins\inventory\simple.py", line 55, in init
super().init(hosts=hosts, groups=groups, defaults=defaults, *args, **kwargs)
File "C:\Users\TKMAMJA.PyCharmCE2019.1\venv\lib\site-packages\pydantic\main.py", line 142, in init
self.setstate(self._process_values(data))
File "C:\Users\TKMAMJA.PyCharmCE2019.1\venv\lib\site-packages\pydantic\main.py", line 312, in _process_values
return validate_model(self, input_data)
File "C:\Users\TKMAMJA.PyCharmCE2019.1\venv\lib\site-packages\pydantic\main.py", line 474, in validate_model
raise ValidationError(errors)
pydantic.error_wrappers.ValidationError: 4 validation errors
hosts -> rtr1 -> nornir_host
extra fields not permitted (type=value_error.extra)
groups -> defaults -> nornir_password
extra fields not permitted (type=value_error.extra)
groups -> defaults -> nornir_username
extra fields not permitted (type=value_error.extra)
groups -> cisco_ios -> nornir_nos
extra fields not permitted (type=value_error.extra)

What am I doing wrong here?????????? Could be great help.

@ktbyers
Copy link
Owner

ktbyers commented Dec 31, 2019

Looks like your inventory format is probably wrong. You would have to post your inventory here for me to be able to help.

Obviously obfuscate anything that is confidential.

@pravinrajPK pravinrajPK changed the title I'm runing nornir 2.0 in a bad that I couldn't identify the issue, need help. I'm runing nornir 2.0 in a bad way that I couldn't identify the issue, need help. Jan 7, 2020
@pravinrajPK
Copy link
Author

Hi Kirk,

I have the code and the nornir package in the same folder in my windows machine (windows 7 professional).
I have attached the logs, groups and hosts yaml files in .txt to your review.

I'm just not sure what I'm doing wrong here.

nornir.log

groups.txt
hosts.txt

@ktbyers
Copy link
Owner

ktbyers commented Jan 7, 2020

@pravinrajgit You are using an old format of Nornir's inventory (before 2.X.X). You need to convert over to the new Nornir inventory format. See this tutorial for more details:

https://nornir.readthedocs.io/en/stable/tutorials/intro/inventory.html

@pravinrajPK
Copy link
Author

Ahh I see that... Let me try that....

Kirk any comments on the attached image?

4a867f5b-738f-4e44-be4a-50380be097a3

@ktbyers
Copy link
Owner

ktbyers commented Jan 8, 2020

I am not sure what you are trying to show me there?

Please don't include screen-shots i.e. copy-and paste is much better (as it is much easier to read and to reproduce if needed).

It still looks like your inventory format is probably incorrect.

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