1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[make] Provide built command in the module output (#6160)

It may happen operator wants to get the built command instead of all the
parameters. This change injects a new entry in the dict output, showing
what command way actually launched.

This patch also takes the opportunity to add missing dots to some
documentation lines.
This commit is contained in:
Cédric Jeanneret 2023-03-14 20:44:08 +01:00 committed by GitHub
parent 3862de3f15
commit a49ad340af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- make - add ``command`` return value to the module output (https://github.com/ansible-collections/community.general/pull/6160).

View file

@ -89,6 +89,12 @@ chdir:
- The value of the module parameter I(chdir). - The value of the module parameter I(chdir).
type: str type: str
returned: success returned: success
command:
description:
- The command built and executed by the module.
type: str
returned: success
version_added: 6.5.0
file: file:
description: description:
- The value of the module parameter I(file). - The value of the module parameter I(file).
@ -96,22 +102,23 @@ file:
returned: success returned: success
jobs: jobs:
description: description:
- The value of the module parameter I(jobs) - The value of the module parameter I(jobs).
type: int type: int
returned: success returned: success
params: params:
description: description:
- The value of the module parameter I(params) - The value of the module parameter I(params).
type: dict type: dict
returned: success returned: success
target: target:
description: description:
- The value of the module parameter I(target) - The value of the module parameter I(target).
type: str type: str
returned: success returned: success
''' '''
from ansible.module_utils.six import iteritems from ansible.module_utils.six import iteritems
from ansible.module_utils.six.moves import shlex_quote
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
@ -218,6 +225,7 @@ def main():
chdir=module.params['chdir'], chdir=module.params['chdir'],
file=module.params['file'], file=module.params['file'],
jobs=module.params['jobs'], jobs=module.params['jobs'],
command=' '.join([shlex_quote(part) for part in base_command]),
) )