diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90d231d3..e4493d46 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: # yamllint disable-line rule:truthy rule:comments branches: - "main" - "develop" + - "ltm-1.6" tags: - "v*" pull_request: ~ @@ -116,9 +117,9 @@ jobs: strategy: fail-fast: true matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.11"] db-backend: ["postgresql"] - nautobot-version: ["latest"] + nautobot-version: ["ltm-1.6"] # 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 @@ -131,7 +132,7 @@ jobs: nautobot-version: "1.6.1" - python-version: "3.11" db-backend: "mysql" - nautobot-version: "latest" + nautobot-version: "ltm-1.6" runs-on: "ubuntu-20.04" env: INVOKE_NAUTOBOT_GOLDEN_CONFIG_PYTHON_VER: "${{ matrix.python-version }}" diff --git a/docs/admin/release_notes/version_1.6.md b/docs/admin/release_notes/version_1.6.md index 1e047824..259d890a 100755 --- a/docs/admin/release_notes/version_1.6.md +++ b/docs/admin/release_notes/version_1.6.md @@ -5,6 +5,12 @@ - Add functionality to compliance result to provide a Remediation plan. - Supports Nautobot >=1.6.1,<2.0.0. +## v1.6.3 - 2023-10 + +### Fixed + +- [#668](https://github.com/nautobot/nautobot-plugin-golden-config/issue/668) - Removed unneeded lookup for GoldenConfigSetting + ## v1.6.2 - 2023-09 ### Fixed diff --git a/nautobot_golden_config/template_content.py b/nautobot_golden_config/template_content.py index 6234cdb1..3f55c98b 100644 --- a/nautobot_golden_config/template_content.py +++ b/nautobot_golden_config/template_content.py @@ -1,10 +1,8 @@ """Added content to the device model view for config compliance.""" from django.db.models import Count, Q -from nautobot.dcim.models import Device from nautobot.extras.plugins import PluginTemplateExtension from nautobot_golden_config.models import ConfigCompliance, GoldenConfig from nautobot_golden_config.utilities.constant import CONFIG_FEATURES, ENABLE_COMPLIANCE -from nautobot_golden_config.utilities.helper import get_device_to_settings_map class ConfigComplianceDeviceCheck(PluginTemplateExtension): # pylint: disable=abstract-method @@ -19,6 +17,8 @@ def get_device(self): def right_page(self): """Content to add to the configuration compliance.""" comp_obj = ConfigCompliance.objects.filter(device=self.get_device()).values("rule__feature__name", "compliance") + if not comp_obj: + return "" extra_context = { "compliance": comp_obj, "device": self.get_device(), @@ -52,6 +52,8 @@ def right_page(self): .order_by("rule__feature__name") .values("rule__feature__name", "compliant", "non_compliant") ) + if not comp_obj: + return "" extra_context = {"compliance": comp_obj, "template_type": "site"} return self.render( "nautobot_golden_config/content_template.html", @@ -72,13 +74,13 @@ def right_page(self): """Content to add to the configuration compliance.""" device = self.get_device() golden_config = GoldenConfig.objects.filter(device=device).first() - settings = get_device_to_settings_map(queryset=Device.objects.filter(id=device.id)) + if not golden_config: + return "" extra_context = { "device": self.get_device(), # device, "golden_config": golden_config, "template_type": "device-configs", "config_features": CONFIG_FEATURES, - "matched_config_setting": settings.get(device.id, False), } return self.render( "nautobot_golden_config/content_template.html", @@ -108,6 +110,8 @@ def right_page(self): .order_by("rule__feature__name") .values("rule__feature__name", "compliant", "non_compliant") ) + if not comp_obj: + return "" extra_context = {"compliance": comp_obj, "template_type": "site"} return self.render( "nautobot_golden_config/content_template.html", diff --git a/nautobot_golden_config/templates/nautobot_golden_config/content_template.html b/nautobot_golden_config/templates/nautobot_golden_config/content_template.html index 8b1f6572..294c25bf 100644 --- a/nautobot_golden_config/templates/nautobot_golden_config/content_template.html +++ b/nautobot_golden_config/templates/nautobot_golden_config/content_template.html @@ -64,7 +64,6 @@ Config - {% if matched_config_setting %} {% if config_features.compliance and golden_config.compliance_config %} @@ -118,7 +117,6 @@ {% endif %} - {% endif %} {% endif %} diff --git a/pyproject.toml b/pyproject.toml index d938e5de..db6678c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nautobot-golden-config" -version = "1.6.2" +version = "1.6.3" description = "A plugin for configuration on nautobot" authors = ["Network to Code, LLC", ""]