Skip to content

Commit

Permalink
Merge pull request #206 from nautobot/release-v2.0.3
Browse files Browse the repository at this point in the history
Release v2.0.3
  • Loading branch information
whitej6 authored Jan 8, 2024
2 parents fcffca6 + f08deb1 commit 03de0c6
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 243 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: "networktocode/gh-action-setup-poetry-environment@v4"
- name: "Linting: bandit"
run: "poetry run invoke bandit"
pydocstyle:
ruff:
runs-on: "ubuntu-22.04"
env:
INVOKE_NAUTOBOT_FIREWALL_MODELS_LOCAL: "True"
Expand All @@ -47,8 +47,8 @@ jobs:
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v4"
- name: "Linting: pydocstyle"
run: "poetry run invoke pydocstyle"
- name: "Linting: ruff"
run: "poetry run invoke ruff"
check-docs-build:
runs-on: "ubuntu-22.04"
env:
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
pylint:
needs:
- "bandit"
- "pydocstyle"
- "ruff"
- "flake8"
- "poetry"
- "yamllint"
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
check-migrations:
needs:
- "bandit"
- "pydocstyle"
- "ruff"
- "flake8"
- "poetry"
- "yamllint"
Expand Down Expand Up @@ -230,7 +230,9 @@ jobs:
- name: "Run Tests"
run: "poetry run invoke unittest"
changelog:
if: contains(fromJson('["develop","ltm-1.6"]'), github.base_ref)
if: |
contains(fromJson('["develop","ltm-1.6"]'), github.base_ref) &&
(github.head_ref != 'main')
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository code"
Expand Down
10 changes: 10 additions & 0 deletions docs/admin/release_notes/version_2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

This document describes all new features and changes in the release `2.0`. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v2.0.3 (2024-01-08)

### Changed

- [#202](https://github.com/nautobot/nautobot/issues/202) - Replaced `pydocstyle` with `ruff`.

### Fixed

- [#203](https://github.com/nautobot/nautobot/issues/203) - Fixed old reference to class path in URL pattern for job.

## v2.0.2 - 2024-01-04

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The project is packaged with a light [development environment](dev_environment.m

The project is following Network to Code software development guidelines and is leveraging the following:

- Python linting and formatting: `black`, `pylint`, `bandit`, `flake8`, and `pydocstyle`.
- Python linting and formatting: `black`, `pylint`, `bandit`, `flake8`, and `ruff`.
- YAML linting is done with `yamllint`.
- Django unit test to ensure the app is working properly.

Expand Down
4 changes: 2 additions & 2 deletions docs/dev/dev_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Each command can be executed with `invoke <command>`. All commands support the a
bandit Run bandit to validate basic static code security analysis.
black Run black to check that Python files adhere to its style standards.
flake8 Run flake8 to check that Python files adhere to its style standards.
pydocstyle Run pydocstyle to validate docstring formatting adheres to NTC defined standards.
ruff Run ruff to validate docstring formatting adheres to NTC defined standards.
pylint Run pylint code analysis.
tests Run all tests for this app.
unittest Run Django unit tests for the app.
Expand Down Expand Up @@ -467,6 +467,6 @@ To run an individual test, you can run any or all of the following:
➜ invoke bandit
➜ invoke black
➜ invoke flake8
➜ invoke pydocstyle
➜ invoke ruff
➜ invoke pylint
```
3 changes: 2 additions & 1 deletion nautobot_firewall_models/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Meta:
name = "Generate FW Config via Capirca."
description = "Generate FW Config via Capirca and update the models."
commit_default = True
has_sensitive_variables = False

def run(self, device): # pylint: disable=arguments-differ
"""Run a job to remove legacy reservations."""
Expand All @@ -48,7 +49,7 @@ def run(self, device): # pylint: disable=arguments-differ
device_obj = Device.objects.get(pk=dev)
logger.debug("Running against Device: `%s`", str(device_obj))
CapircaPolicy.objects.update_or_create(device=device_obj)
logger.info(obj=device_obj, message=f"{device_obj} Updated")
logger.info(f"{device_obj} Updated", extra={"object": device_obj})


jobs = [RunCapircaJob]
Expand Down
1 change: 1 addition & 0 deletions nautobot_firewall_models/management/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Management for Nautobot Firewall Models."""
1 change: 1 addition & 0 deletions nautobot_firewall_models/management/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Management Commands for Nautobot Firewall Models."""
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<div class="panel-heading">
<strong>Capirca Firewall Configurations</strong> -
<a href="{% url 'plugins:nautobot_firewall_models:capircapolicy_devicedetail' pk=object.pk %}"><i class="mdi mdi-file-document-outline"></i></a>
<a href="{% url 'extras:job' class_path='plugins-nautobot_firewall_models-jobs-runcapircajob/run' %}?device={{ object.pk }}"><i class="mdi mdi-play-circle" title="Execute Capirca Jobs"></i></a>
<a href="{% url 'extras:job_run_by_class_path' class_path='nautobot_firewall_models.jobs.RunCapircaJob' %}?device={{ object.pk }}"><i class="mdi mdi-play-circle" title="Execute Capirca Jobs"></i></a>
</div>
</div>
4 changes: 0 additions & 4 deletions nautobot_firewall_models/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class IPRangeAPIViewTest(APIViewTestCases.APIViewTestCase):
@classmethod
def setUpTestData(cls):
"""Create test data for API calls."""

cls.create_data = [
{"start_address": "10.0.0.1", "end_address": "10.0.0.3"},
{"start_address": "10.0.0.4", "end_address": "10.0.0.10"},
Expand All @@ -39,7 +38,6 @@ class FQDNAPIViewTest(APIViewTestCases.APIViewTestCase):
@classmethod
def setUpTestData(cls):
"""Create test data for API calls."""

cls.create_data = [
{"name": "test.local"},
{"name": "sub.test.local"},
Expand Down Expand Up @@ -181,7 +179,6 @@ class UserObjectAPIViewTest(APIViewTestCases.APIViewTestCase):
@classmethod
def setUpTestData(cls):
"""Create test data for API calls."""

cls.create_data = [
{"username": "test1", "name": "Foo"},
{"username": "test2", "name": "Bar"},
Expand Down Expand Up @@ -222,7 +219,6 @@ class ZoneAPIViewTest(APIViewTestCases.APIViewTestCase):
@classmethod
def setUpTestData(cls):
"""Create test data for API calls."""

cls.create_data = [
{"name": "trust"},
{"name": "untrust"},
Expand Down
8 changes: 3 additions & 5 deletions nautobot_firewall_models/tests/test_capirca.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def setUp(self) -> None:
create_capirca_env()

def test_generate_capirca_config(self):
"""Test the implementation of capirca"""
"""Test the implementation of capirca."""
# This partially tests the underlying library, but kept since it helps ensure that overloading
# ParseServiceList and ParseNetworkList continue to work. As well as provides an easy place to test locally.
# Such as running `invoke unittest -l nautobot_firewall_models.tests.test_capirca.TestBasicCapirca` and
Expand Down Expand Up @@ -311,7 +311,6 @@ def setUp(self) -> None:

def test_address_skip(self):
"""Check that address objects are found with status active and not found when other."""

self.pol_rule6.source_addresses.set([self.addr_obj4, self.addr_obj5])
self.pol_rule6.validated_save()
_, networkdata, _ = PolicyToCapirca(self.dev_name, self.pol1).validate_capirca_data()
Expand Down Expand Up @@ -350,7 +349,6 @@ def test_address_empty(self):

def test_address_fqdn(self):
"""Test that validation fails on creating an FQDN when using capirca."""

fqdn1 = FQDN.objects.create(name="test.other", status=self.active)
self.addr_obj5.ip_address = None
self.addr_obj5.fqdn = fqdn1
Expand All @@ -371,7 +369,6 @@ def test_address_ip_range(self):

def test_address_group_skip(self):
"""Check that address group objects are found with status active and not found when other."""

self.pol_rule6.source_address_groups.set([self.addr_grp3, self.addr_grp4])
self.pol_rule6.validated_save()
_, networkdata, _ = PolicyToCapirca(self.dev_name, self.pol1).validate_capirca_data()
Expand Down Expand Up @@ -576,6 +573,7 @@ def test_policy_chd_allow_list(self):
self.assertNotIn("other-value", pol[1]["headers"])

def test_policy_ctd_allow_list(self):
"""Test terms can be allowed and not allowed based on custom field."""
self.pol_rule6._custom_field_data = {"ctd_test-custom": "unique-value", "ctd_test-other": "other-value"}
self.pol_rule6.save()
self.device_obj.platform._custom_field_data = {"capirca_allow": ["ctd_test-custom"]}
Expand Down Expand Up @@ -633,7 +631,7 @@ def setUp(self) -> None:

@skip("Not implemented until policy method provided to merge queries provided")
def test_dynamic_group_and_device(self):
pass
"""Test that dynamic groups are created and device is added to it, disabled."""

def test_multi_policy_capirca_config(self):
"""Verify that generating full config for a device is as expected."""
Expand Down
Loading

0 comments on commit 03de0c6

Please sign in to comment.