zypper module no longer working in check_mode: unknown option '--dry-run'

149 views
Skip to first unread message

Johannes Kastl

unread,
Jan 10, 2017, 6:11:12 AM1/10/17
to ansible...@googlegroups.com
Dear all,

the zypper module (and thus the package module) is no longer working
on my openSUSE Leap 42.1 / 42.2 or Tumbleweed machines, since zypper
does not like being called with --dry-run in check_mode:

fatal: [XXX]: FAILED! => {"changed": false, "cmd": ["/usr/bin/zypper",
"--quiet", "--non-interactive", "--xmlout", "refresh", "--dry-run"],
"failed": true, "msg": "Zypper run command failed with return code
2.", "rc": 2, "stderr": "Unbekannte Option'--dry-run'\n", "stdout":
"<?xml version='1.0'?>\n<stream>\n</stream>\n", "stdout_lines":
["<?xml version='1.0'?>", "<stream>", "</stream>"]}

The same task works without flaws when not in check_mode.

I have tested ansible 2.2 on both a linux and OSX machine with the
same result.

The machines in question have the following versions of *zypp* installed:
#########################################
(openSUSE Leap 42.1) > rpm -qa |grep zypp |sort -n
libzypp-15.23.1-16.1.x86_64
PackageKit-backend-zypp-1.0.7-3.5.x86_64
snapper-zypp-plugin-0.2.9.1-3.1.noarch
zypper-1.12.45-16.1.x86_64
zypper-aptitude-1.12.45-16.1.noarch
zypper-log-1.12.45-16.1.noarch
zypp-plugin-python-0.5-4.2.x86_64
#########################################
(openSUSE Leap 42.2) > rpm -qa |grep zypp |sort -n
libzypp-16.3.2-3.1.x86_64
PackageKit-backend-zypp-1.1.3-2.3.x86_64
snapper-zypp-plugin-0.3.3-2.2.noarch
zypper-1.13.14-3.1.x86_64
zypper-aptitude-1.13.14-3.1.noarch
zypper-log-1.13.14-3.1.noarch
zypp-plugin-python-0.5-5.3.x86_64
#########################################

Anyone else having this? I guess this is worth a bug report, so I'll
be off searching for the correct place (if the module authors do not
read this mail by chance...).

Johannes

signature.asc

Jean-Yves LENHOF

unread,
Jan 10, 2017, 6:40:28 AM1/10/17
to ansible...@googlegroups.com
10 janvier 2017 12:12 "Johannes Kastl" <ma...@ojkastl.de> a écrit:
> Dear all,
>
> the zypper module (and thus the package module) is no longer working
> on my openSUSE Leap 42.1 / 42.2 or Tumbleweed machines, since zypper
> does not like being called with --dry-run in check_mode:
>
> fatal: [XXX]: FAILED! => {"changed": false, "cmd": ["/usr/bin/zypper",
> "--quiet", "--non-interactive", "--xmlout", "refresh", "--dry-run"],
> "failed": true, "msg": "Zypper run command failed with return code
> 2.", "rc": 2, "stderr": "Unbekannte Option'--dry-run'\n", "stdout":
> "<?xml version='1.0'?>\n<stream>\n</stream>\n", "stdout_lines":
> ["<?xml version='1.0'?>", "<stream>", "</stream>"]}

Because some part of your error is in German... At a guess, perhaps you should try to
set these variables to ansible.cfg, it saved my life with some other modules (I'm french and some server are in Frenche)

module_lang = C
module_set_locale = True

If it solved your problem, you should open a bug report

Regards,

JYL

Johannes Kastl

unread,
Jan 10, 2017, 6:57:30 AM1/10/17
to ansible...@googlegroups.com
Hi,

thanks for your answer.

On 10.01.17 12:40 Jean-Yves LENHOF wrote:

> Because some part of your error is in German...

This is just because the error messages are displayed in another
locale, but there are still error messages:

fatal: [XXX]: FAILED! => {"changed": false, "cmd": ["/usr/bin/zypper",
"--quiet", "--non-interactive", "--xmlout", "refresh", "--dry-run"],
"failed": true, "msg": "Zypper run command failed with return code
2.", "rc": 2, "stderr": "Unknown option '--dry-run'\n", "stdout":
"<?xml version='1.0'?>\n<stream>\n</stream>\n", "stdout_lines":
["<?xml version='1.0'?>", "<stream>", "</stream>"]}

zypper does not have a --dry-run switch (anymore) apparently.

Johannes

signature.asc

Werner Flamme

unread,
Jan 10, 2017, 8:01:58 AM1/10/17
to ansible...@googlegroups.com
Johannes Kastl [10.01.2017 12:57]:
Johannes,

I do not think so.

On Leap 42.2, I get

---snip---
# rpm -qa '*zypp*' | sort
PackageKit-backend-zypp-1.1.3-2.3.x86_64
etckeeper-zypp-plugin-1.18.5-11.3.x86_64
libzypp-16.3.2-3.1.x86_64
snapper-zypp-plugin-0.3.3-2.2.noarch
zypp-plugin-python-0.5-5.3.x86_64
zypper-1.13.14-3.1.x86_64
zypper-aptitude-1.13.14-3.1.noarch
zypper-log-1.13.14-3.1.noarch
---pins---

Yes, there was a patch for zypper, I think it came in yesterday. The
command I took as sample ("zypper in --dry-run ossec-hids") finished
without errors.

Maybe it helps to patch zypper via "zypper patch" :)

Regards,
Werner

--


Johannes Kastl

unread,
Jan 11, 2017, 10:00:36 AM1/11/17
to ansible...@googlegroups.com
Hi Werner,

On 10.01.17 14:01 Werner Flamme wrote:

> Yes, there was a patch for zypper, I think it came in yesterday. The
> command I took as sample ("zypper in --dry-run ossec-hids") finished
> without errors.

I did some more testing (which I had no time for yesterday).

The problem is the "update_cache" option to the zypper module. If this
is set to yes, then 'zypper refresh' is called before the actual
installation attempt. And 'zypper refresh --dry-run' does not work and
thus throws the error. IN contrast to the actual installation, which
accepts the --dry-run switch.

So for now I changed my task to not refresh the repositories before
installation and the play works.

Where to report this bug?

Johannes

signature.asc

Johannes Kastl

unread,
Jan 11, 2017, 10:28:47 AM1/11/17
to ansible...@googlegroups.com
On 11.01.17 16:00 Johannes Kastl wrote:

> Where to report this bug?

I issued this:
<https://github.com/ansible/ansible/issues/20139>

Johannes


signature.asc
Reply all
Reply to author
Forward
0 new messages