fix: if a path is symlink and trying to chmod, OSError Exception will be raised.

This commit is contained in:
WAKAYAMA Shirou 2013-07-23 22:14:48 +09:00
parent d1effecb2e
commit 0ce99e391f

View file

@ -435,7 +435,9 @@ class AnsibleModule(object):
else:
os.chmod(path, mode)
except OSError, e:
if e.errno == errno.ENOENT: # Can't set mode on broken symbolic links
if os.path.islink(path) and e.errno == errno.EPERM: # Can't set mode on symbolic links
pass
elif e.errno == errno.ENOENT: # Can't set mode on broken symbolic links
pass
else:
raise e