Fix for atomic_replace patch if file does not yet exist

pull/1648/head
Michael DeHaan 12 years ago
parent 7a8009f979
commit 8b50ad7e85

@ -596,6 +596,7 @@ class AnsibleModule(object):
def atomic_replace(self, src, dest):
'''atomically replace dest with src, copying attributes from dest'''
if os.path.exists(dest):
st = os.stat(dest)
os.chmod(src, st.st_mode & 07777)
try:
@ -608,7 +609,6 @@ class AnsibleModule(object):
self.set_context_if_different(src, context, False)
os.rename(src, dest)
# == END DYNAMICALLY INSERTED CODE ===
"""

Loading…
Cancel
Save