saltstack/community

Skipped invalid cache mtime entry in /var/cache/salt/master/roots/mtime_map

Closed this issue · 0 comments

wchao commented

I get the following warnings once a minute:

2020-06-23 23:11:13,900 [salt.loaded.int.fileserver.roots:180 ][WARNING ][24993] Skipped invalid cache mtime entry in /var/cache/salt/master/roots/mtime_map: /srv/salt/a/b/c/ifcfg-eth0:0:1533517049.0

2020-06-23 23:11:13,901 [salt.loaded.int.fileserver.roots:180 ][WARNING ][24993] Skipped invalid cache mtime entry in /var/cache/salt/master/roots/mtime_map: /srv/salt/x/y/z/ifcfg-eth0:0:1526301738.0

2020-06-23 23:11:13,905 [salt.loaded.int.fileserver.roots:180 ][WARNING ][24993] Skipped invalid cache mtime entry in /var/cache/salt/master/roots/mtime_map: /srv/salt/dns/zone/1111:2222.zone:1592913957.1986542

2020-06-23 23:11:13,905 [salt.loaded.int.fileserver.roots:180 ][WARNING ][24993] Skipped invalid cache mtime entry in /var/cache/salt/master/roots/mtime_map: /srv/salt/dns/zone/3333:4444.zone:1592913957.1986542

The problem is pretty easy to spot, and I think also pretty easy to fix. The issue is on line 170 in roots.py (version 3001):

file_path, mtime = line.replace("\n", "").split(":", 1)

When a file path has a colon, the operation barfs because it splits in the wrong place. Just try it on the examples above. The solution is to replace the split method with rsplit or rpartition.

I'm happy to have someone make the change, or also happy to contribute the fix if that's easier (if so, how do I do that? I'm familiar with Python, but not github for pull requests).