From ea56d18c999d3f4e7f7738cf5ab7aad0a0d82387 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Thu, 1 Jun 2017 22:59:07 +0100 Subject: [PATCH] Support check mode in pkg5 module. (#23008) --- lib/ansible/modules/packaging/os/pkg5.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/packaging/os/pkg5.py b/lib/ansible/modules/packaging/os/pkg5.py index 37ca59d9e11..0aa3b4d836a 100644 --- a/lib/ansible/modules/packaging/os/pkg5.py +++ b/lib/ansible/modules/packaging/os/pkg5.py @@ -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', '--'