-
Notifications
You must be signed in to change notification settings - Fork 283
fix(macros): fix format_kwargs
macro
#296
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
Conversation
@sticky-note Thanks for the PR. Just tracking back through the use of postgres-formula/postgres/upstream.sls Lines 22 to 23 in 3df38b1
postgres-formula/postgres/macros.jinja Lines 13 to 32 in fbd8f65
postgres-formula/postgres/manage.sls Lines 26 to 30 in cd6eb0b
postgres-formula/pillar.example Lines 135 to 150 in 35850da
@vutny Can I get your opinion about this? |
@myii hmmmm, you're right. Non-empty strings are evaluated as |
Tested a
It seems that boolean strings are correctly computed in Booleans :
I think it's because |
Best reviewed: commit by commit
Optimal code review plan
|
postgres/macros.jinja
Outdated
@@ -4,7 +4,7 @@ | |||
|
|||
{%- filter indent(4) %} | |||
{%- for k, v in kwarg|dictsort() %} | |||
- {{ k }}: {{ v }} | |||
- {{ k }}: {{ "'" if v is string else '' }}{{ v }}{{ "'" if v is string else '' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sticky-note Perhaps this can be done more cleanly using https://docs.saltstack.com/en/latest/topics/jinja/#quote. Not tried this yet but how about:
- {{ k }}: {{ "'" if v is string else '' }}{{ v }}{{ "'" if v is string else '' }} | |
- {{ k }}: {{ v|quote if v is string else v }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| quote
doesn't work with :
in strings for example.
yaml_dquote
has better escaping power and encapsulate into "
like I wanted
@sticky-note Did you test this out first? |
@myii |
Merged, thanks @sticky-note -- apologies for the delay. |
@myii No problem, I didn't have so much time too ;) |
🎉 This PR is included in version 0.41.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
PR progress checklist (to be filled in by reviewers)
What type of PR is this?
Primary type
[build]
Changes related to the build system[chore]
Changes to the build process or auxiliary tools and libraries such as documentation generation[ci]
Changes to the continuous integration configuration[feat]
A new feature[fix]
A bug fix[perf]
A code change that improves performance[refactor]
A code change that neither fixes a bug nor adds a feature[revert]
A change used to revert a previous commit[style]
Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)Secondary type
[docs]
Documentation changes[test]
Adding missing or correcting existing testsDoes this PR introduce a
BREAKING CHANGE
?No.
Related issues and/or pull requests
Quote kwargs values on
format_kwargs
macro to resolve sls rendering failure on special characters :Describe the changes you're proposing
Pillar / config required to test the proposed changes
Debug log showing how the proposed changes work
Documentation checklist
README
(e.g.Available states
).pillar.example
.Testing checklist
state_top
).Additional context