Closed joejulian closed 8 years ago
@joejulian i'm having a hard time replicating this:
sls file:
mypkgs:
pkg.latest:
- pkgs:
- docker-engine
- vivaldi-snapshot
local:
----------
ID: mypkgs
Function: pkg.latest
Result: True
Comment: The following packages were successfully installed/upgraded: vivaldi-snapshot The following packages were already up-to-date: docker-engine
Started: 12:07:33.031168
Duration: 86660.927 ms
Changes:
----------
vivaldi-snapshot:
----------
new:
1.3.551.37-1
old:
1.3.551.28-1
Summary for local
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
It does seem like in your PR that you note you are working on a fix so if you see where the issue is thats great. I'll label as a bug and it might be a system side issue, because it seems to be workign for me on 2016.3.2.
@Ch3LL Now run it again. You successfully upgraded a package. Upgrading no packages seems to be where the bug is.
This is caused by incorrect behavior of the pkg.latest_version
function. It is supposed to return an empty string for packages which do not have an upgrade available (or for which there is no match in the package database).
This is fixed in https://github.com/saltstack/salt/pull/35880.
I'll just use a for loop.
Uh, for what?
{% for pkg in pkgs %}...
Yeah, we cleared it up via email. Unfortunately requisites check for either the name declaration or the ID declaration. It may be possible to alter the requisite system to pay attention to the sources
or pkgs
param when the requisite type is pkg
, though.
This is caused by incorrect behavior of the
pkg.latest_version
function. It is supposed to return an empty string for packages which do not have an upgrade available (or for which there is no match in the package database).This is fixed in #35880.
This seems to be an issue with mac_brew_pkg's implementation as well: https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.mac_brew_pkg.html#salt.modules.mac_brew_pkg.latest_version
bash-3.2$ salt-ssh -l info 'ci-example' state.sls_id latest_packages ci/packages
[INFO ] Loading Saltfile from '/Users/example/mac-example/Saltfile'
[INFO ] Caching directory '_modules/' for environment 'base'
[INFO ] Caching directory '_states/' for environment 'base'
[INFO ] Caching directory '_grains/' for environment 'base'
[INFO ] Caching directory '_renderers/' for environment 'base'
[INFO ] Caching directory '_returners/' for environment 'base'
[INFO ] Caching directory '_output/' for environment 'base'
[INFO ] Caching directory '_utils/' for environment 'base'
ci-example:
----------
ID: latest_packages
Function: pkg.latest
Result: False
Comment: Package ruby-build failed to update.
Started: 14:59:14.391136
Duration: 6462.049 ms
Changes:
Summary for ci-example
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 6.462 s
bash-3.2$ salt-ssh -l info 'ci*-example' pkg.latest_version ruby-build
[INFO ] Loading Saltfile from '/Users/example/mac-example/Saltfile'
ci-example
20230512
bash-3.2$
Description of Issue/Question
With multiple packages, pkg.latest fails if the latest packages are already installed:
Fails in Centos 7 also.
Versions Report