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

A custom remediation that is not a string raises an exception on config plan generation #810

Closed
jeffkala opened this issue Sep 23, 2024 · 2 comments · Fixed by #819
Closed

Comments

@jeffkala
Copy link
Contributor

Environment

  • Python version:
  • Nautobot version:
  • nautobot-golden-config version:

Expected Behavior

If a feature is using custom remediation that results in structured data, the generated config plan should check if the feature is custom and just reply with that data instead of trying to split on the string.

Observed Behavior

Custom remediations purpose is to allow for remediations to provide non-CLI based data. The below line intimates we only allow strings in remediation "field".

config_set="\n".join(config_sets),

Steps to Reproduce

  1. Do the pre-reqs to get GC app up and running.
  2. Setup a custom remediation in PLUGIN_CONFIG and have the custom remediation return structured data.
  3. Generate a config plan "type remediation" on that custom remediation feature.
@jeffkala
Copy link
Contributor Author

Screenshot 2024-09-21 at 7 57 06 PM
Screenshot 2024-09-21 at 7 57 14 PM

@jeffkala
Copy link
Contributor Author

A potential option is to check isinstance...could also instead try to chec kif custom_remediation bool is true

            if not isinstance(config_sets, str):
                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=config_set,
                change_control_id=self._change_control_id,
                change_control_url=self._change_control_url,
                status=self.plan_status,
                plan_result=self.job_result,
            )
    ```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant