issue #477: target.file_exists() wrapper.

os.path.exists physical module name varies across major Python versions.
issue510
David Wilson 5 years ago
parent 8f5b65f7ec
commit 97f3cfe4f4

@ -155,7 +155,7 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
"""
LOG.debug('_remote_file_exists(%r)', path)
return self._connection.get_chain().call(
os.path.exists,
ansible_mitogen.target.file_exists,
mitogen.utils.cast(path)
)

@ -752,3 +752,12 @@ def set_file_mode(path, spec, fd=None):
os.fchmod(fd, new_mode)
else:
os.chmod(path, new_mode)
def file_exists(path):
"""
Return :data:`True` if `path` exists. This is a wrapper function over
:func:`os.path.exists`, since its implementation module varies across
Python versions.
"""
return os.path.exists(path)

Loading…
Cancel
Save