pkg.uptodate: Pass kwargs to pkg.list_upgrades

This resolves an edge case in which the "fromrepo" argument is passed to
the pkg.uptodate state. We pass through the kwargs to pkg.upgrade, but
do not pass the same kwargs to list_upgrades, resulting in inconsistent
results.
This commit is contained in:
Erik Johnson 2016-06-08 16:28:27 -05:00
parent de90b35d2b
commit ea726d11c8

View file

@ -1637,14 +1637,19 @@ def uptodate(name, refresh=False, **kwargs):
ret['comment'] = 'State pkg.uptodate is not available'
return ret
# emerge --update doesn't appear to support repo notation
if 'fromrepo' in kwargs and __grains__['os'] == 'Gentoo':
ret['comment'] = '\'fromrepo\' argument not supported on this platform'
return ret
if isinstance(refresh, bool):
try:
packages = __salt__['pkg.list_upgrades'](refresh=refresh)
packages = __salt__['pkg.list_upgrades'](refresh=refresh, **kwargs)
except Exception as e:
ret['comment'] = str(e)
return ret
else:
ret['comment'] = 'refresh must be a boolean.'
ret['comment'] = 'refresh must be either True or False'
return ret
if not packages: