Don't aggregate both name/pkgs and sources in pkg states

Doing so will cause problems trying to install as Salt does not support
installing from both binary packages and repository packages in the same
call to pkg.install.
This commit is contained in:
Erik Johnson 2017-03-23 11:23:02 -05:00
parent c59ae9a82c
commit 62d76f50fc

View File

@ -2394,6 +2394,7 @@ def mod_aggregate(low, chunks, running):
low chunks and merges them into a single pkgs ref in the present low data
'''
pkgs = []
pkg_type = None
agg_enabled = [
'installed',
'latest',
@ -2413,18 +2414,31 @@ def mod_aggregate(low, chunks, running):
# Check for the same function
if chunk.get('fun') != low.get('fun'):
continue
# Pull out the pkg names!
if 'pkgs' in chunk:
pkgs.extend(chunk['pkgs'])
chunk['__agg__'] = True
elif 'name' in chunk:
pkgs.append(chunk['name'])
chunk['__agg__'] = True
if pkgs:
if 'pkgs' in low:
low['pkgs'].extend(pkgs)
# Check first if 'sources' was passed so we don't aggregate pkgs
# and sources together.
if 'sources' in chunk:
if pkg_type is None:
pkg_type = 'sources'
if pkg_type == 'sources':
pkgs.extend(chunk['sources'])
chunk['__agg__'] = True
else:
if pkg_type is None:
pkg_type = 'pkgs'
if pkg_type == 'pkgs':
# Pull out the pkg names!
if 'pkgs' in chunk:
pkgs.extend(chunk['pkgs'])
chunk['__agg__'] = True
elif 'name' in chunk:
pkgs.append(chunk['name'])
chunk['__agg__'] = True
if pkg_type is not None and pkgs:
if pkg_type in low:
low[pkg_type].extend(pkgs)
else:
low['pkgs'] = pkgs
low[pkg_type] = pkgs
return low