summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Evseev <aevseev@mirantis.com>2016-06-22 15:53:48 +0300
committerAlexander Evseev <aevseev@mirantis.com>2016-06-22 16:01:10 +0300
commit89ea98ffb7dea3720c064f0eed45bcecaa68b699 (patch)
treeb9438c1c612e40e2abeb4a05db60d19a4f6acbc5
parent0c66a45f2ea97630a6a915758afcead328b9f248 (diff)
Fix search of latest package version
In case, when there is more than one obsoleted package, incorrect package version is chosen. For example: /usr/local/bin/pip --version pip 8.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7) /usr/local/bin/pip list --obsolete alabaster (0.7.6) - Latest: 0.7.8 [wheel] Babel (1.3) - Latest: 2.3.4 [wheel] ... tox (1.6.0) - Latest: 2.3.1 [wheel] ... Puppet output: Debug: Executing '/usr/local/bin/pip list --outdated' Debug: /Stage[main]/Jenkins::Slave/Package[tox]/ensure: tox "1.6.0" is installed, latest is "0.7.8" Debug: Executing '/usr/local/bin/pip install -q --upgrade tox' Notice: /Stage[main]/Jenkins::Slave/Package[tox]/ensure: ensure changed '1.6.0' to '0.7.8' Change-Id: Ia46c10ef4220be47e34c08cfd2be69e8c349f73d
Notes
Notes (review): Code-Review+2: Spencer Krum <nibz@spencerkrum.com> Code-Review+1: K Jonathan Harker <code@gentlydownthe.net> Code-Review+2: yolanda.robla <yroblamo@redhat.com> Code-Review+2: Jeremy Stanley <fungi@yuggoth.org> Workflow+1: Jeremy Stanley <fungi@yuggoth.org> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 28 Jun 2016 17:01:19 +0000 Reviewed-on: https://review.openstack.org/332793 Project: openstack-infra/puppet-pip Branch: refs/heads/master
-rw-r--r--lib/puppet/provider/package/openstack_pip.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/puppet/provider/package/openstack_pip.rb b/lib/puppet/provider/package/openstack_pip.rb
index 105f838..ebbd884 100644
--- a/lib/puppet/provider/package/openstack_pip.rb
+++ b/lib/puppet/provider/package/openstack_pip.rb
@@ -18,7 +18,9 @@ Puppet::Type.type(:package).provide(:openstack_pip, :parent => :pip) do
18 def latest 18 def latest
19 outdated = self.class.outdated 19 outdated = self.class.outdated
20 if outdated =~ /#{@resource[:name]}/ 20 if outdated =~ /#{@resource[:name]}/
21 latest = outdated.split('-')[1].match('Latest: (.*) ')[1] 21 latest = outdated.split("\n").select { |line|
22 line =~ /#{@resource[:name]}/
23 }.first.split('-')[1].match('Latest: (.*) ')[1]
22 else 24 else
23 package_info = lazy_pip(['show', @resource[:name]]) 25 package_info = lazy_pip(['show', @resource[:name]])
24 current = package_info.split("\n").select { |line| 26 current = package_info.split("\n").select { |line|