Skip to content

Commit

Permalink
fix-810: Updated custom remediation for non-str object types (#819)
Browse files Browse the repository at this point in the history
* fix-810: Updated custom remediation for non-str object types
  • Loading branch information
emdeefive authored Oct 31, 2024
1 parent 8bf6a21 commit a62ab68
Show file tree
Hide file tree
Showing 4 changed files with 711 additions and 642 deletions.
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

0 comments on commit a62ab68

Please sign in to comment.