Skip to content

Commit

Permalink
Add diff support even when not running in check mode
Browse files Browse the repository at this point in the history
  • Loading branch information
c2d7fa committed May 7, 2022
1 parent 9b25b11 commit 48736ea
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions plugins/modules/aur.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ def install_packages(module, packages, use, extra_args, state, skip_pgp_check, i
"""
Install the specified packages
"""
diff = {
'before': '',
'after': '',
}

if local_pkgbuild:
assert use in use_cmd_local_pkgbuild
else:
Expand All @@ -270,10 +275,12 @@ def install_packages(module, packages, use, extra_args, state, skip_pgp_check, i
changed_iter = False

for package in packages:
if state == 'present':
if package_installed(module, package):
rc = 0
continue
already_installed = package_installed(module, package)
if state == 'present' and already_installed:
rc = 0
continue
if module._diff and not already_installed:
diff['after'] += package + "\n"
if use == 'makepkg':
rc, out, err = install_with_makepkg(module, package, extra_args, skip_pgp_check, ignore_arch, local_pkgbuild)
elif local_pkgbuild:
Expand All @@ -292,6 +299,7 @@ def install_packages(module, packages, use, extra_args, state, skip_pgp_check, i
msg=message if not rc else err,
helper=use,
rc=rc,
diff=diff,
)


Expand Down

0 comments on commit 48736ea

Please sign in to comment.