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

Cookie updated by NetworkToCode Cookie Drift Manager Tool #644

Merged
merged 5 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 2 additions & 2 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"_drift_manager": {
"template": "https://github.com/nautobot/cookiecutter-nautobot-app.git",
"template_dir": "nautobot-app",
"template_ref": "refs/tags/nautobot-app-v2.4.0",
"template_ref": "refs/tags/nautobot-app-v2.4.1",
"cookie_dir": "",
"branch_prefix": "drift-manager",
"pull_request_strategy": "create",
Expand All @@ -30,7 +30,7 @@
"poetry"
],
"draft": false,
"baked_commit_ref": "671ef8a64a7bc40e991ade1dd64560d734f122bc"
"baked_commit_ref": "1c99457b09d05553ef7193e0dda021b2d1caa407"
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.4"
poetry-version: "1.8.5"
- name: "Linting: ruff format"
run: "poetry run invoke ruff --action format"
ruff-lint:
Expand All @@ -39,7 +39,7 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.4"
poetry-version: "1.8.5"
- name: "Linting: ruff"
run: "poetry run invoke ruff --action lint"
check-docs-build:
Expand All @@ -52,7 +52,7 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.4"
poetry-version: "1.8.5"
- name: "Check Docs Build"
run: "poetry run invoke build-and-check-docs"
poetry:
Expand All @@ -65,7 +65,7 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.4"
poetry-version: "1.8.5"
- name: "Checking: poetry lock file"
run: "poetry run invoke lock --check"
yamllint:
Expand All @@ -78,7 +78,7 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.4"
poetry-version: "1.8.5"
- name: "Linting: yamllint"
run: "poetry run invoke yamllint"
check-in-docker:
Expand All @@ -102,7 +102,7 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.4"
poetry-version: "1.8.5"
- name: "Constrain Nautobot version and regenerate lock file"
env:
INVOKE_NAUTOBOT_SSOT_LOCAL: "true"
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.4"
poetry-version: "1.8.5"
- name: "Constrain Nautobot version and regenerate lock file"
env:
INVOKE_NAUTOBOT_SSOT_LOCAL: "true"
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.4"
poetry-version: "1.8.5"
- name: "Check for changelog entry"
run: |
git fetch --no-tags origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Apache Software License 2.0

Copyright (c) 2024, Network to Code, LLC
Copyright (c) 2025, Network to Code, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
1 change: 1 addition & 0 deletions changes/+nautobot-app-v2.4.1.housekeeping
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rebaked from the cookie `nautobot-app-v2.4.1`.
6 changes: 4 additions & 2 deletions development/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ services:
volumes:
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
- "../:/source"
# To expose postgres or redis to the host uncomment the following
# postgres:
# To expose postgres (5432), myql (3306) on db service or redis (6379) to the host uncomment the
# following. Ensure to match the 2 idented spaces which to have the service nested under services.
# db:
# ports:
# - "5432:5432"
# - "3306:3306"
# redis:
# ports:
# - "6379:6379"
7 changes: 7 additions & 0 deletions development/docker-compose.mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ services:
- "development.env"
- "creds.env"
- "development_mysql.env"
beat:
environment:
- "NAUTOBOT_DB_ENGINE=django.db.backends.mysql"
env_file:
- "development.env"
- "creds.env"
- "development_mysql.env"
db:
image: "mysql:8"
command:
Expand Down
14 changes: 3 additions & 11 deletions development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys

from nautobot.core.settings import * # noqa: F403 # pylint: disable=wildcard-import,unused-wildcard-import
from nautobot.core.settings_funcs import is_truthy, parse_redis_connection
from nautobot.core.settings_funcs import is_truthy

#
# Debug
Expand Down Expand Up @@ -65,16 +65,8 @@
#

# The django-redis cache is used to establish concurrent locks using Redis.
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": parse_redis_connection(redis_database=0),
"TIMEOUT": 300,
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
},
}
}
# Inherited from nautobot.core.settings
# CACHES = {....}

#
# Celery settings are not defined here because they can be overloaded with
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ nav:
- Debugging Jobs: "dev/debugging.md"
- Contributing to the App: "dev/contributing.md"
- Development Environment: "dev/dev_environment.md"
- Upgrading SSoT Apps: "dev/upgrade.md"
- Release Checklist: "dev/release_checklist.md"
- Code Reference:
- "dev/code_reference/index.md"
- Package: "dev/code_reference/package.md"
Expand Down
9 changes: 7 additions & 2 deletions nautobot_ssot/api/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
"""Django urlpatterns declaration for nautobot_ssot API."""
"""Django API urlpatterns declaration for nautobot_ssot app."""

from nautobot.apps.api import OrderedDefaultRouter

from nautobot_ssot.integrations.utils import each_enabled_integration_module

app_name = "ssot" # pylint: disable=invalid-name
smk4664 marked this conversation as resolved.
Show resolved Hide resolved
urlpatterns = []
router = OrderedDefaultRouter()
# add the name of your api endpoint, usually hyphenated model name in plural, e.g. "my-model-classes"


def _add_integrations():
Expand All @@ -12,3 +15,5 @@ def _add_integrations():


_add_integrations()

urlpatterns += router.urls
2 changes: 1 addition & 1 deletion nautobot_ssot/contrib/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_queryset(cls):
@classmethod
def _check_field(cls, name):
"""Check whether the given field name is defined on the diffsync (pydantic) model."""
if name not in cls.model_fields:
if name not in cls.model_fields: # pylint: disable=unsupported-membership-test
raise ObjectCrudException(f"Field {name} is not defined on the model.")

def get_from_db(self):
Expand Down
42 changes: 19 additions & 23 deletions nautobot_ssot/filters.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
"""Filtering logic for Sync and SyncLogEntry records."""
smk4664 marked this conversation as resolved.
Show resolved Hide resolved

import django_filters
from django.db.models import Q
from nautobot.apps.filters import BaseFilterSet
from nautobot.apps.filters import BaseFilterSet, SearchFilter

from .models import Sync, SyncLogEntry
from nautobot_ssot import models


class SyncFilterSet(BaseFilterSet):
"""Filter capabilities for SyncOverview instances."""
class SyncFilterSet(BaseFilterSet): # pylint: disable=too-many-ancestors
"""Filter for Sync."""

class Meta:
"""Metaclass attributes of SyncFilter."""
"""Meta attributes for filter."""

model = Sync
fields = ["dry_run", "job_result"]
model = models.Sync

# add any fields from the model that you would like to filter your searches by using those
fields = ["dry_run", "job_result"] # pylint: disable=nb-use-fields-all

class SyncLogEntryFilterSet(BaseFilterSet):

class SyncLogEntryFilterSet(BaseFilterSet): # pylint: disable=too-many-ancestors
"""Filter capabilities for SyncLogEntry instances."""

q = django_filters.CharFilter(method="search", label="Search")
q = SearchFilter(
filter_predicates={
"diff": "icontains",
"message": "icontains",
"object_repr": "icontains",
}
)

class Meta:
"""Metaclass attributes of SyncLogEntryFilter."""

model = SyncLogEntry
fields = ["sync", "action", "status", "synced_object_type"]

def search(self, queryset, _name, value):
smk4664 marked this conversation as resolved.
Show resolved Hide resolved
"""String search of SyncLogEntry records."""
if not value.strip():
return queryset
return queryset.filter(
Q(diff__icontains=value) # pylint: disable=unsupported-binary-operation
| Q(message__icontains=value)
| Q(object_repr__icontains=value)
)
model = models.SyncLogEntry
fields = ["sync", "action", "status", "synced_object_type"] # pylint: disable=nb-use-fields-all
4 changes: 2 additions & 2 deletions nautobot_ssot/forms.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Forms for working with Sync and SyncLogEntry models."""

from django import forms
from nautobot.apps.forms import add_blank_choice
from nautobot.core.forms import BOOLEAN_WITH_BLANK_CHOICES, BootstrapMixin
from nautobot.apps.forms import BootstrapMixin, add_blank_choice
from nautobot.core.forms import BOOLEAN_WITH_BLANK_CHOICES

from .choices import SyncLogEntryActionChoices, SyncLogEntryStatusChoices
from .models import Sync, SyncLogEntry
Expand Down
Loading