Add support for gpg-auto-import-keys option to zypper (#10661)

* Add support for gpg-auto-import-keys option to zypper

* Add changelog fragment

* Add missing module argument_spec

* Improving documentation

* Improve changelog fragment
This commit is contained in:
Marc Urben 2025-08-23 18:38:00 +02:00 committed by GitHub
commit 177b385dfb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- zypper - support the ``--gpg-auto-import-keys`` option in zypper (https://github.com/ansible-collections/community.general/issues/10660, https://github.com/ansible-collections/community.general/pull/10661).

View file

@ -82,6 +82,14 @@ options:
required: false required: false
default: false default: false
type: bool type: bool
auto_import_keys:
description:
- Whether to automatically import new repository signing keys. Adds C(--gpg-auto-import-keys) option to I(zypper).
- Is only used when installing.
required: false
default: false
type: bool
version_added: 11.3.0
disable_recommends: disable_recommends:
description: description:
- Corresponds to the C(--no-recommends) option for I(zypper). Default behavior (V(true)) modifies zypper's default behavior; - Corresponds to the C(--no-recommends) option for I(zypper). Default behavior (V(true)) modifies zypper's default behavior;
@ -427,6 +435,8 @@ def get_cmd(m, subcommand):
# add global options before zypper command # add global options before zypper command
if (is_install or is_refresh) and m.params['disable_gpg_check']: if (is_install or is_refresh) and m.params['disable_gpg_check']:
cmd.append('--no-gpg-checks') cmd.append('--no-gpg-checks')
if is_install and m.params['auto_import_keys']:
cmd.append('--gpg-auto-import-keys')
if subcommand == 'search': if subcommand == 'search':
cmd.append('--disable-repositories') cmd.append('--disable-repositories')
@ -609,6 +619,7 @@ def main():
type=dict(default='package', choices=['package', 'patch', 'pattern', 'product', 'srcpackage', 'application']), type=dict(default='package', choices=['package', 'patch', 'pattern', 'product', 'srcpackage', 'application']),
extra_args_precommand=dict(), extra_args_precommand=dict(),
disable_gpg_check=dict(default=False, type='bool'), disable_gpg_check=dict(default=False, type='bool'),
auto_import_keys=dict(default=False, type='bool'),
disable_recommends=dict(default=True, type='bool'), disable_recommends=dict(default=True, type='bool'),
force=dict(default=False, type='bool'), force=dict(default=False, type='bool'),
force_resolution=dict(default=False, type='bool'), force_resolution=dict(default=False, type='bool'),