Skip to content

Commit

Permalink
Merge pull request #522 from nautobot/release-v3.0.1
Browse files Browse the repository at this point in the history
Release 3.0.1
  • Loading branch information
jdrew82 authored Aug 26, 2024
2 parents 0dcc02d + cb3e8d7 commit 6effda8
Show file tree
Hide file tree
Showing 150 changed files with 649 additions and 798 deletions.
6 changes: 0 additions & 6 deletions .bandit.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
"_drift_manager": {
"template": "https://github.com/nautobot/cookiecutter-nautobot-app.git",
"template_dir": "nautobot-app",
"template_ref": "refs/tags/nautobot-app-v2.2.1",
"template_ref": "refs/tags/nautobot-app-v2.3.0",
"cookie_dir": "",
"branch_prefix": "drift-manager",
"pull_request_strategy": "create",
"post_actions": [
"black"
],
"draft": true,
"baked_commit_ref": "88cb0d71afd4889658b76c64cfb86d5b347e7565"
"baked_commit_ref": "edf831ea98364f9a475ef147f13c1fb2f17b825f"
}
}
}
Expand Down
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ FAQ.md
.git/
.gitignore
.github
tasks.py
LICENSE
**/*.log
**/.vscode/
Expand Down
36 changes: 6 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:
APP_NAME: "nautobot-app-ssot"

jobs:
black:
ruff-format:
runs-on: "ubuntu-22.04"
env:
INVOKE_NAUTOBOT_SSOT_LOCAL: "True"
Expand All @@ -25,20 +25,9 @@ jobs:
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
- name: "Linting: black"
run: "poetry run invoke black"
bandit:
runs-on: "ubuntu-22.04"
env:
INVOKE_NAUTOBOT_SSOT_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
- name: "Linting: bandit"
run: "poetry run invoke bandit"
ruff:
- name: "Linting: ruff format"
run: "poetry run invoke ruff --action format"
ruff-lint:
runs-on: "ubuntu-22.04"
env:
INVOKE_NAUTOBOT_SSOT_LOCAL: "True"
Expand All @@ -60,17 +49,6 @@ jobs:
uses: "networktocode/gh-action-setup-poetry-environment@v6"
- name: "Check Docs Build"
run: "poetry run invoke build-and-check-docs"
flake8:
runs-on: "ubuntu-22.04"
env:
INVOKE_NAUTOBOT_SSOT_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
- name: "Linting: flake8"
run: "poetry run invoke flake8"
poetry:
runs-on: "ubuntu-22.04"
env:
Expand All @@ -95,12 +73,10 @@ jobs:
run: "poetry run invoke yamllint"
check-in-docker:
needs:
- "bandit"
- "ruff"
- "flake8"
- "ruff-format"
- "ruff-lint"
- "poetry"
- "yamllint"
- "black"
runs-on: "ubuntu-22.04"
strategy:
fail-fast: true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<a href="https://pypi.org/project/nautobot-ssot/"><img src="https://img.shields.io/pypi/v/nautobot-ssot"></a>
<a href="https://pypi.org/project/nautobot-ssot/"><img src="https://img.shields.io/pypi/dm/nautobot-ssot"></a>
<br>
An <a href="https://www.networktocode.com/nautobot/apps/">App</a> for <a href="https://nautobot.com/">Nautobot</a>.
An <a href="https://networktocode.com/nautobot-apps/">App</a> for <a href="https://nautobot.com/">Nautobot</a>.
</p>


Expand Down
1 change: 1 addition & 0 deletions changes/562.housekeeping
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cut release 3.0.1.
7 changes: 4 additions & 3 deletions development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Debug
#

DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", False))
DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", "false"))
_TESTING = len(sys.argv) > 1 and sys.argv[1] == "test"

if DEBUG and not _TESTING:
Expand Down Expand Up @@ -48,9 +48,10 @@
"PASSWORD": os.getenv("NAUTOBOT_DB_PASSWORD", ""), # Database password
"HOST": os.getenv("NAUTOBOT_DB_HOST", "localhost"), # Database server
"PORT": os.getenv(
"NAUTOBOT_DB_PORT", default_db_settings[nautobot_db_engine]["NAUTOBOT_DB_PORT"]
"NAUTOBOT_DB_PORT",
default_db_settings[nautobot_db_engine]["NAUTOBOT_DB_PORT"],
), # Database port, default to postgres
"CONN_MAX_AGE": int(os.getenv("NAUTOBOT_DB_TIMEOUT", 300)), # Database timeout
"CONN_MAX_AGE": int(os.getenv("NAUTOBOT_DB_TIMEOUT", "300")), # Database timeout
"ENGINE": nautobot_db_engine,
}
}
Expand Down
9 changes: 2 additions & 7 deletions development/run_example_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@

from django.core.management import call_command
from nautobot.core.settings_funcs import is_truthy
from nautobot.extras.choices import SecretsGroupAccessTypeChoices
from nautobot.extras.choices import SecretsGroupSecretTypeChoices
from nautobot.extras.models import ExternalIntegration
from nautobot.extras.models import Job
from nautobot.extras.models import Secret
from nautobot.extras.models import SecretsGroup
from nautobot.extras.models import SecretsGroupAssociation
from nautobot.extras.choices import SecretsGroupAccessTypeChoices, SecretsGroupSecretTypeChoices
from nautobot.extras.models import ExternalIntegration, Job, Secret, SecretsGroup, SecretsGroupAssociation

_TOKEN = 40 * "a"
os.environ["NAUTOBOT_DEMO_TOKEN"] = _TOKEN
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 @@ -26,3 +26,4 @@ While that last supported version will not be strictly enforced--via the max_ver
| 2.7.0 | 2.1.0 | 2.99.09 |
| 2.8.0 | 2.1.0 | 2.99.09 |
| 3.0.0 | 2.1.0 | 2.99.09 |
| 3.0.1 | 2.1.0 | 2.99.09 |
18 changes: 18 additions & 0 deletions docs/admin/release_notes/version_3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,21 @@ Updating DiffSync required changes to imports and many files changed `from diffs
### Housekeeping

- [#433](https://github.com/nautobot/nautobot-app-ssot/issues/433) - Black 24.4.0 includes new formatting which was applied to all python files.

## [v3.0.1 (2024-08-23)](https://github.com/nautobot/nautobot-app-ssot/releases/tag/v3.0.1)

### Fixed

- [#507](https://github.com/nautobot/nautobot-app-ssot/issues/507) - Fixed DataTarget example Job to include run() function for using ExternalIntegration or supplied URL and token.

### Dependencies

- [#516](https://github.com/nautobot/nautobot-app-ssot/issues/516) - Fix the dependencies for mkdocstrings and mkdocstrings-python to fix RTD build.

### Documentation

- [#518](https://github.com/nautobot/nautobot-app-ssot/issues/518) - Minor doc updates on upgrade to 3.0.

### Housekeeping

- [#515](https://github.com/nautobot/nautobot-app-ssot/issues/515) - Rebaked from the cookie `nautobot-app-v2.3.0`.
2 changes: 1 addition & 1 deletion docs/assets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ a.autorefs-external:hover::after {
}


/* Customization for mkdocs-version-annotations */
/* Customization for markdown-version-annotations */
:root {
/* Icon for "version-added" admonition: Material Design Icons "plus-box-outline" */
--md-admonition-icon--version-added: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 19V5H5v14h14m0-16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14m-8 4h2v4h4v2h-4v4h-2v-4H7v-2h4V7Z"/></svg>');
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 `ruff`.
- Python linting and formatting: `pylint` and `ruff`.
- YAML linting is done with `yamllint`.
- Django unit test to ensure the app is working properly.

Expand Down
10 changes: 2 additions & 8 deletions docs/dev/dev_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ Each command can be executed with `invoke <command>`. All commands support the a
#### Testing

```
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.
ruff Run ruff to validate docstring formatting adheres to NTC defined standards.
ruff Run ruff to perform code formatting and/or linting.
pylint Run pylint code analysis.
tests Run all tests for this app.
unittest Run Django unit tests for the app.
Expand Down Expand Up @@ -454,7 +451,7 @@ This is the same as running:

### Tests

To run tests against your code, you can run all of the tests that TravisCI runs against any new PR with:
To run tests against your code, you can run all of the tests that the CI runs against any new PR with:

```bash
➜ invoke tests
Expand All @@ -464,9 +461,6 @@ To run an individual test, you can run any or all of the following:

```bash
➜ invoke unittest
➜ invoke bandit
➜ invoke black
➜ invoke flake8
➜ invoke ruff
➜ invoke pylint
```
Expand Down
16 changes: 9 additions & 7 deletions docs/dev/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class NautobotAdapter(Adapter)

## Set defaults for Optional

One of the changes with pydantic v2 is that any variables that are Optional must have a default of None defined. This needs to be done on your class attributes like below:
One of the changes with Pydantic v2 is that any variables that are Optional must have a default of None defined. This needs to be done on your class attributes like below:

```python
class DeviceModel(NautobotModel):
Expand All @@ -46,11 +46,11 @@ class DeviceModel(NautobotModel):
name: str
location__name: str
location__location_type__name: str
location__parent__name: Optional[str]
location__parent__location_type__name: Optional[str]
location__parent__name: Optional[str] # Pydantic v1, replace
location__parent__location_type__name: Optional[str] # Pydantic v1, replace
device_type__manufacturer__name: str
device_type__model: str
platform__name: Optional[str]
platform__name: Optional[str] # Pydantic v1, replace
role__name: str
serial: str
status__name: str
Expand Down Expand Up @@ -78,11 +78,11 @@ class DeviceModel(NautobotModel):
name: str
location__name: str
location__location_type__name: str
location__parent__name: Optional[str] = None
location__parent__location_type__name: Optional[str] = None
location__parent__name: Optional[str] = None # Pydantic v2 compatibile
location__parent__location_type__name: Optional[str] = None # Pydantic v2 compatibile
device_type__manufacturer__name: str
device_type__model: str
platform__name: Optional[str] = None
platform__name: Optional[str] = None # Pydantic v2 compatibile
role__name: str
serial: str
status__name: str
Expand All @@ -96,6 +96,8 @@ Any instances where you're referring to the diffsync kwarg needs to be updated t
self.diffsync.job.logger.warning("Example")
```

is changed to the following:

```python
self.adapter.job.logger.warning("Example")
```
11 changes: 6 additions & 5 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mkdocs==1.5.2
mkdocs-material==9.1.15
mkdocs-version-annotations==1.0.0
mkdocstrings-python==*
mkdocstrings==*
mkdocs==1.6.0
mkdocs-material==9.5.32
markdown-version-annotations==1.0.1
griffe==1.1.1
mkdocstrings-python==1.10.8
mkdocstrings==0.25.2
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ extra:
link: "https://twitter.com/networktocode"
name: "Network to Code Twitter"
markdown_extensions:
- "markdown_version_annotations":
admonition_tag: "???"
- "admonition"
- "toc":
permalink: true
Expand All @@ -88,7 +90,6 @@ markdown_extensions:
- "footnotes"
plugins:
- "search"
- "mkdocs-version-annotations"
- "mkdocstrings":
default_handler: "python"
handlers:
Expand Down
2 changes: 1 addition & 1 deletion nautobot_ssot/contrib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from nautobot_ssot.contrib.adapter import NautobotAdapter
from nautobot_ssot.contrib.model import NautobotModel
from nautobot_ssot.contrib.types import (
RelationshipSideEnum,
CustomFieldAnnotation,
CustomRelationshipAnnotation,
RelationshipSideEnum,
)

__all__ = (
Expand Down
6 changes: 3 additions & 3 deletions nautobot_ssot/contrib/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
# Diffsync relies on underscore-prefixed attributes quite heavily, which is why we disable this here.

from collections import defaultdict

from typing import FrozenSet, Tuple, Hashable, DefaultDict, Dict, Type, get_args
from typing import DefaultDict, Dict, FrozenSet, Hashable, Tuple, Type, get_args

import pydantic
from diffsync import Adapter
from diffsync.exceptions import ObjectCrudException
from django.contrib.contenttypes.models import ContentType
from django.db.models import Model
from nautobot.extras.models import Relationship, RelationshipAssociation
from nautobot.extras.choices import RelationshipTypeChoices
from nautobot.extras.models import Relationship, RelationshipAssociation
from typing_extensions import get_type_hints

from nautobot_ssot.contrib.types import (
CustomFieldAnnotation,
CustomRelationshipAnnotation,
Expand Down
21 changes: 9 additions & 12 deletions nautobot_ssot/contrib/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@
# Diffsync relies on underscore-prefixed attributes quite heavily, which is why we disable this here.

from collections import defaultdict
from uuid import UUID

from typing import ClassVar, Optional
from uuid import UUID

from diffsync import DiffSyncModel
from diffsync.exceptions import ObjectCrudException, ObjectNotUpdated, ObjectNotDeleted, ObjectNotCreated
from diffsync.exceptions import ObjectCrudException, ObjectNotCreated, ObjectNotDeleted, ObjectNotUpdated
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError, MultipleObjectsReturned
from django.core.exceptions import MultipleObjectsReturned, ValidationError
from django.db.models import Model, ProtectedError
from nautobot.extras.models import Relationship, RelationshipAssociation
from nautobot.extras.choices import RelationshipTypeChoices

from nautobot.extras.models import Relationship, RelationshipAssociation
from typing_extensions import get_type_hints

from nautobot_ssot.contrib.types import (
CustomFieldAnnotation,
CustomRelationshipAnnotation,
Expand Down Expand Up @@ -110,9 +109,7 @@ def create(cls, adapter, ids, attrs):
return super().create(adapter, ids, attrs)

@classmethod
def _handle_single_field(
cls, field, obj, value, relationship_fields, adapter
): # pylint: disable=too-many-arguments,too-many-locals, too-many-branches
def _handle_single_field(cls, field, obj, value, relationship_fields, adapter): # pylint: disable=too-many-arguments,too-many-locals, too-many-branches
"""Set a single field on a Django object to a given value, or, for relationship fields, prepare setting.
:param field: The name of the field to set.
Expand Down Expand Up @@ -152,9 +149,9 @@ def _handle_single_field(
# Custom relationship foreign keys
if custom_relationship_annotation:
relationship_fields["custom_relationship_foreign_keys"][related_model][lookup] = value
relationship_fields["custom_relationship_foreign_keys"][related_model][
"_annotation"
] = custom_relationship_annotation
relationship_fields["custom_relationship_foreign_keys"][related_model]["_annotation"] = (
custom_relationship_annotation
)
# Normal foreign keys
else:
django_field = cls._model._meta.get_field(related_model)
Expand Down
1 change: 0 additions & 1 deletion nautobot_ssot/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import django_filters
from django.db.models import Q

from nautobot.apps.filters import BaseFilterSet

from .models import Sync, SyncLogEntry
Expand Down
Loading

0 comments on commit 6effda8

Please sign in to comment.