nornir-automation / nornir

Pluggable multi-threaded framework with inventory management to help operate collections of devices
https://nornir.readthedocs.io/
Apache License 2.0
1.38k stars 234 forks source link

nornir.plugin.runners.Threadedrunner() argument after ** must be a mapping, not str #810

Closed raj15119 closed 2 years ago

raj15119 commented 2 years ago

Hello Guys, I am getting this error.

This is my code:

from nornir import InitNornir from nornir_scrapli.tasks import send_command from nornir_utils.plugins.functions import print_result

nr = InitNornir(config_file="config.yaml")

results = nr.run(task=send_command, command="show version")

print_result(results) Capture

dbarrosop commented 2 years ago

Your config is most likely wrong, make sure it is correct.

raj15119 commented 2 years ago

Your config is most likely wrong, make sure it is correct.

Not sure what is wrong in config. This is output of config.yaml.

---

inventory:
    plugin: SimpleInventory
    options:
        host_file: "hosts.yaml"
        group_file: "groups.yaml"
        defaults_file: "defaults.yaml"

runner:
    plugin: threaded
    options:
        num_workers:5
ktbyers commented 2 years ago

@raj15119 That is wrong num_workers:5

You need a space between the number and the colon or else YAML will say it is a string (as opposed to a key-value pair).

raj15119 commented 2 years ago

@raj15119 That is wrong num_workers:5

You need a space between the number and the colon or else YAML will say it is a string (as opposed to a key-value pair).

Thanks 🙏 @ktbyers it was the issue...