mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
pkg.list_upgrades: Ignore "downloading" lines in pacman output
It appears that Antergos distributes a modified version of pacman which adds additional lines while updating its package databases. These are incorrectly interpreted as available upgrades. This commit checks for these lines in the output and skips them.
This commit is contained in:
parent
b2365f553e
commit
0ae8dca2d0
1 changed files with 10 additions and 3 deletions
|
@ -155,10 +155,17 @@ def list_upgrades(refresh=False, root=None, **kwargs): # pylint: disable=W0613
|
|||
out = call['stdout']
|
||||
|
||||
for line in salt.utils.itertools.split(out, '\n'):
|
||||
comps = line.split(' ')
|
||||
if len(comps) != 2:
|
||||
try:
|
||||
pkgname, pkgver = line.split()
|
||||
except ValueError:
|
||||
continue
|
||||
upgrades[comps[0]] = comps[1]
|
||||
if pkgname.lower() == 'downloading' and '.db' in pkgver.lower():
|
||||
# Antergos (and possibly other Arch derivatives) add lines when pkg
|
||||
# metadata is being downloaded. Because these lines, when split,
|
||||
# contain two columns (i.e. 'downloading community.db...'), we will
|
||||
# skip this line to keep it from being interpreted as an upgrade.
|
||||
continue
|
||||
upgrades[pkgname] = pkgver
|
||||
return upgrades
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue