Open matt852 opened 1 year ago
If I understand correctly, you are saying that the job does not automatically sync the git repos, such as data or templates? If so, this is to be categorized as "works as intended" https://docs.nautobot.com/projects/golden-config/en/latest/user/app_faq/#why-arent-configurations-generated-or-compliance-generated-real-time
The jobs sync the repo but only refreshes Template data, even when both Config Context data and Template data are in the same repo.
We talked about this a bit this morning and may consider adding this as a settings option on whether or not to automatically sync config context data as part of the job. This will allow it to remain backwards compat., but also gives flexibility for those cases where multiple teams/ppl maybe updating config-context data in the repo which an auto sync may not yield the expected results.
I think that works, but I think I might be making this sound a bit more complex than I mean to, or I am simply misunderstanding.
Here's a screenshot of running the "Intended Configs" job.
The job refreshes the Templates repository and the templates from the repo. However it does NOT refresh the config contexts repo, nor does it update the data from the config contexts repo. This repo is flagged for both config_context data
and jinja2 templates
.
Since the repo is serving a dual purpose, shouldn't this job either refresh both or none at all?
We're targeting off of repo + "provides". So it's working as expected. I don't believe you're misunderstanding anything here.
I also find this default behavior to be troublesome for my teams, in my case though we are using split repos, one for templates, one for contexts, and multiple external teams update the config contexts
and templates
, for which they own and maintain, and this leads to a lot of "my compliance isn't updating" messages to the Application SME's, because they forget that they have to manually go refresh the config context
repo every time, before running compliance, but not for jinja
template updates. Perhaps, the suggestion of a setting mentioned earlier to retain backwards compatibility would be a good option.
This has been addressed in #506 and #543.
Environment
Steps to Reproduce
nautobot-gc-files
with 2 folders in it: "config_contexts" and "templates". Underprovides
, set it to bothconfig contexts
andjinja templates
templates/cisco_nxos.j2
(file contents below)config_contexts/all.yml
(file contents below)Execute All Golden Configuration Jobs - Single Device
config_context
tab, and 1 feature in the template/intended configconfig_contexts/all.yml
, and remove the feature command intemplates/cisco_nxos.j2
Execute All Golden Configuration Jobs - Single Device
. Do NOT manually sync the Git repoExecute All Golden Configuration Jobs - Single Device
Files
templates/cisco_nxos.j2
config_contexts/all.yml
Expected Behavior
When I run the Golden Config job
Execute All Golden Configuration Jobs - Single Device
, I expect the repo to sync and both the Jinja2 templates as well as the Config Context data to refresh.Observed Behavior
The job appears to sync the repository correctly, but only refreshes the template data and not the config context data. If I manually sync the Git repository, the data is updated correctly on the next job run.
This does not seem to be an issue when the
config contexts
andjinja2 templates
are configured in separate repos.Note the same behavior applies with these jobs:
Execute All Golden Configuration Jobs - Single Device
Execute All Golden Configuration Jobs - Multiple Device
Generated Intended Configurations