Skip to main content

Nornir inspection tool

Project description

Nornir Inspect

Nornir inspect is a Python library for inspecting the Nornir result structure.

Install

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


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

Uploaded Source

Built Distribution

nornir_inspect-1.0.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file nornir-inspect-1.0.3.tar.gz.

File metadata

  • Download URL: nornir-inspect-1.0.3.tar.gz
  • Upload date:
  • Size: 7.8 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

Hashes for nornir-inspect-1.0.3.tar.gz
Algorithm Hash digest
SHA256 06cf22959c0d8e07d697f9869a0b8fce4964b758b35779ba2925b3aeb2ad30ab
MD5 bddc7c519e79ed1eb03723047f2bca6c
BLAKE2b-256 ed2e3a46df35d9d6f163f463ac612144f913c262ada033976edcd6dd0cd48378

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nornir_inspect-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.0 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

Hashes for nornir_inspect-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0050dcc0dd851304c104ecf21110f4c20c088b3d33d1f8bfd08790d72dd432cc
MD5 11bc1d574ede81688e27c2d7451a5772
BLAKE2b-256 848c3584190b8e7cb844c5c6b7114c21e4ca40b67c7e81e47d4d2d2fa6ff95e0

See more details on using hashes here.

Supported by

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