From 0ce99e391f3551a0a349e1f7a9e27a6479a784d3 Mon Sep 17 00:00:00 2001 From: WAKAYAMA Shirou Date: Tue, 23 Jul 2013 22:14:48 +0900 Subject: [PATCH] fix: if a path is symlink and trying to chmod, OSError Exception will be raised. --- lib/ansible/module_common.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_common.py b/lib/ansible/module_common.py index fad79dd495..1eb7423b99 100644 --- a/lib/ansible/module_common.py +++ b/lib/ansible/module_common.py @@ -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