-
Notifications
You must be signed in to change notification settings - Fork 423
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
[BUG] Run fails if nginx.server.snippets is not defined in pillar #274
Comments
I looked at this a bit. First I expected the best way to fix it would be to add a default value to So I started asking myself why So I think the real bug is in the fact that EDIT: At least in my case, "the pop in nginx/snippets.sls", as indicated by @hkbakke, is not where this is happening. In stead, it's happening in
|
nginx.servers_config wants a lightened copy of the nginx map to render as json; but, when it was trying to remove the servers and snippets keys from the map it assumed their presence, causing a KeyError if they were not present by its use of .pop(). While wrapping these in an "if" clause would likely be more correct, along with replacing .pop() with del (if jinja even supports that) the simplest change here is to just specify a default value for .pop(), which obviates the KeyError. Fixes saltstack-formulas#274 # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch issues/274 # Changes to be committed: # modified: nginx/servers_config.sls #
nginx.servers_config wants a lightened copy of the nginx map to render as json; but, when it was trying to remove the servers and snippets keys from the map it assumed their presence, causing a KeyError if they were not present by its use of .pop(). While wrapping these in an "if" clause would likely be more correct, along with replacing .pop() with del (if jinja even supports that) the simplest change here is to just specify a default value for .pop(), which obviates the KeyError. Fixes saltstack-formulas#274
Hello, Any update ? The PR fixes the problem for me. |
@Yoda-BZH It seems that @javierbertoli is waiting for the final adjustments:
|
ho, ok thanks :) |
nginx.servers_config wants a lightened copy of the nginx map to render as json; but, when it was trying to remove the servers and snippets keys from the map it assumed their presence, causing a KeyError if they were not present by its use of .pop(). While wrapping these in an "if" clause would likely be more correct, along with replacing .pop() with del (if jinja even supports that) the simplest change here is to just specify a default value for .pop(), which obviates the KeyError. Fixes saltstack-formulas#274
nginx.servers_config wants a lightened copy of the nginx map to render as json; but, when it was trying to remove the servers and snippets keys from the map it assumed their presence, causing a KeyError if they were not present by its use of .pop(). While wrapping these in an "if" clause would likely be more correct, along with replacing .pop() with del (if jinja even supports that) the simplest change here is to just specify a default value for .pop(), which obviates the KeyError. Fixes saltstack-formulas#274
## [2.7.2](v2.7.1...v2.7.2) (2021-06-14) ### Bug Fixes * **certificates:** ensure `openssl` installed before `cmd.run` ([0cd7c7b](0cd7c7b)), closes [/gitlab.com/saltstack-formulas/nginx-formula/-/jobs/1345325819#L2830](https://github.com//gitlab.com/saltstack-formulas/nginx-formula/-/jobs/1345325819/issues/L2830) * **snippets:** ignore servers or snippets when undefined ([6cb486d](6cb486d)), closes [#274](#274)
🎉 This issue has been resolved in version 2.7.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 2.7.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
If nginx.server.snippets is not defined in my pillar file, the run fails. Just adding
{}
as value is enough to work around the problem.The issue seems to be occuring at the pop in nginx/snippets.sls.
Currently using 1920340
The text was updated successfully, but these errors were encountered: