Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
zypper: make XML parseable #20681
For the first package installed from a new repository zypper on (at
The '<' and '>' in 'Key Name' are not escaped so initial package
we can filter it out and recover from the failure. In order to not
git devel HEAD
Thanks for this PR @agx
In my opinion this is an upstream bug with zypper. Did you report it with Suse?
I don't like the solution to mess with the output. I'd rather find a way to suppress the output. Can you get rid of the output by running before the zypper module:
If not maybe there is another way to make sure zypper doesn't show this?
In general we should now probably put a try/except around the xml parsing and at least show a better message.
On Thu, Jan 26, 2017 at 02:07:31AM -0800, Robin Roth wrote: Thanks for this PR @agx In my opinion this is an upstream bug with zypper. Did you report it with Suse? It's not too different from one I raised recently: https://bugzilla.opensuse.org/show_bug.cgi?id=1010712 I don't like the solution to mess with the output. I'd rather find a way to suppress the output. Can you get rid of the output by running before the zypper module: ``` zypper_repository: repo: '*' runrefresh: True auto_import_keys: True ``` If not maybe there is another way to make sure zypper doesn't show this?
Thanks for having a look! While the above could work the zypper version is out there right now so filing bugs only fixes future versions (which is worthwhile) but doesn't help. Also working around in manifests doesn't help. So we have to parse the output (or suppress it via a command line option but I did not find any). I'll keep the fix in our code and let you decide what to do with the patch. Even simple and obvious ansible bugs are far too time consumig to deal with.
On Thu, Jan 26, 2017 at 08:23:41AM -0800, Matt Clay wrote: mattclay commented on this pull request. > def parse_zypper_xml(m, cmd, fail_not_found=True, packages=None): rc, stdout, stderr = m.run_command(cmd, check_rc=False) - dom = parseXML(stdout) + try: + dom = parseXML(stdout) + except Exception as e: Drop the `as e` since it's not used, and is not compatible with python 2.4.
Missed that one in the flake8 output. Thanks.
referenced this pull request
Feb 11, 2017
As discussed before I'd prefer to fix this upstream instead of adding this hack.
To have nicer error output of the issue I opened #21281
Do you have a suggestion how to improve the ansible<->zypper communication in the long term? Is using the xml interface a good idea? It seems somewhat buggy and unused, but maybe most issues are fixed now?
@robinro Don't know if most issues are fixed, but we'll continue to fix the issues arising with the XML interface. Since ansible and SALT are using it, things seem to improve a bit.
There is a libzypp-bindings package offering some python/ruby interface. It uses swig to directly wrap the libzypp classes, or at least some of them. The problem is that it's incomplete, quite lowlevel, sometimes broken and more or less unmaintained.