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:
		@@ -18,7 +18,9 @@ Puppet::Type.type(:package).provide(:openstack_pip, :parent => :pip) do
 | 
				
			|||||||
  def latest
 | 
					  def latest
 | 
				
			||||||
    outdated = self.class.outdated
 | 
					    outdated = self.class.outdated
 | 
				
			||||||
    if outdated =~ /#{@resource[:name]}/
 | 
					    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
 | 
					    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|
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user