-
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
Make sure SaltCacheLoader use correct fileclient #61895
Conversation
--- /root/original_state.py 2022-04-01 11:45:58.041040719 +0300
+++ /usr/lib/python3/dist-packages/salt/state.py 2022-04-01 11:40:48.530320452 +0300
@@ -4022,6 +4022,8 @@
)
else:
try:
+ if context is None:
+ context = {"fileclient": self.client}
state = compile_template(
fn_,
self.state.rend, Can confirm that this PR fixes the salt-ssh (3004) work on Ubuntu 20.04 |
Can also confirm salt-ssh 3004 fix on CentOS 7 |
fixed |
Nice, thanks for the fix I had the same issue |
Hello. There are in fact 2 kinds of issues regarding
This PR solves the first issue, without the need of The second case still has the issue. |
@baby-gnu yes, this change will fix jinja generation on master side (system on which salt-ssh is executed), this was my main goal to fix, without this change salt-ssh is unusable for me (since version 3002) About missing template files on minion side (when import is used inside "file.managed" templates). This is rather other problem, probably with salt_state.tgz generation. Checked quickly how salt_state.tgz is generated, and cannot find any detection for "include" files inside templates. Found only detection for files required directly by lowstate, looks like it will not work without --extra-filerefs. |
@kaszuba thanks for the explanation. Don't worry, I mostly prefer to pass Thanks. |
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
When is this PR gonna get merged? This bug is a huge regression for salt-ssh users. Is SaltStack becoming abandonware? |
@Ch3LL is this patch being tracked for 3005 release? |
No, it looks like it was slated for 3006 on our issue tracker. But this PR will need test coverage and a changelog before it will be accepted. |
Any chance we get this PR merged ? I'm actually stuck in Salt 3002 because of this regression |
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.
This needs a test case.
When writing a test for this, here's a scenario that's easy to reproduce for me, affected by this issue:
|
But what are the pass / fail outputs?? |
Would someone be willing to try my fix here: #63184 Its still a work in progress, but it I did verify it worked with the original submitter of this issue's files: #60003. and using If it does not work, please post the exact files you are using and the exact command. I need to review all of the methods in salt/client/ssh/wrapper/state.py to ensure we are explicitly passing in context. I think it would be a better fix to explicitly pass in context from salt-ssh to ensure we are using the entire context, not just setting fileclient. |
Hi @Ch3LL, thanks for looking on problem, your solution looks much better then old quick fix :) I checked your patch and not works for me, got the same error with missing template, but it is fast fixable by adding old patch in render_highstate method
Probably context should be also passed to "render_highstate", now in BaseHighState it is used only as "self.render_highstate(matches)", without context passing |
@Ch3LL i see there is already change for render_highstate(), probably i grab wrong patch |
Yeah, I just recently pushed up a fix for that call. I'm currently adding tests (that's how I found that issue) and fixing up the rest of the functions in salt-ssh's state.py. Thanks for confirming. I'll go ahead and close in favor of https://github.com/saltstack/salt/pull/63184/files |
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
Backported from saltstack/salt#61895 Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
What does this PR do?
Fix problem with jinja2.exceptions.TemplateNotFound: errors in salt-ssh
What issues does this PR fix or reference?
Fixes: #60003 #61174
Problem was caused by wrong cachedir path used by fileclient (FSClient class) in SaltCacheLoader:
When execute "salt-ssh ... state.apply" BaseHighState will get fsclient from SSH (with minion path), and in compile_low_chunks() files are cached in minion cache path. But when execute jinja (in render_state) fsclient will cache files in cachedir from config (different then minion) and jinja cannot find files.