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

Import YAML with context #311

Closed
wants to merge 0 commits into from

Conversation

Lucianovici
Copy link

Import yaml with context to avoid errors like:

[CRITICAL] Rendering SLS ... failed: Jinja variable 'grains' is undefined
[CRITICAL] Rendering SLS ... failed: Jinja variable 'salt' is undefined

@Lucianovici Lucianovici requested review from myii and vutny as code owners May 17, 2021 09:56
Copy link
Contributor

@vutny vutny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to amend your commit message for lint job to be satisfied. Please take a look here: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

Other than that and one comment below, this looks good. Thanks for contributing!

{% import_yaml "postgres/osfamilymap.yaml" as osfamilymap %}
{% import_yaml "postgres/osmap.yaml" as osmap %}
{% import_yaml "postgres/codenamemap.yaml" as oscodenamemap %}
{% import_yaml "postgres/defaults.yaml" as defaults with context %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defaults mapping should not have any dynamic calls, so I think you'd better omit with context for it.
The warning message would be legitimate in this case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defaults mapping should not have any dynamic calls, so I think you'd better omit with context for it.
The warning message would be legitimate in this case.

I hit a similar issue a few of days ago, while merging a PR for the rspamd-formula. While all tests passed correctly on my dev env, they failed with the same error you describe on the saltstack-formula's env.

The only difference I saw is that the latter uses saltstack's master branch code while I was using packages-based images to test locally. I could reproduce the error using master.

Today, @myii directed me to a new saltstack's issue reported, which mentions that these errors are caused by a new jinja2 release and that salt is not playing nice with it. Maybe this is the root cause of these issues?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that is the root cause, this could be considered as a temp fix until that is fixed. I encounter this to multiple salt formulas while updating to Salt v3003. So should we wait for the root cause fix?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that is the root cause, this could be considered as a temp fix until that is fixed. I encounter this to multiple salt formulas while updating to Salt v3003. So should we wait for the root cause fix?

@Lucianovici Thanks for your PRs that are proposing fixes for this situation.

As I mentioned in that issue, this is affecting (at least) 32 of our formulas. Personally, I'd like to get some response from the Salt devs before making a final decision about this. I'd prefer not to "fix" all the formulas and then have to undo (or redo) the fixes again when that issue is resolved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little update: in the meantime, while we wait for a response from the Salt devs, @javierbertoli and myself have added a workaround to the pre-salted images so that Jinja is downgraded from 3.0.x back to 2.11.3. This will allow our CI to keep working across all formulas for the time being.

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 this pull request may close these issues.

4 participants