Jira (PUP-11172) undefined method `[]' for nil:NilClass when handling SemanticPuppet::Dependency::UnsatisfiableGraph

32 views
Skip to first unread message

Phil (Jira)

unread,
Jul 21, 2021, 6:17:02 AM7/21/21
to puppe...@googlegroups.com
Phil created an issue
 
Puppet / Bug PUP-11172
undefined method `[]' for nil:NilClass when handling SemanticPuppet::Dependency::UnsatisfiableGraph
Issue Type: Bug Bug
Affects Versions: PUP 7.8.0
Assignee: Unassigned
Components: Modules
Created: 2021/07/21 3:16 AM
Priority: Normal Normal
Reporter: Phil

Installed Software

  1. rpm -qa |grep -E '(puppet|pdk)'
    puppet7-release-7.0.0-2.el7.noarch
    puppet-agent-7.8.0-1.el7.x86_64
    pdk-2.1.1.0-1.el7.x86_64

 

Steps to reproduce

I am trying to deploy a custom puppet module and I went through:

rake build:pdk

then:

puppet module install ./path/to/OUR_MODULE_NAME-3.0.0.tar.gz --debug

 

Desired Behavior:

Our module with all dependencies be installed

Actual Behavior:

Code exits non-zero trying to call ..constraints[*nil*].first[1]

 

It seems like the error is caused because of a logical issue at:

https://github.com/puppetlabs/puppet/blob/main/lib/puppet/module_tool/applications/installer.rb#L141

With some janky

{{ rescue SemanticPuppet::Dependency::UnsatisfiableGraph => e}}
  unsatisfied = nil
  pp 'e'
  pp e
  pp 'e.respond_to?(:unsatisfied)'
  pp e.respond_to?(:unsatisfied)
  pp 'e.respond_to?(:unsatisfied)'
  pp e.respond_to?(:unsatisfied)

The output below shows that `e` does respond to :unsatisfied, but e.unsatisfied is nil, so when it's called on L167 it fails

 

$ puppet module install ./pkg/OUR_MODULE_NAME-3.0.0.tar.gz --debug
Debug: Runtime environment: puppet_version=7.8.0, ruby_version=2.7.3, run_mode=user, default_encoding=UTF-8
Notice: Preparing to install into /home/vagrant/.puppetlabs/etc/code/modules ...
Debug: Could not find library 'archive/tar/minitar' required to enable feature 'minitar'
Debug: Executing: 'gzip -dc /REDACTED/pkg/OUR_MODULE_NAME-3.0.0.tar.gz | tar xof -'
Debug: Executing: 'find . -type d -exec chmod 755 {} +'
Debug: Executing: 'find . -type f -exec chmod u+rw,g+r,a-st {} +'
Debug: Executing: 'chown -R 1000:1000 .'
Debug: Unpacked local tarball to /home/vagrant/.puppetlabs/opt/puppet/cache/OUR_MODULE_NAME/cache/local-tarball20210721-26316-1jpeh2d
Notice: Downloading from https://forgeapi.puppet.com ...
Debug: Could not find library 'pe_license' required to enable feature 'pe_license'
Debug: Creating new connection for https://forgeapi.puppet.com:443
Debug: Starting connection for https://forgeapi.puppet.com:443
Debug: Using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384
Debug: HTTP GET https://forgeapi.puppet.com/v3/releases?module=cds-puppet&sort_by=version&exclude_fields=readme%2Cchangelog%2Clicense%2Curi%2Cmodule%2Ctags%2Csupported%2Cfile_size%2Cdownloads%2Ccreated_at%2Cupdated_at%2Cdeleted_at returned 200 OK
Debug: Caching connection for https://forgeapi.puppet.com:443
{{Debug: Using cached connection for [https://forgeapi.puppet.com:443

https://forgeapi.puppet.com/]}}<SOME OUTPUT OMITTED>

Debug: Caching connection for https://forgeapi.puppet.com:443
Debug: Using cached connection for https://forgeapi.puppet.com:443
Debug: HTTP GET https://forgeapi.puppet.com/v3/releases?module=thias-postfix&sort_by=version&exclude_fields=readme%2Cchangelog%2Clicense%2Curi%2Cmodule%2Ctags%2Csupported%2Cfile_size%2Cdownloads%2Ccreated_at%2Cupdated_at%2Cdeleted_at returned 200 OK
Debug: Caching connection for https://forgeapi.puppet.com:443
Info: Resolving dependencies ...

"e"
#<SemanticPuppet::Dependency::UnsatisfiableGraph: Could not find satisfying releases for OUR_MODULE_NAME>
"e.unsatisfied"
nil
"e.respond_to?(:unsatisfied)"
true

Error: undefined method `[]' for nil:NilClass
Error: Try 'puppet help module install' for usage

 

 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Phil (Jira)

unread,
Jul 21, 2021, 6:28:07 AM7/21/21
to puppe...@googlegroups.com
Phil updated an issue
Change By: Phil
*Installed Software*

# rpm -qa |grep -E '(puppet|pdk)'
puppet7-release-7.0.0-2.el7.noarch
puppet-agent-7.8.0-1.el7.x86_64
pdk-2.1.1.0-1.el7.x86_64

 

*Steps to reproduce*


I am trying to deploy a custom puppet module and I went through:

rake build:pdk

then:

puppet module install ./path/to/OUR_MODULE_NAME-3.0.0.tar.gz --debug

 

*Desired Behavior:*


Our module with all dependencies be installed

*Actual Behavior:*


Code exits non-zero trying to call ..constraints[*nil*].first[1]

 

It seems like the error is caused because of a logical issue at:

[https://github.com/puppetlabs/puppet/blob/main/lib/puppet/module_tool/applications/installer.rb#L141]

With some janky
{quote}{ \ { rescue SemanticPuppet::Dependency::UnsatisfiableGraph => e}}

{{  unsatisfied = nil}}
{{  pp 'e'}}
{{  pp e}}
{{  pp 'e.respond_to?(:unsatisfied)'}}
{{  pp e.respond_to?(:unsatisfied)}}
{{  pp 'e.respond_to?(:unsatisfied)'}}
{{  pp e.respond_to?(:unsatisfied)}}

{quote}

The output below shows that `e` does respond to :unsatisfied, but e.unsatisfied is nil, so when it's called on L167 it fails

 
{quote}{{$ puppet module install ./pkg/OUR_MODULE_NAME-3.0.0.tar.gz --debug}}

{{Debug: Runtime environment: puppet_version=7.8.0, ruby_version=2.7.3, run_mode=user, default_encoding=UTF-8}}
{{Notice: Preparing to install into /home/vagrant/.puppetlabs/etc/code/modules ...}}
{{Debug: Could not find library 'archive/tar/minitar' required to enable feature 'minitar'}}
{{Debug: Executing: 'gzip -dc /REDACTED/pkg/OUR_MODULE_NAME-3.0.0.tar.gz | tar xof -'}}
{{Debug: Executing: 'find . -type d -exec chmod 755 {} +'}}
{{Debug: Executing: 'find . -type f -exec chmod u+rw,g+r,a-st {} +'}}
{{Debug: Executing: 'chown -R 1000:1000 .'}}
{{Debug: Unpacked local tarball to /home/vagrant/.puppetlabs/opt/puppet/cache/OUR_MODULE_NAME/cache/local-tarball20210721-26316-1jpeh2d}}
{{Notice: Downloading from [ https://forgeapi.puppet.com |https://forgeapi . puppet . com/] . .. }}
{{Debug: Could not find library 'pe_license' required to enable feature 'pe_license'}}
{{Debug: Creating new connection for
[ https://forgeapi.puppet.com:443 |https://forgeapi.puppet.com/] }}
{{Debug: Starting connection for
[ https://forgeapi.puppet.com:443 |https://forgeapi.puppet.com/] }}
{{Debug: Using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384}}
{{Debug: HTTP GET
[ https://forgeapi.puppet.com/v3/releases?module=cds-puppet&sort_by=version&exclude_fields=readme%2Cchangelog%2Clicense%2Curi%2Cmodule%2Ctags%2Csupported%2Cfile_size%2Cdownloads%2Ccreated_at%2Cupdated_at%2Cdeleted_at ] returned 200 OK}}
{{Debug: Caching connection for
[ https://forgeapi.puppet.com:443 |https://forgeapi.puppet.com/] }}

{{Debug: Using cached connection for [https://forgeapi.puppet.com:443

|https://forgeapi.puppet.com/]}}{{<SOME OUTPUT OMITTED>}} |


{{Debug: Caching connection for
[ https://forgeapi.puppet.com:443 |https://forgeapi.puppet.com/] }}

{{Debug: Using cached connection for

{{#<SemanticPuppet::Dependency::UnsatisfiableGraph: Could not find satisfying releases for OUR_MODULE_NAME>}}
{{"e.unsatisfied"}}
{{nil}}
{{"e.respond_to?(:unsatisfied)"}}
{{true}}

{quote}
{quote}{{Error: undefined method `[]' for nil:NilClass}}

{{Error: Try 'puppet help module install' for usage}}

{quote}
 

  *Bonus Info*
* I am only seeing this now because I have finally been able to schedule time on upgrading from puppet 5, and am going straight to 7.

* rake works:
  ** check
** rubocop
** lint
** metadata_lint
** validate

Phil (Jira)

unread,
Jul 21, 2021, 6:29:04 AM7/21/21
to puppe...@googlegroups.com

Gheorghe Popescu (Jira)

unread,
Jul 21, 2021, 9:02:04 AM7/21/21
to puppe...@googlegroups.com
Gheorghe Popescu commented on Bug PUP-11172
 
Re: undefined method `[]' for nil:NilClass when handling SemanticPuppet::Dependency::UnsatisfiableGraph

This might be related to the semantic_puppet changes. It breaks with semnatic_puppet 1.0.4 and 1.0.3 but has a dependency resolution with semantic_puppet 1.0.2
I've created a dummy module with the same dependencies and this is the result:

❯ /opt/puppetlabs/puppet/bin/gem list semantic_puppet
semantic_puppet (1.0.2)
 
 
❯  puppet module install /test-test_sp-0.1.0.tar.gz --debug --trace
...
Info: Resolving dependencies ...
Error: Could not install module 'test-test_sp' (v0.1.0)
The requested version cannot satisfy all dependencies
Use `puppet module install 'test-test_sp' --ignore-dependencies` to install only this modul

Phil (Jira)

unread,
Jul 21, 2021, 10:19:02 PM7/21/21
to puppe...@googlegroups.com
Phil commented on Bug PUP-11172

yay, repro!

I can confirm that a rollback to 1.0.2 fails gracefully:

 

/opt/puppetlabs/puppet/bin/gem install semantic_puppet:1.0.2
 
/opt/puppetlabs/puppet/bin/gem uninstall -i /opt/puppetlabs/puppet/lib/ruby/vendor_gems semantic_puppet:1.0.4
 
/opt/puppetlabs/bin/puppet module install /REDACTED/pkg/OUR_MODULE-3.0.0.tar.gz
 
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Error: Could not install module 'OUR_MODULE' (v3.0.0)
 The requested version cannot satisfy all dependencies
 Use `puppet module install 'OUR_MODULE' --ignore-dependencies` to install only this module

So, I guess my next task is figuring out which of the dependencies is broken .

Is there a way to get puppet to dump the dependency graph and/or to find out which of my dependencies is broken?

 

 

 

Gheorghe Popescu (Jira)

unread,
Jul 22, 2021, 1:50:04 AM7/22/21
to puppe...@googlegroups.com

Is there a way to get puppet to dump the dependency graph and/or to find out which of my dependencies is broken?

This is what we've tried to do with the semantic_puppet changes, make it print the unsatisfiable dependencies. Since we have the list of dependencies that breaks I think we can work on improving the dependencies lookup.

Phil (Jira)

unread,
Jul 22, 2021, 7:26:02 PM7/22/21
to puppe...@googlegroups.com
Phil commented on Bug PUP-11172

Cool, well, since I have sorted out my dependency issue which was triggering this bug I'm no longer blocked, but look forward to one day seeing it fixed .

ta,

Phil

Ciprian Badescu (Jira)

unread,
Jul 27, 2021, 10:25:02 AM7/27/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Jul 27, 2021, 10:26:02 AM7/27/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Jul 27, 2021, 10:26:03 AM7/27/21
to puppe...@googlegroups.com

Beth Glenfield (Jira)

unread,
Jul 27, 2021, 10:26:03 AM7/27/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Jul 28, 2021, 5:16:04 AM7/28/21
to puppe...@googlegroups.com

Gheorghe Popescu (Jira)

unread,
Jul 28, 2021, 6:50:04 AM7/28/21
to puppe...@googlegroups.com

Gabriel Nagy (Jira)

unread,
Aug 2, 2021, 4:41:04 AM8/2/21
to puppe...@googlegroups.com

Gheorghe Popescu (Jira)

unread,
Aug 2, 2021, 9:02:06 AM8/2/21
to puppe...@googlegroups.com

Gheorghe Popescu (Jira)

unread,
Aug 2, 2021, 9:03:03 AM8/2/21
to puppe...@googlegroups.com
Gheorghe Popescu updated an issue
Change By: Gheorghe Popescu
Release Notes Summary: `puppet module install` could break in some cases when dependencies could not be resolved. The error cases are now treated and puppet emits an error message in this case.

Josh Cooper (Jira)

unread,
Aug 2, 2021, 11:44:02 AM8/2/21
to puppe...@googlegroups.com

Claire Cadman (Jira)

unread,
Aug 11, 2021, 9:26:02 AM8/11/21
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages