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>
(cherry picked from commit 055326be7c)
pull/7095/head
Mathias Chapelain 2022-02-04 19:33:18 +01:00 committed by Guillaume Abrioux
parent 678b868e92
commit d6937a22fa
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)