module_utils/ca_common: Add optional diff argument to exit_module

Add optional `diff` argument defaulting to `{ "before": "", "after": ""}`.

Signed-off-by: Mathias Chapelain <mathias.chapelain@proton.ch>
pull/7052/head
Mathias Chapelain 2022-02-04 19:33:18 +01:00 committed by Guillaume Abrioux
parent 3e5bc30c87
commit 055326be7c
1 changed files with 2 additions and 1 deletions

View File

@ -84,7 +84,7 @@ def exec_command(module, cmd, stdin=None):
return rc, cmd, out, err
def exit_module(module, out, rc, cmd, err, startd, changed=False):
def exit_module(module, out, rc, cmd, err, startd, changed=False, diff=dict(before="", after="")):
endd = datetime.datetime.now()
delta = endd - startd
@ -97,6 +97,7 @@ def exit_module(module, out, rc, cmd, err, startd, changed=False):
stdout=out.rstrip("\r\n"),
stderr=err.rstrip("\r\n"),
changed=changed,
diff=diff
)
module.exit_json(**result)