From 013c4631e3a65035471d85aabd9227c0fa701e10 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 4 May 2015 18:37:38 -0400 Subject: [PATCH 1/2] hack to prevent tempalte/copy errors on vagrant synced folders that report incorrectly errno 26 fixes #9526 --- lib/ansible/module_utils/basic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 54a1a9cfff7..fd0108c98b7 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1356,8 +1356,9 @@ class AnsibleModule(object): # Optimistically try a rename, solves some corner cases and can avoid useless work, throws exception if not atomic. os.rename(src, dest) except (IOError,OSError), e: - # only try workarounds for errno 18 (cross device), 1 (not permitted) and 13 (permission denied) - if e.errno != errno.EPERM and e.errno != errno.EXDEV and e.errno != errno.EACCES: + # only try workarounds for errno 18 (cross device), 1 (not permitted), 13 (permission denied) + # and 26 (text file busy) which happens on vagrant synced folders + if e.errno not in [errno.EPERM, errno.EXDEV, errno.EACCES, errno.ETXTBSY] self.fail_json(msg='Could not replace file: %s to %s: %s' % (src, dest, e)) dest_dir = os.path.dirname(dest) From 483c61414e67a1b6c9f7ace406298cb2db08bf1d Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 4 May 2015 18:42:44 -0400 Subject: [PATCH 2/2] added missing : --- 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 fd0108c98b7..0c42a2315af 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1358,7 +1358,7 @@ class AnsibleModule(object): except (IOError,OSError), e: # only try workarounds for errno 18 (cross device), 1 (not permitted), 13 (permission denied) # and 26 (text file busy) which happens on vagrant synced folders - if e.errno not in [errno.EPERM, errno.EXDEV, errno.EACCES, errno.ETXTBSY] + if e.errno not in [errno.EPERM, errno.EXDEV, errno.EACCES, errno.ETXTBSY]: self.fail_json(msg='Could not replace file: %s to %s: %s' % (src, dest, e)) dest_dir = os.path.dirname(dest)