document return values of file module (#69560)

* document return values of file module
* Clarify whether path or dest input is used as dest output in file module

Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
This commit is contained in:
Matthew Davis 2020-06-17 04:45:43 +10:00 committed by GitHub
parent ccf90a62c3
commit 7ef0fd1c08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -206,7 +206,16 @@ EXAMPLES = r'''
'''
RETURN = r'''
dest:
description: Destination file/path, equal to the value passed to I(path)
returned: state=touch, state=hard, state=link
type: str
sample: /path/to/file.txt
path:
description: Destination file/path, equal to the value passed to I(path)
returned: state=absent, state=directory, state=file
type: str
sample: /path/to/file.txt
'''
import errno
@ -608,7 +617,7 @@ def ensure_directory(path, follow, recurse, timestamps):
if prev_state == 'absent':
# Create directory and assign permissions to it
if module.check_mode:
return {'changed': True, 'diff': diff}
return {'path': path, 'changed': True, 'diff': diff}
curpath = ''
try: