mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Make newly-added repo available to pkg states
If a package is added using a pkgrepo.managed state, and a pkg.installed state needs access to this newly-added repo, it will not be able to find the package since the pkg.refresh_db happens in the call to pkg.install (just prior to the package installation), and not when the package targets are initially looked for. This commit adds a pkg.refresh_db before the targets are checked, and then supresses the refresh_db when the package is actually installed (because at that point, it would be redundant).
This commit is contained in:
parent
b0e03b6803
commit
5a952863ce
@ -418,6 +418,11 @@ def installed(
|
||||
if not isinstance(version, basestring) and version is not None:
|
||||
version = str(version)
|
||||
|
||||
if salt.utils.is_true(refresh) or os.path.isfile(rtag):
|
||||
__salt__['pkg.refresh_db']()
|
||||
if os.path.isfile(rtag):
|
||||
os.remove(rtag)
|
||||
|
||||
result = _find_install_targets(name, version, pkgs, sources,
|
||||
fromrepo=fromrepo, **kwargs)
|
||||
try:
|
||||
@ -449,18 +454,6 @@ def installed(
|
||||
'comment': comment}
|
||||
|
||||
comment = []
|
||||
if salt.utils.is_true(refresh) or os.path.isfile(rtag):
|
||||
pkg_ret = __salt__['pkg.install'](name,
|
||||
refresh=True,
|
||||
version=version,
|
||||
fromrepo=fromrepo,
|
||||
skip_verify=skip_verify,
|
||||
pkgs=pkgs,
|
||||
sources=sources,
|
||||
**kwargs)
|
||||
if os.path.isfile(rtag):
|
||||
os.remove(rtag)
|
||||
else:
|
||||
pkg_ret = __salt__['pkg.install'](name,
|
||||
refresh=False,
|
||||
version=version,
|
||||
|
Loading…
Reference in New Issue
Block a user