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

fix-810: Updated custom remediation for non-str object types #819

Merged
merged 6 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions changes/810.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed custom compliance to work with non-string objects.
7 changes: 6 additions & 1 deletion nautobot_golden_config/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,15 @@ def _generate_config_plan_from_feature(self):
_features = ", ".join([str(feat) for feat in self._feature])
self.logger.debug(f"Device `{device}` does not have `{self._plan_type}` configs for `{_features}`.")
continue

if not all(isinstance(config_set, str) for config_set in config_sets):
config_set = config_sets
else:
config_set = "\n".join(config_sets)
config_plan = ConfigPlan.objects.create(
device=device,
plan_type=self._plan_type,
config_set="\n".join(config_sets),
config_set=config_set,
change_control_id=self._change_control_id,
change_control_url=self._change_control_url,
status=self.plan_status,
Expand Down
4 changes: 2 additions & 2 deletions nautobot_golden_config/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,12 +485,12 @@ class ConfigPlanTable(StatusTableMixin, BaseTable):
pk = ToggleColumn()
device = LinkColumn("plugins:nautobot_golden_config:configplan", args=[A("pk")])
plan_result = TemplateColumn(
template_code="""<a href="{% url 'extras:jobresult' pk=record.plan_result.pk %}" <i class="mdi mdi-clipboard-text-play-outline"></i></a> """
template_code="""<a href="{% url 'extras:jobresult' pk=record.plan_result.pk %}"><i class="mdi mdi-clipboard-text-play-outline"></i></a>"""
)
deploy_result = TemplateColumn(
template_code="""
{% if record.deploy_result %}
<a href="{% url 'extras:jobresult' pk=record.deploy_result.pk %}" <i class="mdi mdi-clipboard-text-play-outline"></i></a>
<a href="{% url 'extras:jobresult' pk=record.deploy_result.pk %}"><i class="mdi mdi-clipboard-text-play-outline"></i></a>
{% else %}
&mdash;
{% endif %}
Expand Down
Loading