mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Only run refresh_db once per salt run
As presently contstructed, pkg.refresh_db is run for every call of every pkg.installed and pkg.latest state, and the refresh param for these states is ignored. This commit fixes it so that the rtag isn't created for every call, and that a pkg.refresh_db is only done when refresh == True and the rtag exists. After the install is run, the rtag is removed, keeping pkg.refresh_db from being run in subsequent pkg states within the same state.sls or state.highstate.
This commit is contained in:
parent
92457ae21a
commit
439c736e32
@ -342,8 +342,6 @@ def installed(
|
||||
- baz: ftp://someothersite.org/baz.rpm
|
||||
- qux: /minion/path/to/qux.rpm
|
||||
'''
|
||||
rtag = __gen_rtag()
|
||||
|
||||
if not isinstance(version, basestring) and version is not None:
|
||||
version = str(version)
|
||||
|
||||
@ -375,7 +373,7 @@ def installed(
|
||||
'comment': comment}
|
||||
|
||||
comment = []
|
||||
if refresh or os.path.isfile(rtag):
|
||||
if salt.utils.is_true(refresh) and os.path.isfile(rtag):
|
||||
pkg_ret = __salt__['pkg.install'](name,
|
||||
refresh=True,
|
||||
version=version,
|
||||
@ -494,8 +492,6 @@ def latest(
|
||||
- bar
|
||||
- baz
|
||||
'''
|
||||
rtag = __gen_rtag()
|
||||
|
||||
if kwargs.get('sources'):
|
||||
return {'name': name,
|
||||
'changes': {},
|
||||
@ -572,7 +568,7 @@ def latest(
|
||||
# Build updated list of pkgs to exclude non-targeted ones
|
||||
targeted_pkgs = targets.keys() if pkgs else None
|
||||
|
||||
if refresh or os.path.isfile(rtag):
|
||||
if salt.utils.is_true(refresh) and os.path.isfile(rtag):
|
||||
changes = __salt__['pkg.install'](name,
|
||||
refresh=True,
|
||||
fromrepo=fromrepo,
|
||||
|
Loading…
Reference in New Issue
Block a user