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

zypper: support automatic removal of orphaned dependencies (#4195)

* zypper: support automatic removal of orphaned dependencies

* zypper: support automatic removal of orphaned dependencies

  - Add support for --clean-deps option during package removal, which
    will clean up packages that were only installed as dependencies
    of the package being removed.

* Update changelogs/fragments/4192-zypper-add-clean-deps.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/packaging/os/zypper.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/packaging/os/zypper.py

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Jeff Mahoney 2022-02-28 13:29:34 -05:00 committed by GitHub
parent 14ef334754
commit 9a34e97702
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- zypper - add support for ``--clean-deps`` option to remove packages that depend on a package being removed (https://github.com/ansible-collections/community.general/pull/4195).

View file

@ -128,6 +128,13 @@ options:
description:
- Adds C(--replacefiles) option to I(zypper) install/update command.
version_added: '0.2.0'
clean_deps:
type: bool
required: false
default: false
description:
- Adds C(--clean-deps) option to I(zypper) remove command.
version_added: '4.6.0'
notes:
- When used with a `loop:` each package will be processed individually,
it is much more efficient to pass the list directly to the `name` option.
@ -368,6 +375,9 @@ def get_cmd(m, subcommand):
cmd.append('--oldpackage')
if m.params['replacefiles']:
cmd.append('--replacefiles')
if subcommand == 'remove':
if m.params['clean_deps']:
cmd.append('--clean-deps')
if subcommand == 'dist-upgrade' and m.params['allow_vendor_change']:
cmd.append('--allow-vendor-change')
if m.params['extra_args']:
@ -518,7 +528,8 @@ def main():
oldpackage=dict(required=False, default=False, type='bool'),
extra_args=dict(required=False, default=None),
allow_vendor_change=dict(required=False, default=False, type='bool'),
replacefiles=dict(required=False, default=False, type='bool')
replacefiles=dict(required=False, default=False, type='bool'),
clean_deps=dict(required=False, default=False, type='bool'),
),
supports_check_mode=True
)