[PUP-9790] undefined method `pip_version' with pip3 provider Created: 2019/06/21  Updated: 2019/07/03  Resolved: 2019/06/26

Status: Closed
Project: Puppet
Component/s: Types and Providers
Affects Version/s: PUP 6.5.0
Fix Version/s: PUP 5.5.16, PUP 6.0.10, PUP 6.4.3, PUP 6.6.0

Type: Bug Priority: Major
Reporter: Maximilian Philipps Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: regression, resolved-issue-added, type_and_provider
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to PUP-1082 pip provider should handle multiple p... Resolved
Template: PUP Bug Template
Agent OS: Other
Master OS: Other
Team: Night's Watch
Method Found: Needs Assessment
Release Notes: Bug Fix
Release Notes Summary: Fix error introduced in puppet 6.5.0 when running pip provider.
QA Risk Assessment: Needs Assessment

 Description   

Puppet Version: 6.5.0
Puppet Server Version: 6.4.0
OS Name/Version: Debian stretch

After updating puppet-agent to 6.5.0 and the puppet server to 6.4.0 package resources with a pip3 provider throw the following error:

Debug: Prefetching pip3 resources for packageDebug: Executing '/usr/bin/pip3 --version'
Debug: Executing '/usr/bin/pip3 freeze --all'Debug: Puppet::Type::Package::ProviderPip3: Prefetched instance: %{name} via command: %{command}
Debug: Puppet::Type::Package::ProviderPip3: Prefetched instance: %{name} via command: %{command}
Error: Could not get latest version: undefined method `pip_version' for Package[checkdmarc](provider=pip3)(command=default):Puppet::Type::Package::ProviderPip3
Info: Unknown failure using insync_values? on type: Package[checkdmarc] / property: ensure to compare values [:latest] and 4.1.10 Error: /Stage[main]/Main/Node[redacted]/Mail::Dmarc_report[redacted]/Package[checkdmarc]/ensure: change from '4.1.10' to 'latest' failed: Could not get latest version: undefined method `pip_version' for Package[checkdmarc](provider=pip3)(command=default):Puppet::Type::Package::ProviderPip3

The code from the module is just:

package { 'checkdmarc':
 ensure => 'latest'
 , provider => 'pip3'
 , require => Package['python3-pip']
 }

 

$ /usr/bin/pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)

 

 

 



 Comments   
Comment by Josh Cooper [ 2019/06/24 ]

root@azd3qyugalnzusl:~# puppet --version
6.5.0
root@azd3qyugalnzusl:~# cat manifest.pp
package { 'checkdmarc':
 ensure => 'latest'
 , provider => 'pip3'
 , require => Package['python3-pip']
}
 
package { 'python3-pip':
  ensure => latest
}
root@azd3qyugalnzusl:~# puppet apply manifest.pp
Notice: Compiled catalog for azd3qyugalnzusl.delivery.puppetlabs.net in environment production in 0.38 seconds
Notice: /Stage[main]/Main/Package[python3-pip]/ensure: created
Notice: /Stage[main]/Main/Package[checkdmarc]/ensure: created
Notice: Applied catalog in 33.69 seconds
root@azd3qyugalnzusl:~# puppet apply manifest.pp
Notice: Compiled catalog for azd3qyugalnzusl.delivery.puppetlabs.net in environment production in 0.38 seconds
Error: Could not get latest version: undefined method `pip_version' for Package[checkdmarc](provider=pip3)(command=default):Puppet::Type::Package::ProviderPip3
Error: /Stage[main]/Main/Package[checkdmarc]/ensure: change from '4.1.10' to 'latest' failed: Could not get latest version: undefined method `pip_version' for Package[checkdmarc](provider=pip3)(command=default):Puppet::Type::Package::ProviderPip3
Notice: Applied catalog in 2.51 seconds

Comment by Josh Cooper [ 2019/06/24 ]

This is reproducible in 5.5.x also:

root@geptbdpg2wqx9ro:~/puppet# bundle exec puppet --version
5.5.15
root@geptbdpg2wqx9ro:~/puppet# bundle exec puppet apply manifest.pp
Notice: Compiled catalog for geptbdpg2wqx9ro.delivery.puppetlabs.net in environment production in 0.44 seconds
Notice: /Stage[main]/Main/Package[python3-pip]/ensure: created
Notice: /Stage[main]/Main/Package[checkdmarc]/ensure: created
Notice: Applied catalog in 23.79 seconds
root@geptbdpg2wqx9ro:~/puppet# bundle exec puppet apply manifest.pp
Notice: Compiled catalog for geptbdpg2wqx9ro.delivery.puppetlabs.net in environment production in 0.45 seconds
Error: Could not get latest version: undefined method `pip_version' for Package[checkdmarc](provider=pip3)(command=default):Puppet::Type::Package::ProviderPip3
Error: /Stage[main]/Main/Package[checkdmarc]/ensure: change from '4.1.10' to 'latest' failed: Could not get latest version: undefined method `pip_version' for Package[checkdmarc](provider=pip3)(command=default):Puppet::Type::Package::ProviderPip3
Notice: Applied catalog in 2.48 seconds

Comment by Josh Cooper [ 2019/06/24 ]

git bisect:

12d6bd592be53ed3916e5b90491e07a71ea81169 is the first bad commit
commit 12d6bd592be53ed3916e5b90491e07a71ea81169
Author: tkishel <tkishel@gmail.com>
Date:   Wed Apr 3 15:05:03 2019 -0700
 
    (PUP-1082) targetable package command
 
    With this commit, the pip package provider implements a targetable `command`.
 
:040000 040000 4cdce046cae40caf8a5af2141642a5dcf399821a 1a086aa517c99ab41b50d7304352246884b68a51 M	lib
:040000 040000 5a6a79c342317db8156f7491b628424efd0df938 80a3fd706224a9290bc0305c5b925e7ee61e5e48 M	spec

Comment by Josh Cooper [ 2019/06/24 ]

diff --git a/lib/puppet/provider/package/pip.rb b/lib/puppet/provider/package/pip.rb
index ad4af1f532..a5cce507a2 100644
--- a/lib/puppet/provider/package/pip.rb
+++ b/lib/puppet/provider/package/pip.rb
@@ -106,7 +106,7 @@ Puppet::Type.type(:package).provide :pip, :parent => ::Puppet::Provider::Package
     command = resource_or_provider_command
     self.class.validate_command(command)
 
-    command_version = self.pip_version(command)
+    command_version = self.class.pip_version(command)
     if Puppet::Util::Package.versioncmp(command_version, '1.5.4') == -1
       latest_with_old_pip
     else

Comment by Thomas Kishel [ 2019/06/24 ]

Found, fixed, and spec updated: https://github.com/puppetlabs/puppet/pull/7593

Even when I added a receive count to the older/incorrect stub, the test passes?

allow(@provider).to receive(:pip_version).with("/fake/bin/pip").and_return('1.0.1').exactly(99).times

Comment by Josh Cooper [ 2019/06/24 ]

Merged to 5.5.x in https://github.com/puppetlabs/puppet/commit/db96da38e45126e8eeae0a0d68e12479412c0015

Comment by Josh Cooper [ 2019/06/24 ]

The change had to be made in 5.5.x since that's where the original change was made. However, the regression was only released in 6.5.0, so that's the only fix version needed.

Comment by Maximilian Philipps [ 2019/06/28 ]

Josh Cooper: Is there any chance of getting an 6.5.1 release with this fixed?

Comment by Josh Cooper [ 2019/06/28 ]

Maximilian Philipps for various reasons we'll be releasing 6.6.0 early next week

Comment by Maximilian Philipps [ 2019/06/30 ]

Alright, looking forward to it.

Generated at Mon Sep 23 07:10:43 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.