Collection of 'nice looking' functions with rich for nornir
Project description
nornir_rich
Install
pip install nornir-rich
Usage
Features
- Print functions
print_result
print_failed_hosts
print_inventory
- Processors
progressbar
Print example
from nornir_rich.functions import print_result
results = nr.run(
task=hello_world
)
print_result(results)
print_result(results, vars=["diff", "result", "name", "exception", "severity_level"])
Progress bar example
from time import sleep
from nornir_rich.progress_bar import RichProgressBar
def random_sleep(task: Task) -> Result:
delay = randrange(10)
sleep(delay)
return Result(host=task.host, result=f"{delay} seconds delay")
nr_with_processors = nr.with_processors([RichProgressBar()])
result = nr_with_processors.run(task=random_sleep)
Images
Print Inventory
Print Result
Progress Bar
More examples
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_rich-0.2.0.tar.gz
(4.9 kB
view details)
Built Distribution
File details
Details for the file nornir_rich-0.2.0.tar.gz
.
File metadata
- Download URL: nornir_rich-0.2.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28835cb4fbbda36596661bbf07bfa58cc6f6fc27cff022c583ec593563d56224 |
|
MD5 | 92737e00833cf23b61d9005ec493cd69 |
|
BLAKE2b-256 | cd3f988a534d7893d29d53e935c8407d080509889bcf061a5f3911077cc25cce |
File details
Details for the file nornir_rich-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: nornir_rich-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19c48ec3c8ea0cb47c84a1bcb65a4a380f814265cbaec809dfd064c220e68b07 |
|
MD5 | 010ebbeacf18c0f2df4537ab7a94066a |
|
BLAKE2b-256 | f641343c6e5c59921d14f656ca5aca5c700dcd7ab40e4b9c9cf24f8aa349adfd |