mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Search the entire CACHE_DIR because storage paths change across versions
This commit is contained in:
parent
92c655b94d
commit
47cb1e9495
@ -19,7 +19,6 @@ from __future__ import absolute_import
|
||||
import contextlib
|
||||
import copy
|
||||
import fnmatch
|
||||
import glob
|
||||
import itertools
|
||||
import logging
|
||||
import os
|
||||
@ -923,9 +922,11 @@ def list_downloaded():
|
||||
CACHE_DIR = os.path.join('/var/cache/', _yum())
|
||||
|
||||
ret = {}
|
||||
for package_path in glob.glob(os.path.join(CACHE_DIR, '*/*/*/packages/*.rpm')):
|
||||
pkg_info = __salt__['lowpkg.bin_pkg_info'](package_path)
|
||||
ret.setdefault(pkg_info['name'], {})[pkg_info['version']] = package_path
|
||||
for root, dirnames, filenames in os.walk(CACHE_DIR):
|
||||
for filename in fnmatch.filter(filenames, '*.rpm'):
|
||||
package_path = os.path.join(root, filename)
|
||||
pkg_info = __salt__['lowpkg.bin_pkg_info'](package_path)
|
||||
ret.setdefault(pkg_info['name'], {})[pkg_info['version']] = package_path
|
||||
return ret
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ Package support for openSUSE via the zypper package manager
|
||||
# Import python libs
|
||||
from __future__ import absolute_import
|
||||
import copy
|
||||
import glob
|
||||
import fnmatch
|
||||
import logging
|
||||
import re
|
||||
import os
|
||||
@ -1794,10 +1794,11 @@ def list_downloaded():
|
||||
CACHE_DIR = '/var/cache/zypp/packages/'
|
||||
|
||||
ret = {}
|
||||
# Zypper storage is repository_tag/arch/package-version.rpm
|
||||
for package_path in glob.glob(os.path.join(CACHE_DIR, '*/*/*.rpm')):
|
||||
pkg_info = __salt__['lowpkg.bin_pkg_info'](package_path)
|
||||
ret.setdefault(pkg_info['name'], {})[pkg_info['version']] = package_path
|
||||
for root, dirnames, filenames in os.walk(CACHE_DIR):
|
||||
for filename in fnmatch.filter(filenames, '*.rpm'):
|
||||
package_path = os.path.join(root, filename)
|
||||
pkg_info = __salt__['lowpkg.bin_pkg_info'](package_path)
|
||||
ret.setdefault(pkg_info['name'], {})[pkg_info['version']] = package_path
|
||||
return ret
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user