Unable to cache error in salt-minion log file

12 views
Skip to first unread message

fxp

unread,
Nov 29, 2016, 9:06:29 AM11/29/16
to Salt-users
Hi all,

I'm using this in my state file -

{% from "globals.sls" import globals with context %}
...
{% if not salt.file.file_exists('/path/to/file/a') or salt.file.get_diff('/path/to/file/a' , 'salt://files/a.{{ globals.foobar }}' ) == '' %}
...


and I'm seeing this error in the salt-minion log file -

salt-minion: [ERROR   ] Unable to cache file 'salt://files/a.{{ globals.foobar }}' from saltenv 'base'

Everything seems to be working correctly otherwise and the state seems to be doing its thing and I'm just trying to eliminate all errors in the log file. Any reason why this is happening?
I tried setting the "fileserver_backend" in salt master config to "roots" but it didn't help.

Thanks,

fxp

unread,
Nov 29, 2016, 9:51:21 AM11/29/16
to Salt-users
Actually further testing shows that it is actually not doing the state properly. Due to the error, it is actually thinking there is a diff and repeating the state each run instead of not entering the if loop.
If I hardcode the {{ globals.foobar }} with the actual value, then it does the right thing.

fxp

unread,
Nov 29, 2016, 10:20:04 AM11/29/16
to Salt-users

This issue is resolved.
After some reading I realized I was invoking it incorrectly. Switching to this and it works without issue -

...
{% if not salt.file.file_exists('/path/to/file/a') or salt.file.get_diff('/path/to/file/a' , 'salt://files/a.' +  globals.foobar  ) != '' %}
...
Reply all
Reply to author
Forward
0 new messages