mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #9518 from techhat/filemod
Wrap os.lstat in a try/except block
This commit is contained in:
commit
210de9e119
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user