diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-19 05:21:44 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-19 05:21:44 +0000 |
commit | 4dc72337aca3a4bf81b37bcea8557ef46636aadc (patch) | |
tree | e5c415e585af9593f2bda72d281fba280eb9c6c4 /lib/puppet/provider/package/apt.rb | |
parent | 973f9d05e8f7e722fc23e274c1be54ff8390abf0 (diff) | |
download | puppet-4dc72337aca3a4bf81b37bcea8557ef46636aadc.tar.gz puppet-4dc72337aca3a4bf81b37bcea8557ef46636aadc.tar.xz puppet-4dc72337aca3a4bf81b37bcea8557ef46636aadc.zip |
Fixing #487. I know use "apt-cache policy", instead of apt-cache showpkg, because it clearly shows which version will be installed. This is basically impossible to test well, so I just added a test that verifies we always get a value back, although I cannot really test that it is the "right" value. Also, I modified the logging of packages so if there is a latest version, you will get the new version number, along with the old, in the log.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2310 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/provider/package/apt.rb')
-rwxr-xr-x | lib/puppet/provider/package/apt.rb | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb index 79a9e5f8e..cf69b4468 100755 --- a/lib/puppet/provider/package/apt.rb +++ b/lib/puppet/provider/package/apt.rb @@ -76,32 +76,13 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg do # What's the latest package version available? def latest - output = aptcache :showpkg, @model[:name] + output = aptcache :policy, @model[:name] - if output =~ /Versions:\s*\n((\n|.)+)^$/ - versions = $1 - available_versions = versions.split(/\n/).collect { |version| - if version =~ /^([^\(]+)\(/ - $1 - else - self.warning "Could not match version '%s'" % version - nil - end - }.reject { |vers| vers.nil? }.sort { |a,b| - versioncmp(a,b) - } - - if available_versions.length == 0 - self.debug "No latest version" - if Puppet[:debug] - print output - end - end - - # Get the latest and greatest version number - return available_versions.pop + if output =~ /\*\*\*\s+(\S+)\s/ + return $1 else - self.err "Could not match string" + self.err "Could not find latest version" + return nil end end |