Nornir inspection tool
Project description
Nornir Inspect
Nornir inspect is a Python library for inspecting the Nornir result structure.
Install
GitHub
pip install git+ssh://git@github.com/packetcoders/nornir-inspect.git
or
poetry add git+ssh://git@github.com/packetcoders/nornir-inspect.git
Installation
pip install nornir-inspect
or
poetry add nornir-inspect
Usage
Nornir setup steps
from nornir import InitNornir
from nornir.core.task import Result, Task
nr = InitNornir(
runner={
"plugin": "threaded",
"options": {
"num_workers": 10,
},
},
inventory={
"plugin": "SimpleInventory",
"options": {"host_file": "tests/hosts.yaml"},
},
logging={"enabled": False},
)
def task_1(task: Task, number: int) -> Result:
n = number + 1
return Result(host=task.host, result=f"{n}")
result = nr.run(task=task_1, number=1)
from nornir_inspect import nornir_inspect
nornir_inspect(result)
<class 'nornir.core.task.AggregatedResult'>
├── failed = False
├── failed_hosts = {}
├── name = task_1
├── <class 'nornir.core.task.MultiResult'> ['node1']
│ ├── failed = False
│ ├── failed_hosts = {}
│ ├── name = task_1
│ └── <class 'nornir.core.task.Result'> [0]
│ ├── changed = False
│ ├── diff =
│ ├── exception = None
│ ├── failed = False
│ ├── host = node1
│ ├── name = task_1
│ ├── result = 2
│ ├── severity_level = 20
│ ├── stderr = None
│ └── stdout = None
├── <class 'nornir.core.task.MultiResult'> ['node2']
│ ├── failed = False
│ ├── failed_hosts = {}
│ ├── name = task_1
│ └── <class 'nornir.core.task.Result'> [0]
│ ├── changed = False
│ ├── diff =
│ ├── exception = None
│ ├── failed = False
│ ├── host = node2
│ ├── name = task_1
│ ├── result = 2
│ ├── severity_level = 20
│ ├── stderr = None
│ └── stdout = None
└── <class 'nornir.core.task.MultiResult'> ['node3']
├── failed = False
├── failed_hosts = {}
├── name = task_1
└── <class 'nornir.core.task.Result'> [0]
├── changed = False
├── diff =
├── exception = None
├── failed = False
├── host = node3
├── name = task_1
├── result = 2
├── severity_level = 20
├── stderr = None
└── stdout = None
Addtional Options
vals
(bool): If True, the values of the attributes will be printed. Defaults to True.headings
(bool): If True, the first line of the output will include the objects key name or list postion. Defaults to True.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nornir-inspect-1.0.2.tar.gz
(7.9 kB
view details)
Built Distribution
File details
Details for the file nornir-inspect-1.0.2.tar.gz
.
File metadata
- Download URL: nornir-inspect-1.0.2.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0 CPython/3.8.10 Linux/5.10.16.3-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53bc67400c9abac2c93182b05bcd4c6a713efec30f20bab8c2261333bcb9f7f0 |
|
MD5 | e0cca80b70430cd3b96afb99803b3e26 |
|
BLAKE2b-256 | dcd82aea471adc0798a52c0577fabb2403f006ed1cc9cfef8f3d659fa45be63c |
File details
Details for the file nornir_inspect-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: nornir_inspect-1.0.2-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0 CPython/3.8.10 Linux/5.10.16.3-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d2212085d4f83b40ea308c43adf5a356b5cd3f9c288ee4ce06ad3d4ffe1cd07 |
|
MD5 | b2dcd68a9ec18d1987d15212df63f057 |
|
BLAKE2b-256 | c0d530eb994b2d39aecac71fd336d7d31134fb11f665f0f9925136466b0276c5 |