Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conflicts #556

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8"]
nautobot-version: ["1.5.14"]
python-version: ["3.11"]
nautobot-version: ["1.6.1"]
env:
INVOKE_NAUTOBOT_GOLDEN_CONFIG_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_GOLDEN_CONFIG_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
Expand Down Expand Up @@ -116,20 +116,20 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10"] # Removed 3.7
python-version: ["3.8", "3.9", "3.10", "3.11"]
db-backend: ["postgresql"]
nautobot-version: ["latest"]
# The include is a method to limit the amount of jobs ran. This essentially
# means that in addition to standard postgres and stable, also the lowest
# supported version and with mysql
include:
- python-version: "3.10"
- python-version: "3.11"
db-backend: "postgresql"
nautobot-version: "1.5.14"
nautobot-version: "1.6.1"
- python-version: "3.8"
db-backend: "mysql"
nautobot-version: "1.5.14"
- python-version: "3.10"
nautobot-version: "1.6.1"
- python-version: "3.11"
db-backend: "mysql"
nautobot-version: "latest"
runs-on: "ubuntu-20.04"
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
python-version: "3.11"
- name: "Install Python Packages"
run: "pip install poetry"
- name: "Set env"
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
python-version: "3.11"
- name: "Install Python Packages"
run: "pip install poetry"
- name: "Set env"
Expand Down
8 changes: 4 additions & 4 deletions development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
# -------------------------------------------------------------------------------------
# !!! USE CAUTION WHEN MODIFYING LINES BELOW

# Accepts a desired Nautobot version as build argument, default to 1.5.14
ARG NAUTOBOT_VER="1.5.14"
# Accepts a desired Nautobot version as build argument, default to 1.6.1
ARG NAUTOBOT_VER="1.6.1"

# Accepts a desired Python version as build argument, default to 3.7
ARG PYTHON_VER="3.8"
# Accepts a desired Python version as build argument, default to 3.11
ARG PYTHON_VER="3.11"

# Retrieve published development image of Nautobot base which should include most CI dependencies
FROM ghcr.io/nautobot/nautobot-dev:${NAUTOBOT_VER}-py${PYTHON_VER}
Expand Down
1 change: 0 additions & 1 deletion development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
"enable_postprocessing": is_truthy(os.environ.get("ENABLE_POSTPROCESSING", True)),
"postprocessing_callables": os.environ.get("POSTPROCESSING_CALLABLES", []),
"postprocessing_subscribed": os.environ.get("POSTPROCESSING_SUBSCRIBED", []),
"enable_config_context_sync": is_truthy(os.environ.get("ENABLE_CONFIG_CONTEXT_SYNC", False)),
# The platform_slug_map maps an arbitrary platform slug to its corresponding parser.
# Use this if the platform slug names in your Nautobot instance don't correspond exactly
# to the Nornir driver names ("arista_eos", "cisco_ios", etc.).
Expand Down
2 changes: 0 additions & 2 deletions docs/admin/admin_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ PLUGINS_CONFIG = {
"enable_postprocessing": False,
"postprocessing_callables": [],
"postprocessing_subscribed": [],
"enable_config_context_sync": False,
"platform_slug_map": None,
# "get_custom_compliance": "my.custom_compliance.func"
},
Expand Down Expand Up @@ -98,7 +97,6 @@ The plugin behavior can be controlled with the following list of settings.
| postprocessing_callables | ['mypackage.myfunction'] | [] | A list of function paths, in dotted format, that are appended to the available methods for post-processing the intended configuration, for instance, the `render_secrets`. |
| postprocessing_subscribed | ['mypackage.myfunction'] | [] | A list of function paths, that should exist as postprocessing_callables, that defines the order of application of during the post-processing process. |
| platform_slug_map | {"cisco_wlc": "cisco_aireos"} | None | A dictionary in which the key is the platform slug and the value is what netutils uses in any "network_os" parameter within `netutils.config.compliance.parser_map`. |
| enable_config_context_sync | False | False | A boolean to represent whether to synchronize all configured Config Context git repositories during the intended generation. |
| sot_agg_transposer | "mypkg.transposer" | None | A string representation of a function that can post-process the graphQL data. |
| per_feature_bar_width | 0.15 | 0.15 | The width of the table bar within the overview report |
| per_feature_width | 13 | 13 | The width in inches that the overview table can be. |
Expand Down
1 change: 1 addition & 0 deletions docs/admin/compatibility_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ While that last supported version will not be strictly enforced via the `max_ver
| 1.2.X | 1.4.0 | 1.5.2 [Official] |
| 1.3.X | 1.4.0 | 1.5.2 [Official] |
| 1.4.X | 1.5.3 | 1.5.99 [Official] |
| 1.5.X | 1.6.1 | 1.6.99 [Official] |
17 changes: 17 additions & 0 deletions docs/admin/release_notes/version_1.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

- Change min version of Nautobot from 1.4.0 to 1.5.3 which is required for the use of NautobotUIViewset, Notes mixins etc.

## v1.4.2 - 2023-08

### Changed

- [519](https://github.com/nautobot/nautobot-plugin-golden-config/pull/519) - docs-only: large fixes and template troubleshooting section.

### Fixed

- [492](https://github.com/nautobot/nautobot-plugin-golden-config/pull/492) - Fix count of in scope devices on settings detail view.
- [498](https://github.com/nautobot/nautobot-plugin-golden-config/pull/498) - Fix deepdiff dependency.
- [501](https://github.com/nautobot/nautobot-plugin-golden-config/pull/501) - Update docs for adding CustomField data with datasources.
- [503](https://github.com/nautobot/nautobot-plugin-golden-config/pull/503) - Switch from deprecated FilterSet to new FilterSetMixin.
- [504](https://github.com/nautobot/nautobot-plugin-golden-config/pull/504) - Fix extend queryfilter to export.
- [511](https://github.com/nautobot/nautobot-plugin-golden-config/pull/511) - Fix `log_failure` function missing argument.
- [523](https://github.com/nautobot/nautobot-plugin-golden-config/pull/523) - Fix docs site by pinning dev dependencies.
- [530](https://github.com/nautobot/nautobot-plugin-golden-config/pull/530) - Fix, removing ConfigCompliance model import from 0005 migration.

## v1.4.1 - 2023-05

### Fixed
Expand Down
23 changes: 23 additions & 0 deletions docs/admin/release_notes/version_1.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# v1.5 Release Notes

- Add ability to update JSON based compliance via a job and have git integrations.
- Made custom compliance a boolean to support both JSON or CLI custom compliance types.
- Add metrics for Golden Config plugin.
- Supports Nautobot >=1.6.1,<2.0.0.

## v1.5.0 - 2023-08

### Added

- [455](https://github.com/nautobot/nautobot-plugin-golden-config/pull/455) - Add metrics for Golden Config plugin.
- [485](https://github.com/nautobot/nautobot-plugin-golden-config/pull/485) - Custom compliance for CLI and JSON rules.
- [487](https://github.com/nautobot/nautobot-plugin-golden-config/pull/487) - Implement native JSON support.

### Changed

- [485](https://github.com/nautobot/nautobot-plugin-golden-config/pull/485) - Changed the behavior of custom compliance to a boolean vs toggle between cli, json, and custom.

### Fixed

- [505](https://github.com/nautobot/nautobot-plugin-golden-config/pull/505) - fixes imports and choice definitions in the compliance nornir play.
- [513](https://github.com/nautobot/nautobot-plugin-golden-config/pull/513) - Fixed issue with native JSON support with `get_config_element` function.
8 changes: 4 additions & 4 deletions docs/dev/dev_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Each command can be executed with `invoke <command>`. All commands support the a

#### Local Development Environment

```
```shell
build Build all docker images.
debug Start Nautobot and its dependencies in debug mode.
destroy Destroy all containers and volumes.
Expand All @@ -117,7 +117,7 @@ Each command can be executed with `invoke <command>`. All commands support the a

#### Utility

```
```shell
cli Launch a bash shell inside the running Nautobot container.
create-user Create a new user in django (default: admin), will prompt for password.
makemigrations Run Make Migration in Django.
Expand All @@ -126,7 +126,7 @@ Each command can be executed with `invoke <command>`. All commands support the a

#### Testing

```
```shell
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.
Expand Down Expand Up @@ -155,7 +155,7 @@ Poetry is used in lieu of the "virtualenv" commands and is leveraged in both env
The `pyproject.toml` file outlines all of the relevant dependencies for the project:

- `tool.poetry.dependencies` - the main list of dependencies.
- `tool.poetry.dev-dependencies` - development dependencies, to facilitate linting, testing, and documentation building.
- `tool.poetry.group.dev.dependencies` - development dependencies, to facilitate linting, testing, and documentation building.

The `poetry shell` command is used to create and enable a virtual environment managed by Poetry, so all commands ran going forward are executed within the virtual environment. This is similar to running the `source venv/bin/activate` command with virtualenvs. To install project dependencies in the virtual environment, you should run `poetry install` - this will install **both** project and development dependencies.

Expand Down
7 changes: 3 additions & 4 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
griffe==0.30.1
mkdocs==1.3.1
mkdocs-material==8.4.2
mkdocs==1.5.2
mkdocs-material==9.2.4
mkdocs-version-annotations==1.0.0
mkdocstrings==0.22.0
mkdocstrings-python==1.1.2
mkdocstrings-python==1.5.2
8 changes: 8 additions & 0 deletions docs/user/app_feature_compliancecli.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ configuration. The compliance engine has several features to better build work t
3. The ability to dynamically understand parent/child relationships within the configurations.

In regards to `1`, consider the following example of how to obtain service configurations:

```
service
no service
```

Specific configurations that start with either of these commands can be grouped together.

In regards to `2`, consider the configurations of SNMP on a nexus switch.

```
snmp-server community secure group network-admin
snmp-server community networktocode group network-operator
Expand All @@ -34,14 +37,17 @@ snmp-server community secure group network-admin
```

In regards to `3`, consider the following example of BGP configuration.

```
router bgp
prefix-list
```

All configurations that are a parent and child relationships would be considered within the parsing engine. Additionally, if one configuration line was
wrong, only that line and the parents would be shown, not all lines or only the missing configuration without context of the parents, e.g. Given:

Actual

```
router bgp 65250
router-id 10.0.10.5
Expand All @@ -54,6 +60,7 @@ router bgp 65250
```

Intended

```
router bgp 65250
router-id 10.0.10.6
Expand All @@ -64,6 +71,7 @@ router bgp 65250
remote-as 65250
address-family ipv4 unicast
```

Would result in the identifying the missing configurations as:

```
Expand Down
4 changes: 2 additions & 2 deletions docs/user/app_getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Compliance requires Backups and Intended Configurations in order to be executed.

Golden Config properties include: Compliance Features, Compliance Rules, Config Removals, and Config Replacements. They can be created via the UI, API, or alternatively you can load these properties from a Git repository, defined in YAML files following the this directory structure (you can skip any of them if not apply):

```
```shell
├── golden_config
│ ├── compliance_features
│ ├── compliance_rules
Expand All @@ -136,7 +136,7 @@ Golden Config properties include: Compliance Features, Compliance Rules, Config

The files within these folders can follow any naming pattern or nested folder structure, all of them will be recursively taken into account. So it's up to you to decide how to you prefer to organize these files (within the previously stated directory structure):

```
```shell
├── golden_config
│ ├── compliance_features
│ │ └── all.yml
Expand Down
2 changes: 1 addition & 1 deletion docs/user/troubleshooting/troubleshoot_dispatchers.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Some steps to consider to troubleshooting this:

As an example if you wanted to use NAPALMs Palo Alto plugin you'd need that library installed in the environment.

```
```shell
pip install napalm-panos
```

Expand Down
2 changes: 1 addition & 1 deletion invoke.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ nautobot_golden_config:
project_name: "nautobot-golden-config"
nautobot_ver: "latest"
local: false
python_ver: "3.8"
python_ver: "3.11"
compose_dir: "development"
compose_files:
- "docker-compose.base.yml"
Expand Down
2 changes: 1 addition & 1 deletion invoke.mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ nautobot_golden_config:
project_name: "nautobot-golden-config"
nautobot_ver: "latest"
local: false
python_ver: "3.8"
python_ver: "3.11"
compose_dir: "development"
compose_files:
- "docker-compose.base.yml"
Expand Down
4 changes: 3 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ site_dir: "golden-config/static/golden-config/docs"
site_name: "Golden Configuration Documentation"
site_url: "https://docs.nautobot.com/projects/golden-config/en/latest/"
repo_url: "https://github.com/nautobot/nautobot-plugin-golden-config"
copyright: "Copyright &copy; 2022 The Authors"
copyright: "Copyright &copy; 2023 The Authors"
theme:
name: "material"
navigation_depth: 4
Expand All @@ -14,6 +14,7 @@ theme:
- "django"
- "yaml"
features:
- "content.code.copy"
- "navigation.tracking"
- "navigation.tabs"
- "navigation.tabs.sticky"
Expand Down Expand Up @@ -118,6 +119,7 @@ nav:
- Compatibility Matrix: "admin/compatibility_matrix.md"
- Release Notes:
- "admin/release_notes/index.md"
- v1.5: "admin/release_notes/version_1.5.md"
- v1.4: "admin/release_notes/version_1.4.md"
- v1.3: "admin/release_notes/version_1.3.md"
- v1.2: "admin/release_notes/version_1.2.md"
Expand Down
11 changes: 3 additions & 8 deletions nautobot_golden_config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"""Plugin declaration for nautobot_golden_config."""
# Metadata is inherited from Nautobot. If not including Nautobot in the environment, this should be added
try:
from importlib import metadata
except ImportError:
# Python version < 3.8
import importlib_metadata as metadata
from importlib import metadata


__version__ = metadata.version(__name__)

Expand All @@ -23,7 +20,7 @@ class GoldenConfig(PluginConfig):
author_email = "opensource@networktocode.com"
description = "Nautobot Apps that embraces NetDevOps and automates configuration backups, performs configuration compliance, and generates intended configurations. Includes native Git integration and gives users the flexibility to mix and match the supported features."
base_url = "golden-config"
min_version = "1.5.14"
min_version = "1.6.1"
max_version = "1.99"
default_settings = {
"enable_backup": True,
Expand All @@ -37,12 +34,10 @@ class GoldenConfig(PluginConfig):
"per_feature_width": 13,
"per_feature_height": 4,
"get_custom_compliance": None,
"enable_config_context_sync": False,
}

def ready(self):
"""Register custom signals."""
import nautobot_golden_config.jobs # pylint: disable=unused-import, import-outside-toplevel
from nautobot_golden_config.models import ConfigCompliance # pylint: disable=import-outside-toplevel

# pylint: disable=import-outside-toplevel
Expand Down
13 changes: 0 additions & 13 deletions nautobot_golden_config/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from nautobot_golden_config.utilities.constant import (
ENABLE_BACKUP,
ENABLE_COMPLIANCE,
ENABLE_CONFIG_CONTEXT_SYNC,
ENABLE_INTENDED,
)
from nautobot_golden_config.utilities.git import GitRepo
Expand Down Expand Up @@ -63,14 +62,6 @@ def get_refreshed_repos(job_obj, repo_type, data=None):
return repositories


def update_config_context_repos(job_obj):
"""Simple helper method to update all configured Config Context git repositories."""
repos = GitRepository.objects.filter(provided_contents__icontains="extras.configcontext")
for repo in repos:
job_obj.log_debug(f"Pulling config context repo {repo.name}.")
ensure_git_repository(repository_record=repo, job_result=job_obj.job_result)


def commit_check(method):
"""Decorator to check if a "dry-run" attempt was made."""

Expand Down Expand Up @@ -179,10 +170,6 @@ def run(self, data, commit):

now = datetime.now()

if ENABLE_CONFIG_CONTEXT_SYNC:
self.log_debug("Pull Config Context repos.")
update_config_context_repos(job_obj=self)

self.log_debug("Pull Jinja template repos.")
get_refreshed_repos(job_obj=self, repo_type="jinja_repository", data=data)

Expand Down
3 changes: 2 additions & 1 deletion nautobot_golden_config/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class TestDocsPackaging(unittest.TestCase):
def test_version(self):
"""Verify that pyproject.toml dev dependencies have the same versions as in the docs requirements.txt."""
parent_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
poetry_details = toml.load(os.path.join(parent_path, "pyproject.toml"))["tool"]["poetry"]["dev-dependencies"]
poetry_path = os.path.join(parent_path, "pyproject.toml")
poetry_details = toml.load(poetry_path)["tool"]["poetry"]["group"]["dev"]["dependencies"]
with open(f"{parent_path}/docs/requirements.txt", "r", encoding="utf-8") as file:
requirements = [line for line in file.read().splitlines() if (len(line) > 0 and not line.startswith("#"))]
for pkg in requirements:
Expand Down
Loading
Loading