Skip to main content

Nornir inspection tool

Project description

Nornir Inspect

Nornir Inspect is a lightweight Python library for visually inspecting the structure of Nornir task results.
It formats nested AggregatedResult, MultiResult, and Result objects into a readable tree layout.

Install

pip install nornir-inspect

or

uv 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

Additional Options

  • vals: bool – If True, the values of the object's attributes will be printed.
    Default: True

  • headings: bool – If True, the first line of the output will include the object's key name or list position.
    Default: True

Project details


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.1.0.tar.gz (63.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nornir_inspect-1.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file nornir_inspect-1.1.0.tar.gz.

File metadata

  • Download URL: nornir_inspect-1.1.0.tar.gz
  • Upload date:
  • Size: 63.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for nornir_inspect-1.1.0.tar.gz
Algorithm Hash digest
SHA256 73c5a254476895d80771df616ae8a523037319e502e04c8b5b3c2a8b3078249f
MD5 f0d479d7bb43ac6c7e3759207965b15a
BLAKE2b-256 3f47c8759836cd6d348267c398e37b7cb98b83890cfc8c095a5c3fd205f23d9a

See more details on using hashes here.

File details

Details for the file nornir_inspect-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nornir_inspect-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d77a977d1db55405f72416135453ef361c8c185917eeac7ffaa4160082eb49e6
MD5 5d5123283fecbcdd37f193d022cb48e8
BLAKE2b-256 c3852355f3a81295550cc848c7de9dab84e854715fa843d4e04c56884c8a8af0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page