Monday, May 18, 2020

Nornir/YAML error

Hi, i've just started getting to grips with Nornir and YAML to be honest. I have created the config.yaml, hosts.yaml and groups.yaml files in notepad++ and have only have these 3 lines of code to start with in python:

from nornir import InitNornir nr = InitNornir(config_file="C:/Users/<REMOVED>/Desktop/config.yaml") nr.filter(site="uk").inventory.hosts.keys() 

I'm getting these errors:

Traceback (most recent call last): File "C:/Users/<REMOVED>/PycharmProjects/test_project/nornir_test.py", line 2, in <module> nr = InitNornir(config_file="C:/Users/<REMOVED>/Desktop/config.yaml") File "C:\Users\<REMOVED>\PycharmProjects\test_project\venv\lib\site-packages\nornir\init_nornir.py", line 64, in InitNornir config = Config.from_file(config_file, **kwargs) File "C:\Users\<REMOVED>\PycharmProjects\test_project\venv\lib\site-packages\nornir\core\configuration.py", line 308, in from_file core=CoreConfig(**{**data.get("core", {}), **core}), TypeError: __init__() got an unexpected keyword argument 'num_workers' 

My config.yaml file looks like this:

--- core: num_workers: 10 inventory: plugin: nornir.plugins.inventory.simple.SimpleInventory options: host_file: "C:/Users/<REMOVED>/Desktop/hosts.yaml" groups_file: "C:/Users/<REMOVED>/Desktop/groups.yaml" 

Any help with this would be much appreciated, go easy i'm just a newbie with Nornir



No comments:

Post a Comment