Jinja import cannot be referenced by any valid path from managed file deployed with salt-ssh #67230
Replies: 27 comments
-
I'm 95% sure this is a duplicate issue, but I can't find the original at the moment. Basically, we're not yet scraping the jinja to make sure we retrieve the files referenced there and sticking them in the state package, so they don't get scp'd to the target system. It's a known issue and something we still have to implement for salt-ssh. |
Beta Was this translation helpful? Give feedback.
-
@basepi Would it be #9878? If so, that ticket has been closed, as if the issue has already been fixed. |
Beta Was this translation helpful? Give feedback.
-
Ah, yes, that's the one! I remember now, we decided scraping or interpreting the jinja was too heavy, and so we decided to add it as a kwarg and opts entry: basically, define these extra files that need to be copies down in |
Beta Was this translation helpful? Give feedback.
-
Because the problem is that minions can't request files from the master, so we have to inspect the state files before they ever make it down to the minion and make sure that all the files are present with the initial state pkg that we scp down, so these jinja references are difficult. |
Beta Was this translation helpful? Give feedback.
-
I don't really understand how to use |
Beta Was this translation helpful? Give feedback.
-
I expect he was referring to the master config ( |
Beta Was this translation helpful? Give feedback.
-
That's strange because installing the |
Beta Was this translation helpful? Give feedback.
-
Hrm, interesting. I think that's probably a result of the defaults generally being fine in salt-ssh. The salt-ssh package probably should be installing that config file, however. Anyway, you can just create the file if you want. |
Beta Was this translation helpful? Give feedback.
-
This is really cumbersome because Salt Formulas have lots of such files and it's very annoying to have to maintain the list of such files... what about including by default all *.jinja files available in the configured file_roots ? This requires people to standardize on this extension for such jinja imports but at least it avoids the problem in 95% and people hit by the problem have an easy workaround. |
Beta Was this translation helpful? Give feedback.
-
It does seem like a reasonable solution. We could even do something like have configurable list of file extensions to automatically sync down. The problems come when people have large file_roots with many files that go to a variety of minions. I mean, for a small setup, I could see just syncing the whole file_roots down to make things easy, but that doesn't scale. =\ |
Beta Was this translation helpful? Give feedback.
-
Hi This also bit me. I'm confused about the usage of Can anyone give me a hint on this? I tracked this down and my first shot is that |
Beta Was this translation helpful? Give feedback.
-
Right, that's to be expected. We can't actually inspect the state data for file refs until it has been rendered so that the jinja is gone. It's possible that extra-filerefs isn't working properly with gitfs, I'll have to find some time to investigate this. |
Beta Was this translation helpful? Give feedback.
-
Thank you based basepi. |
Beta Was this translation helpful? Give feedback.
-
+1 @slafs Nice distillation of the problem. I'm having the same issue with gitfs and extra filerefs. |
Beta Was this translation helpful? Give feedback.
-
This issue still exists in 2016.3.1. Cloning formulas manually and adding to the file_roots list exists a work around. |
Beta Was this translation helpful? Give feedback.
-
This issue ( |
Beta Was this translation helpful? Give feedback.
-
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
Beta Was this translation helpful? Give feedback.
-
Thank you for updating this issue. It is no longer marked as stale. |
Beta Was this translation helpful? Give feedback.
-
Can documentation for extra_filerefs (the configuration option, not the command-line) be added somewhere, please? I can't see it in any of the master configuration docs, I've only learned how it's used by reading this issue. |
Beta Was this translation helpful? Give feedback.
-
Saltfile (for salt-formula): salt-ssh:
extra_filerefs:
- salt://salt/map.jinja
- salt://salt/defaults.yaml
- salt://salt/osfamilymap.yaml
- salt://salt/osmap.yaml
- salt://salt/osfingermap.yaml
- salt://salt/libtofs.jinja sudo salt-ssh --saltfile /var/tmp/Saltfile ... Doesn't work anyway... |
Beta Was this translation helpful? Give feedback.
-
@rafalkrupinski Is that on 3003? |
Beta Was this translation helpful? Give feedback.
-
tried 3003.3 and 3002.7 --saltfile option shows in salt-ssh --help, but not in man/docs/tuts |
Beta Was this translation helpful? Give feedback.
-
This is strange. The feature is known to be broken in 3003.x, but not in 3002: #61014 |
Beta Was this translation helpful? Give feedback.
-
let me try recreating vagrant boxes, maybe I've missed some cache or sth |
Beta Was this translation helpful? Give feedback.
-
IDK, doesn't work for me... |
Beta Was this translation helpful? Give feedback.
-
Given the following managed file:
Containing any of the following import variations:
{% from 'macros/string.j2' import myFunction %}
{% from '/macros/string.j2' import myFunction %}
{% from 'salt://macros/string.j2' import myFunction %}
Running the following command will always throw
TemplateNotFound
:salt-ssh \* state.highstate
Beta Was this translation helpful? Give feedback.
All reactions