mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-09 20:20:31 -07:00
Simplify the check for flags
and add the defaults again, which I had removed in the previous step, to maintain the behaviour according to the previous documentation
This commit is contained in:
parent
cefb03a21c
commit
48ad95c666
1 changed files with 6 additions and 18 deletions
|
@ -329,10 +329,10 @@ def main():
|
|||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
runrefresh=dict(required=False, default=False, type='bool'),
|
||||
description=dict(required=False),
|
||||
disable_gpg_check=dict(required=False, type='bool'),
|
||||
autorefresh=dict(required=False, type='bool', aliases=['refresh']),
|
||||
disable_gpg_check=dict(required=False, default=False, type='bool'),
|
||||
autorefresh=dict(required=False, default=False, type='bool', aliases=['refresh']),
|
||||
priority=dict(required=False, type='int'),
|
||||
enabled=dict(required=False, type='bool'),
|
||||
enabled=dict(required=False, default=True, type='bool'),
|
||||
overwrite_multiple=dict(required=False, default=False, type='bool'),
|
||||
auto_import_keys=dict(required=False, default=False, type='bool'),
|
||||
),
|
||||
|
@ -440,21 +440,9 @@ def main():
|
|||
|
||||
# override boolean parameters in repodata with provided entries in module.params
|
||||
# in the language that zypper lr -x provides for easier comparison
|
||||
if 'enabled' in module.params:
|
||||
if module.params['enabled'] is not None:
|
||||
repodata['enabled'] = '1'
|
||||
else:
|
||||
repodata['enabled'] = '0'
|
||||
if 'disable_gpg_check' in module.params:
|
||||
if module.params['disable_gpg_check'] is not None:
|
||||
repodata['gpgcheck'] = '0'
|
||||
else:
|
||||
repodata['gpgcheck'] = '1'
|
||||
if 'autorefresh' in module.params:
|
||||
if module.params['autorefresh'] is not None:
|
||||
repodata['autorefresh'] = '1'
|
||||
else:
|
||||
repodata['autorefresh'] = '0'
|
||||
repodata['enabled'] = '1' if module.params['enabled'] else '0'
|
||||
repodata['gpgcheck'] = '0' if module.params['disable_gpg_check'] else '1'
|
||||
repodata['autorefresh'] = '1' if module.params['autorefresh'] else '0'
|
||||
|
||||
exists, mod, old_repos = repo_exists(module, repodata, overwrite_multiple)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue