mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-03 03:42:45 +00:00
Support check mode in pkg5 module. (#23008)
This commit is contained in:
@@ -90,7 +90,8 @@ def main():
|
||||
default=False,
|
||||
aliases=['accept_licences', 'accept'],
|
||||
),
|
||||
)
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
params = module.params
|
||||
@@ -136,6 +137,11 @@ def ensure(module, state, packages, params):
|
||||
},
|
||||
}
|
||||
|
||||
if module.check_mode:
|
||||
dry_run = ['-n']
|
||||
else:
|
||||
dry_run = []
|
||||
|
||||
if params['accept_licenses']:
|
||||
accept_licenses = ['--accept']
|
||||
else:
|
||||
@@ -147,6 +153,7 @@ def ensure(module, state, packages, params):
|
||||
[
|
||||
'pkg', behaviour[state]['subcommand']
|
||||
]
|
||||
+ dry_run
|
||||
+ accept_licenses
|
||||
+ [
|
||||
'-q', '--'
|
||||
|
||||
Reference in New Issue
Block a user