community.general icon indicating copy to clipboard operation
community.general copied to clipboard

[zypper] "Failed to parse zypper xml output: no element found" with transactional-update

Open grisu48 opened this issue 2 years ago • 6 comments

Summary

The community.general.zypper module fails to run on transactional system, if there are not all updates installed:

e.g.

TASK [skeleton : Ensure all updates are installed] ************************************************************************************************************************
fatal: [microos]: FAILED! => {"changed": false, "cmd": ["/sbin/transactional-update", "--continue", "--drop-if-no-change", "--quiet", "run", "/usr/bin/zypper", "--quiet", "--non-interactive", "--xmlout", "refresh"], "msg": "Failed to parse zypper xml output: no element found: line 1, column 0", "rc": 0, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}

The corresponding task should just install all updates:

- name: Ensure all updates are installed
  community.general.zypper:
    update_cache: yes
    name: '*'
    state: latest

I've assembled the corresponding transactional-update command and it runs successfully but with no output:

microos:~ # /sbin/transactional-update --continue --drop-if-no-change --quiet run /usr/bin/zypper --quiet --non-interactive --xmlout refresh
microos:~ # echo $?
0

Issue Type

Bug Report

Component Name

zypper

Ansible Version

$ ansible --version
ansible 2.9.27
  config file = /home/phoenix/.ansible.cfg
  configured module search path = ['/home/phoenix/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.10.5 (main, Jun 06 2022, 22:34:44) [GCC]

Community.general Version

$ ansible-galaxy collection list community.general
usage: ansible-galaxy collection [-h] COLLECTION_ACTION ...
ansible-galaxy collection: error: argument COLLECTION_ACTION: invalid choice: 'list' (choose from 'init', 'build', 'publish', 'install')

Not sure what to expect here.

Configuration

$ ansible-config dump --only-changed
ANSIBLE_NOCOWS(env: ANSIBLE_NOCOWS) = True
ANSIBLE_PIPELINING(/home/phoenix/.ansible.cfg) = True

OS / Environment

openSUSE Tumbleweed

Steps to Reproduce

  • Setup e.g. a MicroOS VM with pending updates
  • Run a zypper task (e.g. update the system):
- name: Ensure all updates are installed
  community.general.zypper:
    update_cache: yes
    name: '*'
    state: latest

Expected Results

Update the system

Actual Results

TASK [Gathering Facts] ****************************************************************************************************************************************************
ok: [microos]

TASK [skeleton : Ensure all updates are installed] ************************************************************************************************************************
fatal: [microos]: FAILED! => {"changed": false, "cmd": ["/sbin/transactional-update", "--continue", "--drop-if-no-change", "--quiet", "run", "/usr/bin/zypper", "--quiet", "--non-interactive", "--xmlout", "refresh"], "msg": "Failed to parse zypper xml output: no element found: line 1, column 0", "rc": 0, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}


Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

grisu48 avatar Jun 20 '22 11:06 grisu48

Files identified in the description: None

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Jun 20 '22 11:06 ansibullbot

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Jun 20 '22 11:06 ansibullbot

cc @AnderEnder @alxgu @andytom @commel @dcermak @evrardjp @lrupp @sealor @toabctl click here for bot help

ansibullbot avatar Jun 20 '22 11:06 ansibullbot

Had this happen to me too and almost opened an issue. Turned out it was a bug in transactional-update.

To solve, simply run transactional-upgrade and reboot. It should work after that.

MaxiMii05 avatar Jun 25 '22 20:06 MaxiMii05

How is this a bug in transactional-update? What does transactional-update do wrong? I'm asking here,I didn't see an issue on that side when I check - I remember that the output of the transactional-update command executed by ansible looks sane to me, but I would need to have a closer look to verify again.

The issue occurs every time when there are pending updates, and the plugin itself cannot be used to install updates for some time already.

grisu48 avatar Jun 26 '22 08:06 grisu48

Seems like I'd have to test the module again. When I encountered the same error recently, transactional-update indeed didn't output anything with the --quiet option. An update fixed that.

I assumed that was the same problem as you're seeing now but it's possible that these are different things after all.

MaxiMii05 avatar Jun 26 '22 09:06 MaxiMii05

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Nov 09 '22 10:11 ansibullbot