file.managed not working on 2014.7.2
I just upgraded to 2014.7.2, and I'm running into an issue where most of my previously working file.managed states are now broken. I haven't fully determined a root cause yet, but I did figure out that templated files work ok.
This works:
/tmp/foobar:
file.managed:
- source: salt://foobar
- user: root
- group: root
- mode: 644
- template: jinja
# salt casework-eval state.sls test
casework-eval:
Name: /tmp/foobar - Function: file.managed - Result: Clean
This fails:
/tmp/foobar:
file.managed:
- source: salt://foobar
- user: root
- group: root
- mode: 644
# - template: jinja
casework-eval:
----------
ID: /tmp/foobar
Function: file.managed
Result: False
Comment: Source file salt://foobar not found
Started: 17:08:34.440705
Duration: 122.741 ms
Changes:
Minion logs aren't very helpful:
[INFO ] User sudo_njones Executing command state.sls with jid 20150213120832012297
[DEBUG ] Command details {'tgt_type': 'glob', 'jid': '20150213120832012297', 'tgt': 'casework-eval', 'ret': '', 'user': 'sudo_njones', 'arg': ['test'], 'fun': 'state.sls'}
[INFO ] Starting a new job with PID 63777
[DEBUG ] Decrypting the current master AES key
[DEBUG ] Loaded minion key: /opt/salt/etc/pki/minion/minion.pem
[DEBUG ] Reading configuration from /opt/salt/etc/minion
[DEBUG ] Decrypting the current master AES key
[DEBUG ] Loaded minion key: /opt/salt/etc/pki/minion/minion.pem
[DEBUG ] Loaded minion key: /opt/salt/etc/pki/minion/minion.pem
[INFO ] Loading fresh modules for state activity
[INFO ] Executing command '/usr/sbin/zfs help' in directory '/root'
[DEBUG ] Fetching file from saltenv 'base', ** attempting ** 'salt://test.sls'
[INFO ] Fetching file from saltenv 'base', ** done ** 'test.sls'
[DEBUG ] Jinja search path: ['/opt/salt/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /opt/salt/var/cache/salt/minion/files/base/test.sls:
/tmp/foobar:
file.managed:
- source: salt://foobar
- user: root
- group: root
- mode: 644
#- template: jinja
[DEBUG ] Results of YAML rendering:
OrderedDict([('/tmp/foobar', OrderedDict([('file.managed', [OrderedDict([('source', 'salt://foobar')]), OrderedDict([('user', 'root')]), OrderedDict([('group', 'root')]), OrderedDict([('mode', 644)])])]))])
[INFO ] Running state [/tmp/foobar] at time 17:08:34.440705
[INFO ] Executing state file.managed for /tmp/foobar
[DEBUG ] Decrypting the current master AES key
[DEBUG ] Loaded minion key: /opt/salt/etc/pki/minion/minion.pem
[ERROR ] Source file salt://foobar not found
[INFO ] Completed state [/tmp/foobar] at time 17:08:34.563446
[DEBUG ] File /opt/salt/var/cache/salt/minion/accumulator/18446741324868475216 does not exist, no need to cleanup.
[INFO ] Returning information for job: 20150213120832012297
I'm running with both a 2014.7.2 master and minion on SmartOS. Can't say for sure if this worked on 2014.7.1 because I upgraded directly from 2014.1.0.
cc: @nshalman
@njones11, thanks for reporting this.
Looks like this is coming in here (I added some debug print statements):
2551 if source:
2552 if salt._compat.urlparse(source).scheme == 'salt':
2553 source_sum = __salt__['cp.hash_file'](source, saltenv)
2554 log.debug(source_sum)
2555 if not source_sum:
2556 return '', {}, 'B Source file {0} not found'.format(source)
source_sum is blank/empty
Also (on the minion):
# salt '*' cp.hash_file salt://foobar
Could not access /opt/salt/var/cache/salt/master. Path does not exist.
@njones11, thanks for all the great information. If you think you've got an idea on how to fix this, please feel free to submit a pull request mentioning this issue in the pull request message.
If I get a chance, I'll run this down, but that probably won't be soon. I didn't find the root cause yet, and I had to revert both the minion and master back to a stable version since these machines are in production.
I have run into the same issue on SmartOS with 2014.7.2.
If it would help, I could do some testing with 2014.7.1 or 2014.7.0 to see if the problem exists there as well.
@johngrasty, sure that could help. I'm not particularly interested in those releases as they're not current. but if it helps you track down the issue then that's great. Thanks for the help.
This seems to work for me with the latest salt and smartos (97f4ec97ef58755b55e608ad5c985e5667c33c1e and base-64-lts:14.4.0)
That error means that the file could not be found. Can you run salt-run fileserver.file_list and see if foobar (or whatever the file actually was, if is being obfuscated here) is in the list that is returned?
Also, is this file coming from a gitfs source? We had some troublesome gitfs regressions in 2014.7.2 which have since been fixed.
I use file.managed all day long on SmartOS with v2015.5.2 and no issues. Very similar use cases to @njones11. Can you test with latest stable?
@BretFisher I can test today. What method did you use to install 2015.5.2, so I can test with a similar environment?
I tested on v.2015.5.3 on smartOS, and the bug seems to be resolved! Thanks.
I used a Joyent Public cloud 14.x or 15.x SmartOS image, and did git-based install (with some workarounds based on other SmartOS logged issues that are some open, some closed)...
But none of those were related to file.*
@njones11, do you still have this problem on the latest release?
I'll try to test it. We're still on 2014.1 (and have been having no issues) so we haven't upgraded in a while.
@njones11 Just another bump here on this issue. It looks like other users are reporting this as fixed, but I'd like to give you a chance to respond before closing. Have you had a chance to upgrade? Latest release is 2015.8.10.