Fix openstack_pip provider to support old pip

Do not split string by hyphen and change regex to match both
formats - new (with hyphen), and old one like
  'pep8 (Current: 1.5.7 Latest: 1.7.0)'

Change-Id: I1eeda1b35ff35dfe8b8b0c6e948616a55f33df25
This commit is contained in:
Alexander Evseev
2016-06-22 13:09:54 +03:00
committed by Jeremy Stanley
parent 89ea98ffb7
commit adf639e859

View File

@@ -20,7 +20,7 @@ Puppet::Type.type(:package).provide(:openstack_pip, :parent => :pip) do
if outdated =~ /#{@resource[:name]}/ if outdated =~ /#{@resource[:name]}/
latest = outdated.split("\n").select { |line| latest = outdated.split("\n").select { |line|
line =~ /#{@resource[:name]}/ line =~ /#{@resource[:name]}/
}.first.split('-')[1].match('Latest: (.*) ')[1] }.first.match('Latest: ([^\s)]*)')[1]
else else
package_info = lazy_pip(['show', @resource[:name]]) package_info = lazy_pip(['show', @resource[:name]])
current = package_info.split("\n").select { |line| current = package_info.split("\n").select { |line|