Zypper: Fix update_cache in checkmode (#20143)

Fixes #20139

Refresh does not support dry-run, so don't run it in check mode.
Also add a test for this case.
This commit is contained in:
Robin Roth 2017-01-11 19:47:16 +01:00 committed by John R Barker
commit 4976429e42
2 changed files with 26 additions and 2 deletions

View file

@ -95,7 +95,7 @@ options:
update_cache:
version_added: "2.2"
description:
- Run the equivalent of C(zypper refresh) before the operation.
- Run the equivalent of C(zypper refresh) before the operation. Disabled in check mode.
required: false
default: "no"
choices: [ "yes", "no" ]
@ -449,7 +449,7 @@ def main():
name = filter(None, name)
# Refresh repositories
if update_cache:
if update_cache and not module.check_mode:
retvals = repo_refresh(module)
if retvals['rc'] != 0: