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
This commit is contained in:
parent
0c66a45f2e
commit
89ea98ffb7
@ -18,7 +18,9 @@ Puppet::Type.type(:package).provide(:openstack_pip, :parent => :pip) do
|
||||
def latest
|
||||
outdated = self.class.outdated
|
||||
if outdated =~ /#{@resource[:name]}/
|
||||
latest = outdated.split('-')[1].match('Latest: (.*) ')[1]
|
||||
latest = outdated.split("\n").select { |line|
|
||||
line =~ /#{@resource[:name]}/
|
||||
}.first.split('-')[1].match('Latest: (.*) ')[1]
|
||||
else
|
||||
package_info = lazy_pip(['show', @resource[:name]])
|
||||
current = package_info.split("\n").select { |line|
|
||||
|
Loading…
x
Reference in New Issue
Block a user