From 0645921f34ff409a99e176671eceec9f2c66bb60 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Sun, 9 Dec 2012 20:53:05 -0600 Subject: [PATCH] Add multiple version support to apt --- salt/modules/apt.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/salt/modules/apt.py b/salt/modules/apt.py index 3ee495ca15..7bd69f841b 100644 --- a/salt/modules/apt.py +++ b/salt/modules/apt.py @@ -336,11 +336,13 @@ def list_pkgs(regex_string=''): out = __salt__['cmd.run_stdout'](cmd) + # Typical line of output: + # install ok installed zsh 4.3.17-1ubuntu1 for line in out.splitlines(): cols = line.split() if len(cols) and ('install' in cols[0] or 'hold' in cols[0]) and \ 'installed' in cols[2]: - ret[cols[3]] = cols[4] + __salt__['pkg_resource.add_pkg'](ret, cols[3], cols[4]) # If ret is empty at this point, check to see if the package is virtual. # We also need aptitude past this point. @@ -357,6 +359,7 @@ def list_pkgs(regex_string=''): ret[regex_string] = '1' # Setting all 'installed' virtual package # versions to '1' + __salt__['pkg_resource.sort_pkglist'](ret) return ret