[debug] Fix openstack_pip provider for pip 18

The output of `pip list --outdated` is different for pip 18. This patch
adjusts the openstack_pip provider to handle old and new versions of
pip.

Change-Id: I185116a2701688860fa5ca9f8ef34d6dbecd0174
This commit is contained in:
Colleen Murphy 2018-09-28 11:51:03 +02:00
parent 6c72d6e883
commit 6d38c1ea85
2 changed files with 17 additions and 11 deletions

View File

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

View File

@ -28,7 +28,7 @@ EOF
it 'should work with no errors' do
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_failures: true, debug: true, trace: true)
end
# This is where latest will be checked
@ -38,17 +38,17 @@ EOF
end
context 'without mirrors' do
#context 'without mirrors' do
before :all do
shell("iptables -D OUTPUT -d pypi.python.org -j DROP")
shell("rm /etc/pip.conf")
end
# before :all do
# shell("iptables -D OUTPUT -d pypi.python.org -j DROP")
# shell("rm /etc/pip.conf")
# end
it 'should be idempotent' do
apply_manifest(pp, catch_changes: true)
end
# it 'should be idempotent' do
# apply_manifest(pp, catch_changes: true)
# end
end
#end
end