Merge pull request #35269 from meaksh/checksum-during-zypper-pkg-download-for-2016.3-and-develop

Checksum validation for zypper pkg.download in 2016.3 and develop
This commit is contained in:
Mike Place 2016-08-08 23:45:16 +09:00 committed by GitHub
commit c58bb18624
2 changed files with 5 additions and 1 deletions

View file

@ -1595,14 +1595,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]

View file

@ -387,6 +387,7 @@ class ZypperTestCase(TestCase):
test_out = {
'nmap': {
'path': u'/var/cache/zypp/packages/SLE-12-x86_64-Pool/x86_64/nmap-6.46-1.72.x86_64.rpm',
'repository-alias': u'SLE-12-x86_64-Pool',
'repository-name': u'SLE-12-x86_64-Pool'
}