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

Filter all calls to formulas_git_opt through load_yaml #176

Merged
merged 1 commit into from
Sep 3, 2015
Merged

Filter all calls to formulas_git_opt through load_yaml #176

merged 1 commit into from
Sep 3, 2015

Conversation

xenophonf
Copy link
Contributor

Jinja macros are not actually functions. The only thing they can return
is a string. In order to return structured data, the callee must
serialize it, and the caller must deserialize it. This state formula
uses YAML as the intermediary, hence the occurrence of both the
|yaml (callee) and |load_yaml (caller) filters in its code.

The post-render "mapping values are not allowed here" error in
salt/formulas.sls or the broken rendering of
salt/files/master.d/f_defaults.conf happens because invocations of the
formulas_git_opt macro in several Jinja set statements do not get
deserialized, resulting in the trailing newline followed by three dot
characters (...), which YAML uses to signal the end of a document.
Correcting these rendering errors requires adding the necessary
deserialization code at those locations (i.e., filtering the macro call
through |load_yaml).

Closes #175.

Jinja macros are not actually functions.  The only thing they can return
is a string.  In order to return structured data, the callee must
serialize it, and the caller must deserialize it.  This state formula
uses YAML as the intermediary, hence the occurrence of both the
`|yaml` (callee) and `|load_yaml` (caller) filters in its code.

The post-render "mapping values are not allowed here" error in
*salt/formulas.sls* or the broken rendering of
*salt/files/master.d/f_defaults.conf* happens because invocations of the
`formulas_git_opt` macro in several Jinja `set` statements do not get
deserialized, resulting in the trailing newline followed by three dot
characters (`...`), which YAML uses to signal the end of a document.
Correcting these rendering errors requires adding the necessary
deserialization code at those locations (i.e., filtering the macro call
through `|load_yaml`).
iggy added a commit that referenced this pull request Sep 3, 2015
…llowed-render-error

Filter all calls to formulas_git_opt through load_yaml
@iggy iggy merged commit 32d2de2 into saltstack-formulas:master Sep 3, 2015
@xenophonf xenophonf deleted the fix-formulas-mapping-values-not-allowed-render-error branch September 3, 2015 19:47
@xenophonf
Copy link
Contributor Author

Thanks for merging this!

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.

2 participants