From 86e2b11b4948fd595b40684c8c3b5199bce87379 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Fri, 28 Sep 2018 11:51:03 +0200 Subject: [PATCH] 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. Depends-On: https://review.openstack.org/646023 Change-Id: I185116a2701688860fa5ca9f8ef34d6dbecd0174 --- lib/puppet/provider/package/openstack_pip.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/puppet/provider/package/openstack_pip.rb b/lib/puppet/provider/package/openstack_pip.rb index 9ced7a8..c2ac16b 100644 --- a/lib/puppet/provider/package/openstack_pip.rb +++ b/lib/puppet/provider/package/openstack_pip.rb @@ -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|