Support check mode in pkg5 module. (#23008)

pull/25322/head
Peter Oliver 8 years ago committed by René Moser
parent f8a99fd745
commit ea56d18c99

@ -90,7 +90,8 @@ def main():
default=False, default=False,
aliases=['accept_licences', 'accept'], aliases=['accept_licences', 'accept'],
), ),
) ),
supports_check_mode=True,
) )
params = module.params 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']: if params['accept_licenses']:
accept_licenses = ['--accept'] accept_licenses = ['--accept']
else: else:
@ -147,6 +153,7 @@ def ensure(module, state, packages, params):
[ [
'pkg', behaviour[state]['subcommand'] 'pkg', behaviour[state]['subcommand']
] ]
+ dry_run
+ accept_licenses + accept_licenses
+ [ + [
'-q', '--' '-q', '--'

Loading…
Cancel
Save