Skip to content

Instantly share code, notes, and snippets.

@amontalban
Last active April 5, 2016 18:40
Show Gist options
  • Save amontalban/ca617b5f944144b0ad0a1116e6e7ce4a to your computer and use it in GitHub Desktop.
Save amontalban/ca617b5f944144b0ad0a1116e6e7ce4a to your computer and use it in GitHub Desktop.
Patch for Saltstack #28262
--- a/salt/modules/pkgng.py
+++ b/salt/modules/pkgng.py
@@ -277,15 +277,19 @@ def latest_version(*names, **kwargs):
quiet = False
for name in names:
- cmd = [_pkg(jail, chroot), 'search']
+ cmd = [_pkg(jail, chroot), 'search', '-S', 'name', '-Q', 'version', '-e']
if quiet:
cmd.append('-q')
cmd.append(name)
pkgver = _get_version(
name,
- __salt__['cmd.run'](cmd, python_shell=False, output_loglevel='trace')
+ sorted(
+ __salt__['cmd.run'](cmd, python_shell=False, output_loglevel='trace').splitlines(),
+ reverse=True
+ ).pop(0)
)
+
if pkgver is not None:
installed = pkgs.get(name, [])
if not installed:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment