Merge pull request #9518 from techhat/filemod

Wrap os.lstat in a try/except block
This commit is contained in:
Thomas S Hatch 2014-01-02 10:53:56 -08:00
commit 210de9e119

View File

@ -1640,9 +1640,13 @@ def lstat(path):
if not os.path.isabs(path):
raise SaltInvocationError('Path to file must be absolute.')
lst = os.lstat(path)
return dict((key, getattr(lst, key)) for key in ('st_atime', 'st_ctime',
'st_gid', 'st_mode', 'st_mtime', 'st_nlink', 'st_size', 'st_uid'))
try:
lst = os.lstat(path)
return dict((key, getattr(lst, key)) for key in ('st_atime', 'st_ctime',
'st_gid', 'st_mode', 'st_mtime', 'st_nlink', 'st_size', 'st_uid'))
except Exception:
return {}
def access(path, mode):