Closed gsnider2195 closed 3 weeks ago
@jeffkala let's sync on this one. The PR looks good, I just want to make sure that there is thought around where the core rendering logic goes, as an example could/should we make it the same piece of code that is ran in the job
As discussed, we'll update this to spin up a Nornir task to leverage nornir_nautobot.plugins.tasks.dispatcher.default.DispatcherMixin.generate_config
instead of going straight to nautobot's render_jinja2
We'll need to set the output_file_location
to /dev/null
to prevent generate_config
from generating a file every time we call it
This is part of the jinja template editor epic. This PR introduces the
/api/plugins/golden-config/generate-intended-config/
REST API endpoint. This endpoint allows template developers to test jinja template rendering of intended configs using an arbitrary git repository on a single device.This PR also contains some housekeeping changes:
GoldenConfigSetting
model to add aget_for_device
convenience methodGoldenConfigSetting.get_jinja_template_path_for_device
instance method for conveniently retrieving this filesystem pathConfigPlanTest
setUpTestData
instead ofsetUp
Not implemented
GoldenConfigSetting.jinja_repository
. I think we should consider how this overlaps with the existing REST API for config post-processing (/api/plugins/golden-config/sotagg/<uuid:pk>/
) before making this decisionDocs
Sample Data
Git repo used for testing this feature is here
Jinja template used for testing
Request
Response