Skip to content

Commit

Permalink
Cookie updated by NetworkToCode Cookie Drift Manager Tool (#329)
Browse files Browse the repository at this point in the history
* Cookie updated by NetworkToCode Cookie Drift Manager Tool

Template:

```
{
    "template": "https://github.com/nautobot/cookiecutter-nautobot-app.git",
    "dir": "nautobot-app",
    "ref": "refs/tags/nautobot-app-v2.4.1",
    "path": null
}
```

Cookie:

```
{
    "remote": "https://github.com/nautobot/nautobot-app-circuit-maintenance.git",
    "path": "/tmp/tmphmksrds_/nautobot-app-circuit-maintenance",
    "repository_path": "/tmp/tmphmksrds_/nautobot-app-circuit-maintenance",
    "dir": "",
    "branch_prefix": "drift-manager",
    "context": {
        "codeowner_github_usernames": "@chadell @glennmatthews @pke11y @scetron",
        "full_name": "Network to Code, LLC",
        "email": "[email protected]",
        "github_org": "nautobot",
        "app_name": "nautobot_circuit_maintenance",
        "verbose_name": "Circuit Maintenance",
        "app_slug": "nautobot-circuit-maintenance",
        "project_slug": "nautobot-app-circuit-maintenance",
        "repo_url": "https://github.com/nautobot/nautobot-app-circuit-maintenance",
        "base_url": "circuit-maintenance",
        "min_nautobot_version": "2.0.0",
        "max_nautobot_version": "2.9999",
        "camel_name": "NautobotCircuitMaintenance",
        "project_short_description": "Nautobot App that automatically manages network circuit maintenance notifications. Dynamically reads email inboxes (or APIs) and updates Nautobot mapping circuit maintenances to devices",
        "model_class_name": "CircuitMaintenance",
        "open_source_license": "Apache-2.0",
        "docs_base_url": "https://docs.nautobot.com",
        "docs_app_url": "https://docs.nautobot.com/projects/circuit-maintenance/en/latest",
        "_template": "https://github.com/nautobot/cookiecutter-nautobot-app.git",
        "_output_dir": "/tmp/tmphmksrds_",
        "_repo_dir": "/github/home/.cookiecutters/cookiecutter-nautobot-app/nautobot-app",
        "_checkout": "refs/tags/nautobot-app-v2.4.1"
    },
    "base_branch": "develop",
    "remote_name": "origin",
    "pull_request_strategy": "PullRequestStrategy.CREATE",
    "post_actions": [
        "PostAction.RUFF",
        "PostAction.POETRY"
    ],
    "baked_commit_ref": "f2ef7194f608b73ab88cb19070bbbd68a586e776",
    "draft": false
}
```

CLI Arguments:

```
{
    "cookie_dir": "",
    "input": false,
    "json_filename": "",
    "output_dir": "",
    "push": true,
    "template": "",
    "template_dir": "",
    "template_ref": "refs/tags/nautobot-app-v2.4.1",
    "pull_request": null,
    "post_action": [
        "ruff",
        "poetry"
    ],
    "disable_post_actions": true,
    "draft": false
}
```

* Address issues from Drift Manager.

Also implements SearchFilter instead of using the custom search function.

---------

Co-authored-by: bakebot <[email protected]>
Co-authored-by: Stephen Kiely <[email protected]>
  • Loading branch information
3 people authored Jan 23, 2025
1 parent fbdba32 commit d9dd4fb
Show file tree
Hide file tree
Showing 16 changed files with 968 additions and 928 deletions.
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": "f2ef7194f608b73ab88cb19070bbbd68a586e776"
"baked_commit_ref": "401d67cec93d15ebddcab0bc3456b2921bcc32a6"
}
}
}
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
- name: "Linting: ruff format"
run: "poetry run invoke ruff --action format"
ruff-lint:
Expand All @@ -36,6 +38,8 @@ jobs:
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
- name: "Linting: ruff"
run: "poetry run invoke ruff --action lint"
check-docs-build:
Expand All @@ -47,6 +51,8 @@ jobs:
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
- name: "Check Docs Build"
run: "poetry run invoke build-and-check-docs"
poetry:
Expand All @@ -58,6 +64,8 @@ jobs:
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
- name: "Checking: poetry lock file"
run: "poetry run invoke lock --check"
yamllint:
Expand All @@ -69,6 +77,8 @@ jobs:
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
- name: "Linting: yamllint"
run: "poetry run invoke yamllint"
check-in-docker:
Expand All @@ -91,6 +101,8 @@ jobs:
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
- name: "Constrain Nautobot version and regenerate lock file"
env:
INVOKE_NAUTOBOT_CIRCUIT_MAINTENANCE_LOCAL: "true"
Expand Down Expand Up @@ -146,6 +158,8 @@ jobs:
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
- name: "Constrain Nautobot version and regenerate lock file"
env:
INVOKE_NAUTOBOT_CIRCUIT_MAINTENANCE_LOCAL: "true"
Expand Down Expand Up @@ -188,6 +202,8 @@ jobs:
fetch-depth: "0"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
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,5 +1,5 @@

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

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

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 @@ -52,10 +52,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 @@ -5,7 +5,7 @@

from django.core.exceptions import ImproperlyConfigured
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 @@ -77,16 +77,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
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ nav:
- Extending the App: "dev/extending.md"
- Contributing to the App: "dev/contributing.md"
- Development Environment: "dev/dev_environment.md"
- Release Checklist: "dev/release_checklist.md"
- Architecture Decision Records: "dev/arch_decision.md"
- Code Reference:
- "dev/code_reference/index.md"
Expand Down
2 changes: 1 addition & 1 deletion nautobot_circuit_maintenance/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""REST API module for circuit maintenance app."""
"""REST API module for nautobot_circuit_maintenance app."""
34 changes: 15 additions & 19 deletions nautobot_circuit_maintenance/api/serializers.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
"""Serializer for Circuit Maintenance API."""
"""API serializers for nautobot_circuit_maintenance."""

from nautobot.core.api.serializers import NautobotModelSerializer
from nautobot.apps.api import NautobotModelSerializer, TaggedModelSerializerMixin

from nautobot_circuit_maintenance.models import (
CircuitImpact,
CircuitMaintenance,
Note,
NotificationSource,
ParsedNotification,
RawNotification,
)
from nautobot_circuit_maintenance import models


class CircuitMaintenanceSerializer(NautobotModelSerializer):
"""Serializer for API."""
class CircuitMaintenanceSerializer(NautobotModelSerializer, TaggedModelSerializerMixin): # pylint: disable=too-many-ancestors
"""CircuitMaintenance Serializer."""

class Meta:
"""Meta class for MaintenanceSerializer."""
"""Meta attributes."""

model = CircuitMaintenance
model = models.CircuitMaintenance
fields = "__all__"

# Option for disabling write for certain fields:
# read_only_fields = []


class ParsedNotificationSerializer(NautobotModelSerializer):
"""Serializer for API."""

class Meta:
"""Meta class for ParsedNotificationSerializer."""

model = ParsedNotification
model = models.ParsedNotification
fields = "__all__"


Expand All @@ -38,7 +34,7 @@ class RawNotificationSerializer(NautobotModelSerializer):
class Meta:
"""Meta class for RawNotificationSerializer."""

model = RawNotification
model = models.RawNotification
fields = "__all__"


Expand All @@ -48,7 +44,7 @@ class NoteSerializer(NautobotModelSerializer):
class Meta:
"""Meta class for MaintenanceNoteSerializer."""

model = Note
model = models.Note
fields = "__all__"


Expand All @@ -58,7 +54,7 @@ class NotificationSourceSerializer(NautobotModelSerializer):
class Meta:
"""Meta class for NotificationSourceSerializer."""

model = NotificationSource
model = models.NotificationSource
fields = "__all__"


Expand All @@ -68,5 +64,5 @@ class CircuitImpactSerializer(NautobotModelSerializer):
class Meta:
"""Meta class for CircuitImpactSerializer."""

model = CircuitImpact
model = models.CircuitImpact
fields = "__all__"
10 changes: 5 additions & 5 deletions nautobot_circuit_maintenance/api/urls.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""URLS for Circuit Maintenance API."""
"""Django API urlpatterns declaration for nautobot_circuit_maintenance app."""

from rest_framework import routers
from nautobot.apps.api import OrderedDefaultRouter

from . import views
from nautobot_circuit_maintenance.api import views

router = routers.DefaultRouter()
router = OrderedDefaultRouter()
# add the name of your api endpoint, usually hyphenated model name in plural, e.g. "my-model-classes"
router.register("maintenance", views.MaintenanceTaskView)
router.register("note", views.MaintenanceNoteTaskView)
router.register("circuitimpact", views.MaintenanceCircuitImpactTaskView)
router.register("notificationsource", views.NotificationSourceTaskView)
router.register("parsednotification", views.ParsedNotificationTaskView)
router.register("rawnotification", views.RawNotificationTaskView)

app_name = "nautobot_circuit_maintenance-api" # pylint: disable=invalid-name
urlpatterns = router.urls
2 changes: 1 addition & 1 deletion nautobot_circuit_maintenance/api/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Views for API."""
"""API views for nautobot_circuit_maintenance."""

from django.contrib.contenttypes.models import ContentType
from nautobot.apps.api import CustomFieldModelViewSet
Expand Down
Loading

0 comments on commit d9dd4fb

Please sign in to comment.