Skip to content

Commit

Permalink
Changed compliance_feature, compliance_rule, config_remove, config_re…
Browse files Browse the repository at this point in the history
…place, and config_remediation detail views to new component UI
  • Loading branch information
itdependsnetworks committed Jan 19, 2025
1 parent 0b00113 commit c64c800
Show file tree
Hide file tree
Showing 17 changed files with 998 additions and 1,095 deletions.
2 changes: 2 additions & 0 deletions changes/866.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Changed compliance_feature, compliance_rule, config_remove, config_replace, and config_remediation detail views to new component UI.
Changed the supported Nautobot to 2.4.0.
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 2.0.0
ARG NAUTOBOT_VER="2.0.0"
# Accepts a desired Nautobot version as build argument, default to 2.4.0
ARG NAUTOBOT_VER="2.4.0"

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

# 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
5 changes: 4 additions & 1 deletion docs/admin/compatibility_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ While that last supported version will not be strictly enforced via the `max_ver
| 1.4.X | 1.5.3 | 1.5.99 [Official] |
| 1.5.X | 1.6.1 | 1.6.99 [Official] |
| 1.6.X | 1.6.1 | 1.6.99 [Official] |
| 2.0.x | 2.0.0 | 2.0.99 |
| 2.0.x | 2.0.0 | 2.3.99 [Official] |
| 2.1.x | 2.0.0 | 2.3.99 [Official] |
| 2.2.x | 2.0.0 | 2.3.99 [Official] |
| 2.3.x | 2.4.1 | 2.4.99 |
2 changes: 1 addition & 1 deletion docs/dev/dev_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ namespace.configure(
{
"nautobot_golden_config": {
...
"nautobot_ver": "2.0.0",
"nautobot_ver": "2.4.0",
...
}
}
Expand Down
8 changes: 4 additions & 4 deletions docs/user/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,25 +115,25 @@ With the original Git Data Source implementation, passwords were stored in the d
Applying ipam.0006_ipaddress_nat_outside_list... OK
Applying ipam.0007_add_natural_indexing... OK
Applying nautobot_golden_config.0006_multi_repo_support_temp_field...Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/models/fields/related_descriptors.py", line 173, in __get__
File "/usr/local/lib/python3.12/site-packages/django/db/models/fields/related_descriptors.py", line 173, in __get__
rel_obj = self.field.get_cached_value(instance)
File "/usr/local/lib/python3.8/site-packages/django/db/models/fields/mixins.py", line 15, in get_cached_value
File "/usr/local/lib/python3.12/site-packages/django/db/models/fields/mixins.py", line 15, in get_cached_value
return instance._state.fields_cache[cache_name]
KeyError: 'backup_repository'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
<omitted>
File "/usr/local/lib/python3.8/site-packages/cryptography/hazmat/backends/openssl/hmac.py", line 85, in verify
File "/usr/local/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/hmac.py", line 85, in verify
raise InvalidSignature("Signature did not match digest.")
cryptography.exceptions.InvalidSignature: Signature did not match digest.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
<omitted>
File "/usr/local/lib/python3.8/site-packages/django_cryptography/core/signing.py", line 239, in unsign
File "/usr/local/lib/python3.12/site-packages/django_cryptography/core/signing.py", line 239, in unsign
raise BadSignature(
django.core.signing.BadSignature: Signature "b'A9QMEEeCk2+tAc6naf2KDiZBvACNWGNHGMPJ/SHOYY8=\n'" does not match
ERROR: 1
Expand Down
4 changes: 2 additions & 2 deletions invoke.example.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
nautobot_golden_config:
nautobot_ver: "2.0.0"
python_ver: "3.11"
nautobot_ver: "2.4.0"
python_ver: "3.12"
# local: false
# compose_dir: "/full/path/to/nautobot-app-golden-config/development"

Expand Down
4 changes: 2 additions & 2 deletions invoke.mysql.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
nautobot_golden_config:
project_name: "nautobot-golden-config"
nautobot_ver: "2.0.0"
nautobot_ver: "2.4.0"
local: false
python_ver: "3.11"
python_ver: "3.12"
compose_dir: "development"
compose_files:
- "docker-compose.base.yml"
Expand Down
67 changes: 67 additions & 0 deletions nautobot_golden_config/details.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"""Object Detail components for golden config."""

from nautobot.apps import ui
from nautobot.core.templatetags import helpers

compliance_feature = ui.ObjectDetailContent(
panels=(
ui.ObjectFieldsPanel(
section=ui.SectionChoices.LEFT_HALF,
weight=100,
fields="__all__",
),
),
)

compliance_rule = ui.ObjectDetailContent(
panels=(
ui.ObjectFieldsPanel(
section=ui.SectionChoices.LEFT_HALF,
weight=100,
fields="__all__",
value_transforms={
"match_config": [helpers.pre_tag],
},
),
),
)

config_remove = ui.ObjectDetailContent(
panels=(
ui.ObjectFieldsPanel(
section=ui.SectionChoices.LEFT_HALF,
weight=100,
fields="__all__",
value_transforms={
"regex": [helpers.pre_tag],
},
),
),
)

config_replace = ui.ObjectDetailContent(
panels=(
ui.ObjectFieldsPanel(
section=ui.SectionChoices.LEFT_HALF,
weight=100,
fields="__all__",
value_transforms={
"regex": [helpers.pre_tag],
"replace": [helpers.pre_tag],
},
),
),
)

config_remediation = ui.ObjectDetailContent(
panels=(
ui.ObjectFieldsPanel(
section=ui.SectionChoices.LEFT_HALF,
weight=100,
fields="__all__",
value_transforms={
"remediation_options": [helpers.render_json],
},
),
),
)

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 6 additions & 1 deletion nautobot_golden_config/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from rest_framework.decorators import action
from rest_framework.response import Response

from nautobot_golden_config import filters, forms, models, tables
from nautobot_golden_config import details, filters, forms, models, tables
from nautobot_golden_config.api import serializers
from nautobot_golden_config.utilities import constant
from nautobot_golden_config.utilities.config_postprocessing import get_config_postprocessing
Expand Down Expand Up @@ -404,6 +404,7 @@ class ComplianceFeatureUIViewSet(views.NautobotUIViewSet):
serializer_class = serializers.ComplianceFeatureSerializer
table_class = tables.ComplianceFeatureTable
lookup_field = "pk"
object_detail_content = details.compliance_feature

def get_extra_context(self, request, instance=None):
"""A ComplianceFeature helper function to warn if the Job is not enabled to run."""
Expand All @@ -422,6 +423,7 @@ class ComplianceRuleUIViewSet(views.NautobotUIViewSet):
serializer_class = serializers.ComplianceRuleSerializer
table_class = tables.ComplianceRuleTable
lookup_field = "pk"
object_detail_content = details.compliance_rule

def get_extra_context(self, request, instance=None):
"""A ComplianceRule helper function to warn if the Job is not enabled to run."""
Expand Down Expand Up @@ -487,6 +489,7 @@ class ConfigRemoveUIViewSet(views.NautobotUIViewSet):
serializer_class = serializers.ConfigRemoveSerializer
table_class = tables.ConfigRemoveTable
lookup_field = "pk"
object_detail_content = details.config_remove

def get_extra_context(self, request, instance=None):
"""A ConfigRemove helper function to warn if the Job is not enabled to run."""
Expand All @@ -505,6 +508,7 @@ class ConfigReplaceUIViewSet(views.NautobotUIViewSet):
serializer_class = serializers.ConfigReplaceSerializer
table_class = tables.ConfigReplaceTable
lookup_field = "pk"
object_detail_content = details.config_replace

def get_extra_context(self, request, instance=None):
"""A ConfigReplace helper function to warn if the Job is not enabled to run."""
Expand All @@ -524,6 +528,7 @@ class RemediationSettingUIViewSet(views.NautobotUIViewSet):
serializer_class = serializers.RemediationSettingSerializer
table_class = tables.RemediationSettingTable
lookup_field = "pk"
object_detail_content = details.config_remediation

def get_extra_context(self, request, instance=None):
"""A RemediationSetting helper function to warn if the Job is not enabled to run."""
Expand Down
Loading

0 comments on commit c64c800

Please sign in to comment.