Collection of plugins and functions for nornir that don't require external dependencies

nornir-automation, updated 🕥 2022-12-08 12:55:51

.. image:: https://img.shields.io/badge/docs-passing-green.svg :target: https://nornir.tech/nornir_utils/ :alt: Documentation

.. image:: https://github.com/nornir-automation/nornir_utils/workflows/test_nornir_utils/badge.svg :target: https://github.com/nornir-automation/nornir_utils/actions?query=workflow%3Atest_nornir_utils :alt: test_nornir_utils

nornir_utils

Collection of simple plugins for nornir <github.com/nornir-automation/nornir/>_

Installation

.. code::

pip install nornir_utils

Plugins

Inventory


  • YAMLInventory - Create an inventory from yaml files

Functions


  • print_result - Formats nicely and prints results on stdout.
  • print_title - Formats nicely a title and prints it on stdout.

Processors


  • PrintResult - Formats nicely and prints results on stdout as soon as they are made available.

Tasks


Data:

  • echo_data - Dummy task that echoes the data passed to it.
  • load_json - Load a JSON file.
  • load_yaml - Load a YAML file.

Files:

  • write_file - Writes content to files

Issues

Bump certifi from 2021.10.8 to 2022.12.7

opened on 2022-12-08 12:55:51 by dependabot[bot]

Bumps certifi from 2021.10.8 to 2022.12.7.

Commits


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/nornir-automation/nornir_utils/network/alerts).

Add poetry version to github workflow

opened on 2022-09-14 18:55:32 by timeforplanb123

Possible fix for this issue - #32

poetry dropped python 3.6 support from 1.2.0 version

opened on 2022-09-14 18:54:24 by timeforplanb123

poetry dropped python 3.6 support from 1.2.0 version (see https://github.com/python-poetry/poetry/releases/tag/1.2.0b1)

Now, in github main.yml workflow, pytest job with "Testing on python 3.6" breaks with an error. Error example - https://github.com/timeforplanb123/nornir_utils/actions/runs/3051796881/jobs/4925256514

What do you think about fixing the poetry version in main.yml? Example with fixed poetry version (1.1.15) - https://github.com/timeforplanb123/nornir_utils/actions/runs/3055010446/jobs/4927584794

Detailed from install-poetry action issues: - https://github.com/snok/install-poetry/issues/89 - https://github.com/snok/install-poetry/pull/90

Fixing colorama global init in print_result

opened on 2022-06-29 17:06:51 by geg347

Fixing issue #29

Hello, Here we proposed a fix for the issue 29. Thanks and have a great day!

Best regards, geg347

Unwanted characters printed after importing print_result

opened on 2022-06-29 17:02:19 by geg347

Hello,

With a colleague of mine we experienced an issue with print_result.

When we import the function in a script and use the standard print function, unwanted characters appear.

After debugging the cause, we found that the init function of colorama library is set in the print_result.py file but no deinit.

Bellow we highlighted the problem.

```# non-reproducing code $ cat scripts/test1.py

!/usr/bin/env python3

if name == "main": print("hello, world")

$ poetry run scripts/test1.py | hexdump -C 00000000 68 65 6c 6c 6f 2c 20 77 6f 72 6c 64 0a |hello, world.| 0000000d

reproducing code

$ cat scripts/test2.py

!/usr/bin/env python3

from nornir_utils.plugins.functions.print_result import print_result

if name == "main": print("hello, world")

$ poetry run scripts/test2.py | hexdump -C 00000000 68 65 6c 6c 6f 2c 20 77 6f 72 6c 64 1b 5b 30 6d |hello, world.[0m| 00000010 0a 1b 5b 30 6d |..[0m| 00000015```

I will propose a fix in a PR.

Should simpleinventory/yamlinventory ensure that the data field is always a dictionary

opened on 2022-02-02 22:41:55 by ktbyers

Someone tried to use a list directly under the data field and it caused all sorts of pain.

We probably should enforce this as a dictionary.

Releases

v0.2.0 2022-04-09 09:00:34

What's Changed

  • update poetry gh action by @dbarrosop in https://github.com/nornir-automation/nornir_utils/pull/12
  • Evaluate a host's group after groups evaluation in YAMLInventory by @bytinbit in https://github.com/nornir-automation/nornir_utils/pull/10
  • update gha snok/install-poetry by @dbarrosop in https://github.com/nornir-automation/nornir_utils/pull/20
  • Add transform_function by @ubaumann in https://github.com/nornir-automation/nornir_utils/pull/19
  • added condition for task footer in print_result by @sjhloco in https://github.com/nornir-automation/nornir_utils/pull/22
  • update black and dependencies by @dbarrosop in https://github.com/nornir-automation/nornir_utils/pull/23
  • adds tcp_ping plugin by @wvandeun in https://github.com/nornir-automation/nornir_utils/pull/13
  • Create codeql-analysis.yml by @dbarrosop in https://github.com/nornir-automation/nornir_utils/pull/24
  • Bump ipython from 7.16.2 to 7.16.3 by @dependabot in https://github.com/nornir-automation/nornir_utils/pull/25
  • Bump notebook from 6.4.6 to 6.4.10 by @dependabot in https://github.com/nornir-automation/nornir_utils/pull/28
  • bump version to 0.2.0 by @dbarrosop in https://github.com/nornir-automation/nornir_utils/pull/27

New Contributors

  • @bytinbit made their first contribution in https://github.com/nornir-automation/nornir_utils/pull/10
  • @ubaumann made their first contribution in https://github.com/nornir-automation/nornir_utils/pull/19
  • @sjhloco made their first contribution in https://github.com/nornir-automation/nornir_utils/pull/22
  • @wvandeun made their first contribution in https://github.com/nornir-automation/nornir_utils/pull/13
  • @dependabot made their first contribution in https://github.com/nornir-automation/nornir_utils/pull/25

Full Changelog: https://github.com/nornir-automation/nornir_utils/compare/v0.1.2...v0.2.0

v0.1.2 2021-02-27 09:27:38

  • updated wrong nornir dependency specification @dbarrosop

v0.1.1 2020-10-27 10:46:12

  • print hostname when not printing an AggregatedResult #8 @brasswood

v0.1.0 2020-06-18 09:03:13

v0.1.0a1 2020-06-06 10:17:52