From c80528b9aad5305b06a07cadf752a45392d4a147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= Date: Tue, 24 May 2016 11:01:55 +0100 Subject: [PATCH 08/12] checksum validation when zypper pkg.download check the signature of downloaded RPM files bugfix: showing errors when a package download fails using zypper pkg.download Renamed check_sig to checksum and some refactoring simpler rpm.checksum function --- salt/modules/zypper.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py index 92c604e..547d72b 100644 --- a/salt/modules/zypper.py +++ b/salt/modules/zypper.py @@ -1596,14 +1596,17 @@ def download(*packages, **kwargs): pkg_ret = {} for dld_result in __zypper__.xml.call('download', *packages).getElementsByTagName("download-result"): repo = dld_result.getElementsByTagName("repository")[0] + path = dld_result.getElementsByTagName("localfile")[0].getAttribute("path") pkg_info = { 'repository-name': repo.getAttribute('name'), 'repository-alias': repo.getAttribute('alias'), + 'path': path, } key = _get_first_aggregate_text( dld_result.getElementsByTagName('name') ) - pkg_ret[key] = pkg_info + if __salt__['lowpkg.checksum'](pkg_info['path']): + pkg_ret[key] = pkg_info if pkg_ret: failed = [pkg for pkg in packages if pkg not in pkg_ret] -- 2.8.2