Jira (PUP-8986) Puppet agent crashes because of bug in pip provider

19 views
Skip to first unread message

Felix Sperling (JIRA)

unread,
Jul 6, 2018, 8:15:03 AM7/6/18
to puppe...@googlegroups.com
Felix Sperling created an issue
 
Puppet / Bug PUP-8986
Puppet agent crashes because of bug in pip provider
Issue Type: Bug Bug
Assignee: Unassigned
Components: Types and Providers
Created: 2018/07/06 5:14 AM
Priority: Normal Normal
Reporter: Felix Sperling

Puppet Version: 4.8.2
OS Name/Version: Debian 8.10

 

When trying to install a package with the pip provider

puppet agent -t fails with

Info: Using configured environment 'xxx'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for myhost.com
Info: Applying configuration version '123213'
Error: Failed to apply catalog: undefined method `[]' for nil:NilClass
 

with --trace it points to:

 

Error: Failed to apply catalog: undefined method `[]' for nil:NilClass
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/pip.rb:64:in `block (2 levels) in pip_version'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/pip.rb:63:in `each'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/pip.rb:63:in `collect'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/pip.rb:63:in `block in pip_version'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/execution.rb:81:in `block (2 levels) in execpipe'
/opt/puppetlabs/puppet/lib/ruby/2.1.0/open-uri.rb:36:in `open'
/opt/puppetlabs/puppet/lib/ruby/2.1.0/open-uri.rb:36:in `open'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/execution.rb:80:in `block in execpipe'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:128:in `withenv'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/execution.rb:79:in `execpipe'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider.rb:117:in `execpipe'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/pip.rb:62:in `pip_version'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/pip.rb:43:in `instances'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package.rb:4:in `prefetch'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:323:in `prefetch'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:223:in `prefetch_if_necessary'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:107:in `block in evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:116:in `call'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:116:in `traverse'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:154:in `evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:222:in `block in apply'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:155:in `with_destination'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/report.rb:142:in `as_logging_destination'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:221:in `apply'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:171:in `block in apply_catalog'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:223:in `block in benchmark'
 

The code is:

1  def self.pip_version
2    pip_cmd = self.pip_cmd
3    return nil unless pip_cmd    execpipe [pip_cmd, '--version'] do |process|
5      process.collect do |line|
6        return line.strip.match(/^pip (\d+\.\d+\.?\d*).*$/)[1]
7      end
8    end
9  end

Line 6 fails when "pip --version" returns other information:

# pip --version
/usr/local/lib/python2.7/dist-packages/urllib3/contrib/socks.py:37: DependencyWarning: SOCKS support in urllib3 requires the installation of optional dependencies: specifically, PySocks.  For more information, see https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies
  DependencyWarning
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)

Because then there is no match, it returns null and using [1] on null obviously fails.

Installing python-pysocks removes the warning and fixes the puppet run.

Desired Behavior:

The pip_version function should be able to handle additional output. Either by checking if there is a match or by filtering out stderr.

 

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Josh Cooper (JIRA)

unread,
Jul 12, 2018, 4:29:02 PM7/12/18
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Jul 12, 2018, 4:33:02 PM7/12/18
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-8986
 
Re: Puppet agent crashes because of bug in pip provider

Is the DependencyWarning emitted on stderr? Or is it interleaved with the expected pip 1.5.6 ... on stdout?

Felix Sperling (JIRA)

unread,
Jul 16, 2018, 4:30:02 AM7/16/18
to puppe...@googlegroups.com

Yes, the warning is on stderr.

 

$ pip --version
/usr/local/lib/python2.7/dist-packages/urllib3/contrib/socks.py:37: DependencyWarning: SOCKS support in urllib3 requires the installation of optional dependencies: specifically, PySocks. For more information, see https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies
 DependencyWarning
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)
$ pip --version 2> /dev/null
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)

Branan Riley (JIRA)

unread,
Jul 23, 2018, 1:58:03 PM7/23/18
to puppe...@googlegroups.com
Branan Riley updated an issue
 
Change By: Branan Riley
Labels: Easy linux package pip type_and_provider

Josh Cooper (JIRA)

unread,
Oct 1, 2019, 12:22:03 AM10/1/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Team: Platform OS Coremunity

Josh Cooper (JIRA)

unread,
Oct 1, 2019, 12:22:03 AM10/1/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Oct 1, 2019, 12:22:04 AM10/1/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Oct 1, 2019, 1:35:08 PM10/1/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
*Puppet Version: 4.8.2*
*OS Name/Version: Debian 8.10*


 

When trying to install a package with the pip provider

puppet agent -t fails with
{code:java}

Info: Using configured environment 'xxx'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for myhost.com
Info: Applying configuration version '123213'
Error: Failed to apply catalog: undefined method `[]' for nil:NilClass
 
{code}

with --trace it points to:

 
{code:java}
{code}
The code is:
{code:java}

1  def self.pip_version
2    pip_cmd = self.pip_cmd
3    return nil unless pip_cmd

4
    execpipe [pip_cmd, '--version'] do |process|

5      process.collect do |line|
6        return line.strip.match(/^pip (\d+\.\d+\.?\d*).*$/)[1]
7      end
8    end
9  end

{code}

Line 6 fails when "pip --version" returns other information:
{code:java}
# pip --version

/usr/local/lib/python2.7/dist-packages/urllib3/contrib/socks.py:37: DependencyWarning: SOCKS support in urllib3 requires the installation of optional dependencies: specifically, PySocks.  For more information, see https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies
  DependencyWarning
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)
{code}

Because then there is no match, it returns null and using [1] on null obviously fails.

Installing python-pysocks removes the warning and fixes the puppet run.


*Desired Behavior:*


The pip_version function should be able to handle additional output. Either by checking if there is a match or by filtering out stderr.

 

Josh Cooper (JIRA)

unread,
Oct 1, 2019, 2:11:02 PM10/1/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 6.4.z
Fix Version/s: PUP 5.5.z

Josh Cooper (JIRA)

unread,
Oct 1, 2019, 2:12:02 PM10/1/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Platform Core KANBAN
Reply all
Reply to author
Forward
0 new messages