Fix OSError when roots file hash hasn't been built

When the fileserver updates, if no files have been served up then there
will be no hash file. Silently handle the exception to keep it out of
the log.
This commit is contained in:
Erik Johnson 2013-08-23 11:46:45 -06:00
parent 89056038a0
commit 46d58dc9ae

View File

@ -75,11 +75,20 @@ def serve_file(load, fnd):
ret['data'] = data
return ret
def update():
'''
When we are asked to update (regular interval) lets reap the cache
'''
salt.fileserver.reap_fileserver_cache_dir(os.path.join(__opts__['cachedir'], 'roots/hash'), find_file)
try:
salt.fileserver.reap_fileserver_cache_dir(
os.path.join(__opts__['cachedir'], 'roots/hash'),
find_file
)
except os.error:
# Hash file won't exist if no files have yet been served up
pass
def file_hash(load, fnd):
'''
@ -125,6 +134,7 @@ def file_hash(load, fnd):
return ret
def file_list(load):
'''
Return a list of all files on the file server in a specified