Skip to content

Commit

Permalink
[make] Provide built command in the module output
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cjeanner committed Mar 9, 2023
1 parent 6d003ca commit 87e387b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/6160-add-command-make-output.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- make - add ``command`` return value to the module output (https://github.com/ansible-collections/community.general/pull/6160).
8 changes: 8 additions & 0 deletions plugins/modules/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
- The value of the module parameter I(chdir).
type: str
returned: success
command:
description:
- The command built and executed by the module
type: str
returned: success
version_added: 6.5.0
file:
description:
- The value of the module parameter I(file).
Expand All @@ -112,6 +118,7 @@
'''

from ansible.module_utils.six import iteritems
from ansible.module_utils.six.moves import shlex_quote
from ansible.module_utils.basic import AnsibleModule


Expand Down Expand Up @@ -218,6 +225,7 @@ def main():
chdir=module.params['chdir'],
file=module.params['file'],
jobs=module.params['jobs'],
command=' '.join([shlex_quote(part) for part in base_command]),
)


Expand Down

0 comments on commit 87e387b

Please sign in to comment.