From a9fcd1d197037387ccefec714b317e8034b396b1 Mon Sep 17 00:00:00 2001 From: dpoon Date: Tue, 2 Jul 2019 08:15:39 -0700 Subject: [PATCH] Handle mode-setting of symlink to RO filesystem (#58564) Fix for https://github.com/ansible/ansible/issues/58562 --- lib/ansible/module_utils/basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 88df2d77d3c..6ff8a389760 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1114,7 +1114,7 @@ class AnsibleModule(object): if underlying_stat.st_mode != new_underlying_stat.st_mode: os.chmod(b_path, stat.S_IMODE(underlying_stat.st_mode)) except OSError as e: - if os.path.islink(b_path) and e.errno == errno.EPERM: # Can't set mode on symbolic links + if os.path.islink(b_path) and e.errno in (errno.EPERM, errno.EROFS): # Can't set mode on symbolic links pass elif e.errno in (errno.ENOENT, errno.ELOOP): # Can't set mode on broken symbolic links pass