-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
salt-ssh jinja TemplateNotFound #9878
Comments
Ahh, seems I overlooked this case, all of the needed files are sent over to the minion in the state package, but unfortunately the jinja import references are not being included, this needs to be added. |
I came across this today while trying to prep a pull request for some salt-ssh fixes... workaround by hard-coding, but @thatch45 : if you have quick pointers on how/where to add support for this I'm willing to add it in, let me know... |
I guess the question is whether the file is just not making it down to the minion, or if it's just not being put in a place such that the template can import it. It's going to be a change probably in salt/client/ssh/state.py or salt/client/ssh/wrapper/state.py, I think. |
Not making it at all... templates referenced from sls'es are included in the package sent to the minion, it's templates referenced from other templates that don't show up. Ie: if I have a template-based file being managed, and the template in question does a jinja-include of another template... the other template which is included via jinja is what doesn't show up. So... the 'root' template which would be referenced in the sls via source: salt://path/to/template.jinja is getting picked up via the file_refs stuff that happens... it's a template, referenced via a jinja include, etc... from within template.jinja in this example that's not being seen because no de-referencing of stuff in the template files themselves is happening. |
Oh right, that's going to be quite a bit harder, because now we have to not only inspect the state files, but we're going to have to inspect the actual templates themselves.....hrm, I'm not sure how to go about this one. |
I have a fix for this, although not sure if it's acceptable or not upstream, hopefully this works though: I've added support for an "extra_filerefs" keyword CLI argument to salt-ssh, ie: salt-ssh ... state.sls your_module extra_filerefs=salt://path/to/included/file extra_filerefs accepts a comma-separated list of salt-protocol paths to files and/or directories which should be included in the salt data package (ie: salt_state.tgz) shipped to a minion during a salt-ssh run. There's precedent for this in a way, via the extra modules argument already supported by "salt-run thin.generate", ie: you can pass a comma separated list of extra modules to package up in the thintar. There were a few other approaches I spent a LOT of time playing with/testing/etc, but both proved inadequate:
"Error prone" above means because of the location of the theoretical mods, it may be rather difficult to ensure that the mods wouldn't have subtle impacts/generate errors elsewhere, etc, although that perception may just be my own lack of understanding of the codebase as a whole? Anyways... the fix to support the extra_filerefs is simple, generically applicable, and ready to go, so assuming there's no issue with the mechanic itself, let me know and I can issue a pull request for it. |
This sounds like the best immediate workaround to me, even though it's not as automatic -- at least it works. Even if it's not the best long-term solution, since it's fairly easy to get in there, I would recommend putting in a pull request. |
…include *template*-referenced files (ie: includes) in thin data package sent to minion during salt-ssh. Fixes issue saltstack#9878
I have been chewing on this one for a WHILE, trying to figure out the best approach, I am going to try a few things.... |
I have another fix for this coming in a PR that should make it smoother as well. |
Given the additional PR I am going to close this out |
Was there another fix in the works for this, or is the accepted solution |
I have hammered on this one a lot but have been unable to fix it in a way that makes me happy. So for the time being we need to keep it where it is. We have a more elaborate solution planned but it will require some substantial development. |
@thatch45 Thanks for that. This is okay and workable for now. Is it possible to include the |
It is. I will add it to the roster or saltfile |
Allow extra file refs to be defined in opts and saltfile per #9878
Here is an experimental one-line patch: #31531 (comment) |
I believe I found an issue with salt-ssh when using jinja map template files.
Please take a look at https://github.com/chekolyn/cherokee-formula/blob/master/cherokee/templates/cherokee.conf.jinja
This formula renders fine when using the master node configuration but when I try to deploy it using salt-ssh I get the following error:
The text was updated successfully, but these errors were encountered: