Skip to content

Commit

Permalink
Merge pull request #648 from nornir-automation/develop
Browse files Browse the repository at this point in the history
Release 3.1.0
  • Loading branch information
dbarrosop authored Feb 27, 2021
2 parents 8e90cec + 575d5a0 commit 44e65fa
Show file tree
Hide file tree
Showing 27 changed files with 1,665 additions and 1,026 deletions.
54 changes: 30 additions & 24 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@ jobs:
uses: actions/setup-python@v1

- name: Install Poetry
uses: dschep/install-poetry-action@v1.2
uses: snok/install-poetry@v1.1.1
with:
version: 1.1.4
virtualenvs-create: true
virtualenvs-in-project: true

- name: Cache Poetry virtualenv
uses: actions/cache@v1
id: cache
uses: actions/cache@v2
id: cached-poetry-dependencies
with:
path: ~/.virtualenvs
key: poetry-linters-${{ hashFiles('**/poetry.lock') }}
restore-keys: poetry-linters-${{ hashFiles('**/poetry.lock') }}

- name: Set Poetry config
run: |
poetry config virtualenvs.in-project false
poetry config virtualenvs.path ~/.virtualenvs
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install Dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'

- name: Run pylama
run: make pylama
Expand All @@ -42,10 +41,13 @@ jobs:
make sphinx
pytest:
name: Testing on Python ${{ matrix.python-version }}
name: Testing on Python ${{ matrix.python-version }} (${{ matrix.platform}})
defaults:
run:
shell: bash
strategy:
matrix:
python-version: [ '3.6', '3.7', '3.8' ]
python-version: [ '3.6', '3.7', '3.8', '3.9' ]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand All @@ -57,26 +59,30 @@ jobs:
architecture: x64

- name: Install Poetry
uses: dschep/install-poetry-action@v1.2
uses: snok/install-poetry@v1.1.1
with:
version: 1.1.4
virtualenvs-create: true
virtualenvs-in-project: true

- name: Cache Poetry virtualenv
uses: actions/cache@v1
id: cache
uses: actions/cache@v2
id: cached-poetry-dependencies
with:
path: ~/.virtualenvs
key: poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Set Poetry config
run: |
poetry config virtualenvs.in-project false
poetry config virtualenvs.path ~/.virtualenvs
path: .venv
key: venv-${{ matrix.python-version }}-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
if: ${{ matrix.platform != 'windows-latest' }} # windows hangs if using a cached venv

- name: Install Dependencies
run: poetry install

- name: Run pytest
run: make pytest
if: ${{ matrix.platform != 'windows-latest' }}

- name: Run pytest
run: poetry run pytest --cov=nornir --cov-report=term-missing
if: ${{ matrix.platform == 'windows-latest' }}

- name: Run nbval
run: make nbval
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
Changelog
==========

3.1.0 - February 27 2021
------------------------

- F filter now supports `any` for non-list values #608 @dbarrosop
- Corrected spelling in processors.ipynb (#635) @jmcguir
- phase out discourse in favour of discussions (#622) @dbarrosop
- Create py.typed (#636) @Kircheneer
- improvements to data resolution (#623) @dbarrosop
- added method to ParentsGroup to add a group easily (#624) @kpeterson-sf
- For the Result object doc string there is a typo in the host description. (#618) @LongBeachHXC
- fixed window build hangs if using cached dependencies (#614) @dbarrosop
- Severity_level was override when task is flag as failed (#612) @FloLaco
- fix "GitHub Actions: Deprecating set-env and add-path commands" (#613) @dbarrosop
- Fix InitNornir example in docs/configuration/index.rst (#598) @ubaumann
- Docs logging fix and Pin Poetry (#600) @ktbyers
- Fix nornir_nos filter in inventory tutorial (#596) @ubaumann
- Fix linking problems in tutorial Inventory.ipynb (#589) @kimdoanh89
- added information about plugins to the README (#587) @dbarrosop

3.0.0 - September 4 2020
------------------------

Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ Please note that Nornir requires Python 3.6.2 or higher. Install Nornir with pip
pip install nornir
```

Plugins
-------

Since version 3.0.0 nornir doesn't ship with plugins, instead you can rely on `pip` to install them for you. You can find a non-exhaustive list of plugins in the following URL:

https://nornir.tech/nornir/plugins/

If you wrote a plugin and want to add it to the list don't hesitate to [add it yourself](https://github.com/nornir-automation/nornir.tech.src/blob/master/data/nornir/plugins.yaml)

Development version
-------------------

Expand Down Expand Up @@ -58,11 +67,7 @@ If you think you have bug or would like to request a new feature, please registe
Contact & Support
=================

While we are happy to help, the [GitHub issues](https://github.com/nornir-automation/nornir/issues) are intended for bugs and discussions about new features. If are struggling to get something to work you have two options:


1. You can go to our [discourse community](https://nornir.discourse.group) and see if your problem has already been discussed there or post it if it hasn't.
2. You can also head to our ``#nornir`` channel in the [networktoCode Slack team](https://networktocode.herokuapp.com/).
Official channel for communicating issues is via [GitHub issues](https://github.com/nornir-automation/nornir/issues) and you can use [GitHub discussions](https://github.com/nornir-automation/nornir/discussions) for general discussions around nornir. In addition, you can join the community in our ``#nornir`` channel in the [networktoCode Slack team](https://networktocode.herokuapp.com/).


Contributing to Nornir
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ The configuration is comprised of a set of sections and parameters for those sec
An example using ``InitNornir`` would be::

nr = InitNornir(
core={"num_workers": 20},
logging={"file": "mylogs", "level": "debug"}
runner={"plugin": "threaded", "options": {"num_workers": 20}},
logging={"log_file": "mylogs", "level": "DEBUG"}
)

A similar example using a ``yaml`` file:
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ ____________
* - **Required**
- ``False``
* - **Environment Variable**
- ``NORNIR_LOGGING_FILE``
- ``NORNIR_LOGGING_LOG_FILE``

``format``
__________
Expand Down
5 changes: 4 additions & 1 deletion docs/howto/advanced_filtering/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ inventory:
options:
host_file: "advanced_filtering/inventory/hosts.yaml"
group_file: "advanced_filtering/inventory/groups.yaml"

runner:
plugin: threaded
options:
num_workers: 20
5 changes: 3 additions & 2 deletions docs/howto/handling_connections.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
" password: a_password\r\n",
" platform: eos\r\n",
" data:\r\n",
" some_string_to_test_any_all: prefix\r\n",
" my_var: comes_from_dev1.group_1\r\n",
" www_server: nginx\r\n",
" role: www\r\n",
Expand Down Expand Up @@ -169,7 +170,7 @@
}
],
"source": [
"!sed '2,35!d' ../../tests/inventory_data/hosts.yaml"
"!sed '2,36!d' ../../tests/inventory_data/hosts.yaml"
]
}
],
Expand All @@ -189,7 +190,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.8.6"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorial/failed_tasks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
"\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31m---- Greeting is the polite thing to do ** changed : False --------------------- ERROR\u001b[0m\n",
"\u001b[0mTraceback (most recent call last):\n",
" File \"/home/dbarroso/workspace/dbarrosop/nornir/nornir/core/task.py\", line 98, in start\n",
" File \"/opt/conda/lib/python3.8/site-packages/nornir/core/task.py\", line 99, in start\n",
" r = self.task(self, **self.params)\n",
" File \"<ipython-input-1-3ab8433d31a3>\", line 20, in say\n",
" raise Exception(\"I can't say anything right now\")\n",
Expand Down Expand Up @@ -495,7 +495,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.8.6"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/initializing_nornir.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.9.2"
}
},
"nbformat": 4,
Expand Down
16 changes: 8 additions & 8 deletions docs/tutorial/inventory.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"source": [
"## Inventory\n",
"\n",
"The Inventory is arguably the most important piece of nornir. Let's see how it works. To begin with the [inventory](../../ref/api/inventory.rst#nornir.core.inventory.Inventory) is comprised of [hosts](../../ref/api/inventory.rst#nornir.core.inventory.Host), [groups](../../ref/api/inventory.rst#nornir.core.inventory.Group) and [defaults](../../ref/api/inventory.rst#nornir.core.inventory.Defaults).\n",
"The Inventory is arguably the most important piece of nornir. Let's see how it works. To begin with the [inventory](../api/nornir/core/inventory.html#module-nornir.core.inventory) is comprised of [hosts](../api/nornir/core/inventory.html#nornir.core.inventory.Hosts), [groups](../api/nornir/core/inventory.html#nornir.core.inventory.Groups) and [defaults](../api/nornir/core/inventory.html#nornir.core.inventory.Defaults).\n",
"\n",
"In this tutorial we are using the [SimpleInventory](../../plugins/inventory/simple.rst#nornir.plugins.inventory.simple.SimpleInventory) plugin. This inventory plugin stores all the relevant data in three files. Let’s start by checking them:"
"In this tutorial we are using the [SimpleInventory](../api/nornir/plugins/inventory/simple.html#nornir.plugins.inventory.simple.SimpleInventory) plugin. This inventory plugin stores all the relevant data in three files. Let’s start by checking them:"
]
},
{
Expand Down Expand Up @@ -577,7 +577,7 @@
"source": [
"### Accessing the inventory\n",
"\n",
"You can access the [inventory](../../ref/api/inventory.rst#nornir.core.inventory.Inventory) with the `inventory` attribute:"
"You can access the [inventory](../api/nornir/core/inventory.html#module-nornir.core.inventory) with the `inventory` attribute:"
]
},
{
Expand Down Expand Up @@ -877,7 +877,7 @@
{
"data": {
"text/plain": [
"'acme.local'"
"'global.local'"
]
},
"execution_count": 13,
Expand Down Expand Up @@ -1170,7 +1170,7 @@
"\n",
"##### Filter functions\n",
"\n",
"The ``filter_func`` parameter let's you run your own code to filter the hosts. The function signature is as simple as ``my_func(host)`` where host is an object of type [Host](../../ref/api/inventory.rst#nornir.core.inventory.Host) and it has to return either ``True`` or ``False`` to indicate if you want to host or not."
"The ``filter_func`` parameter let's you run your own code to filter the hosts. The function signature is as simple as ``my_func(host)`` where host is an object of type [Host](../api/nornir/core/inventory.html#nornir.core.inventory.Host) and it has to return either ``True`` or ``False`` to indicate if you want to host or not."
]
},
{
Expand Down Expand Up @@ -1264,13 +1264,13 @@
"name": "stdout",
"output_type": "stream",
"text": [
"dict_keys([])\n"
"dict_keys(['host1.cmh', 'host2.cmh', 'spine00.cmh', 'leaf00.cmh', 'host1.bma', 'host2.bma', 'spine00.bma', 'leaf00.bma'])\n"
]
}
],
"source": [
"# devices running either linux or eos\n",
"linux_or_eos = nr.filter(F(nornir_nos=\"linux\") | F(nornir_nos=\"eos\"))\n",
"linux_or_eos = nr.filter(F(platform=\"linux\") | F(platform=\"eos\"))\n",
"print(linux_or_eos.inventory.hosts.keys())"
]
},
Expand Down Expand Up @@ -1398,7 +1398,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.9.2"
}
},
"nbformat": 4,
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorial/processors.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"# Processors\n",
"\n",
"Processors are plugins that can execute code on certain events. For more invormation on those events check the [class documentation](../../ref/api/processors.rst).\n",
"Processors are plugins that can execute code on certain events. For more information on those events check the [class documentation](../../ref/api/processors.rst).\n",
"\n",
"You can see processors as an alternative way of dealing with the results of a task, however, it has a few advantages:\n",
"\n",
Expand Down Expand Up @@ -156,15 +156,15 @@
" - host1.cmh: - hi! my name is host1.cmh\n",
" - host2.cmh: - hi! my name is host2.cmh\n",
" - spine00.cmh: - hi! my name is spine00.cmh\n",
" - spine01.cmh: - hi! my name is spine01.cmh - leaf00.cmh: - hi! my name is leaf00.cmh\n",
" - spine01.cmh: - hi! my name is spine01.cmh\n",
" - leaf00.cmh: - hi! my name is leaf00.cmh\n",
" - leaf01.cmh: - hi! my name is leaf01.cmh\n",
"\n",
" - host1.bma: - hi! my name is host1.bma\n",
" - host2.bma: - hi! my name is host2.bma\n",
" - spine00.bma: - hi! my name is spine00.bma\n",
" - spine01.bma: - hi! my name is spine01.bma\n",
" - leaf00.bma: - hi! my name is leaf00.bma\n",
" - leaf01.bma: - hi! my name is leaf01.bma\n",
" - leaf00.bma: - hi! my name is leaf00.bma - leaf01.bma: - hi! my name is leaf01.bma\n",
"\n",
">>> completed: hi!\n",
">>> starting: bye!\n",
" - host1.cmh: - bye! my name is host1.cmh\n",
Expand Down Expand Up @@ -380,7 +380,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.8.6"
}
},
"nbformat": 4,
Expand Down
10 changes: 5 additions & 5 deletions docs/tutorial/task_results.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31m---- Greeting is the polite thing to do ** changed : False --------------------- ERROR\u001b[0m\n",
"\u001b[0mTraceback (most recent call last):\n",
" File \"/home/dbarroso/workspace/dbarrosop/nornir/nornir/core/task.py\", line 98, in start\n",
" File \"/opt/conda/lib/python3.8/site-packages/nornir/core/task.py\", line 99, in start\n",
" r = self.task(self, **self.params)\n",
" File \"<ipython-input-1-c084194db610>\", line 19, in say\n",
" raise Exception(\"I can't say anything right now\")\n",
Expand Down Expand Up @@ -168,7 +168,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1m\u001b[32mvvvv greet_and_count ** changed : False vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv INFO\u001b[0m\n",
"\u001b[1m\u001b[32mvvvv host1.cmh: greet_and_count ** changed : False vvvvvvvvvvvvvvvvvvvvvvvvvvvvv INFO\u001b[0m\n",
"\u001b[0mhost1.cmh counted even times!\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[32m---- Counting beans ** changed : False ----------------------------------------- INFO\u001b[0m\n",
"\u001b[0m[0, 1, 2, 3, 4]\u001b[0m\n",
Expand Down Expand Up @@ -197,7 +197,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1m\u001b[32m---- Counting beans ** changed : False ----------------------------------------- INFO\u001b[0m\n",
"\u001b[1m\u001b[32m---- host1.cmh: Counting beans ** changed : False ------------------------------ INFO\u001b[0m\n",
"\u001b[0m[0, 1, 2, 3, 4]\u001b[0m\n",
"\u001b[0m"
]
Expand Down Expand Up @@ -244,7 +244,7 @@
"\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31m---- Greeting is the polite thing to do ** changed : False --------------------- ERROR\u001b[0m\n",
"\u001b[0mTraceback (most recent call last):\n",
" File \"/home/dbarroso/workspace/dbarrosop/nornir/nornir/core/task.py\", line 98, in start\n",
" File \"/opt/conda/lib/python3.8/site-packages/nornir/core/task.py\", line 99, in start\n",
" r = self.task(self, **self.params)\n",
" File \"<ipython-input-1-c084194db610>\", line 19, in say\n",
" raise Exception(\"I can't say anything right now\")\n",
Expand Down Expand Up @@ -421,7 +421,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.8.6"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/tasks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.8.6"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 44e65fa

Please sign in to comment.