Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `ref' for nil:NilClass on v1.1.0 #149

Closed
mwillbanks opened this issue Jun 30, 2015 · 39 comments
Closed

undefined method `ref' for nil:NilClass on v1.1.0 #149

mwillbanks opened this issue Jun 30, 2015 · 39 comments
Labels
needs-feedback Further information is requested

Comments

@mwillbanks
Copy link

Overview

Whenever I attempt to use the nodejs module in the following way:

    class {
        'nodejs':
            repo_url_suffix        => 'node_0.12',
            legacy_debian_symlinks => true;
    }

The error "undefined method `ref' for nil:NilClass" comes up. This only happens when including this module, I have attempted just about everything given that I cannot get a decent stack trace that actually tells me boo of what is happening. Basically the puppetmaster refuses to supply it because of this.

Modules

/etc/puppet/environments/production/modules
├── puppet-nodejs (v1.1.0)
├── puppetlabs-apache (v1.0.1)
├── puppetlabs-apt (v2.1.0)
├── puppetlabs-concat (v1.2.3)
├── puppetlabs-firewall (v1.6.0)
├── puppetlabs-mysql (v2.2.3)
├── puppetlabs-ntp (v4.0.0)
├── puppetlabs-stdlib (v4.6.0)
├── saz-timezone (v3.0.1)

Environment

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.2 LTS"

Puppet version: 3.8.1
Puppetmaster version: 3.8.1

@juniorsysadmin
Copy link
Member

puppetlabs-apt version?

@mwillbanks
Copy link
Author

@juniorsysadmin latest actually... i'll post some more as there is something very odd, if it comes from puppetmaster it fails, if local puppet agent it's fine. It's absolutely one of the most odd issues i've seen thus far.

@ffrank
Copy link
Contributor

ffrank commented Jul 1, 2015

Can we see the stack trace anyway? :)

@mwillbanks
Copy link
Author

@ffrank would love to provide one if i could actually get one. puppetmaster with trace set to on as well as log level to debug provides no stack trace; if it did I likely would have submitted a PR vs. this ticket.

@mwillbanks
Copy link
Author

Alright, cleared this up...

Rebooted puppetmaster box, basically clean installed and everything is happy once again. Sorry for the noise.

@ffrank
Copy link
Contributor

ffrank commented Jul 1, 2015

Alright.

So was this a 4xx error reported by the master to the agent? In such cases, I think I would try puppet master --trace --compile.

@jpmorris
Copy link

jpmorris commented Jul 4, 2015

Same problem here. Running puppet, vagrant, librarian-puppet.

Puppetfile:

#!/usr/bin/env ruby
forge "https://forgeapi.puppetlabs.com"
mod 'puppetlabs/apt'
mod 'puppet-community/puppet-nodejs',
    :git => '[email protected]:puppet-community/puppet-nodejs.git',
    :ref => '1.1.0'

install with librarian-puppet install

manifest/site.pp:

include nodejs

Vagrantfile:

VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    config.vm.provision "puppet" do |puppet|
        puppet.manifests_path = "manifests"
        puppet.manifest_file  = "site.pp"
        puppet.module_path = ['modules']
        puppet.options = "--verbose --debug --hiera_config /vagrant/hiera.yaml"
    end

    config.vm.hostname = "vagrant.edward.local"
    config.vm.network "forwarded_port", guest: 8080, host: 8042
    config.vm.synced_folder "webroot/", "/vagrant/webroot/", :owner => "www-data"
end

Vagrant up (after vagrant destroy) gives me the error: "Error: undefined method `ref' for nil:NilClass on node vagrant.edward.local". I would provide a stack trace if I knew how. Apt version is 2.1.0 (according to metadata.json). Sorry I did what I could from bothering you all, but I've been waiting for several version trying to fix this to no avail.

@juniorsysadmin
Copy link
Member

I just tested with Puppet 4 on an Ubuntu 14.04 agent:
puppetserver-2.1.1, puppet-agent-1.2.1
puppet-nodejs (v1.1.0)
puppetlabs-apt (v2.1.0)
puppetlabs-stdlib (v4.6.0)

with

node 'ubuntutrusty.domain' {
  class { 'apt':
    update => {
      frequency => 'always',
    },
  }
  class { '::nodejs': }
}

and got no issue. Will see if I can do a 3.8 agent test against a 3.8 master later.

@jpmorris
Copy link

jpmorris commented Jul 5, 2015

Ok I moved to 4.2 (installed the gem was using 3.7 from apt-get), but still same error. All my versions match up with yours (though not sure how to check puppetserver and agent versions). I found out how to get you a stacktrace:

==> default: Debug: Automatically imported apt::key from apt/key into production
==> default: Debug: Adding relationship from Anchor[apt_first] to Class[Apt::Update] with 'before'
==> default: Debug: Adding relationship from Class[Apt::Update] to Anchor[apt_last] with 'before'
==> default: Debug: Adding relationship from Anchor[::nodejs::begin] to             Class[Nodejs::Repo::Nodesource] with 'before'
==> default: Debug: Adding relationship from Class[Nodejs::Repo::Nodesource] to     Class[Nodejs::Install] with 'before'
==> default: Debug: Adding relationship from Class[Nodejs::Install] to Anchor[::nodejs::end] with     'before'
==> default: Debug: Adding relationship from Apt_key[Add key:     9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 from Apt::Source nodesource] to     Anchor[apt_key 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 present] with 'before'
==> default: Error: undefined method `ref' for nil:NilClass on node vagrant.edward.local
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:527:in `block in to_catalog'
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:515:in `each'
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:515:in `to_catalog'
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:402:in `to_resource'
==> default: /usr/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:23:in `compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:116:in `block (2 levels) in compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/profiler/none.rb:6:in `profile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/profiler.rb:31:in `profile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:114:in `block in compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util.rb:161:in `block in benchmark'
==> default: /usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:113:in `compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:46:in `find'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:201:in `find'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:204:in `main'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:146:in `run_command'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `block (2 levels) in run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:470:in `plugin_hook'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `block in run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util.rb:478:in `exit_on_fail'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:137:in `run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:91:in `execute'
==> default: /usr/bin/puppet:4:in `<main>'
==> default: Error: undefined method `ref' for nil:NilClass on node vagrant.edward.local
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:527:in `block in to_catalog'
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:515:in `each'
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:515:in `to_catalog'
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:402:in `to_resource'
==> default: /usr/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:23:in `compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:116:in `block (2 levels) in compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/profiler/none.rb:6:in `profile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/profiler.rb:31:in `profile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:114:in `block in compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util.rb:161:in `block in benchmark'
==> default: /usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:113:in `compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:46:in `find'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:201:in `find'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:204:in `main'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:146:in `run_command'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `block (2 levels) in run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:470:in `plugin_hook'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `block in run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util.rb:478:in `exit_on_fail'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:137:in `run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:91:in `execute'
==> default: /usr/bin/puppet:4:in `<main>'

@juniorsysadmin
Copy link
Member

The mention of Ruby 1.9.1 does not sound good for Puppet 3 or 4. See https://docs.puppetlabs.com/guides/platforms.html

@jpmorris
Copy link

jpmorris commented Jul 8, 2015

I installed ruby 2.1 inside the VM (via PPA) on ubuntu and I get a smilar error:

==> default: Debug: Adding relationship from Apt_key[Add key: 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 from Apt::Source nodesource] to Anchor[apt_key 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 present] with 'before'
==> default: Error: undefined method `ref' for nil:NilClass on node vagrant.edward.local
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:527:in `block in to_catalog'
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:515:in `each'
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:515:in `to_catalog'
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:402:in `to_resource'
==> default: /usr/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:23:in `compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:116:in `block (2 levels) in compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/profiler/none.rb:6:in `profile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/profiler.rb:31:in `profile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:114:in `block in compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util.rb:161:in `block in benchmark'
==> default: /usr/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:113:in `compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:46:in `find'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:201:in `find'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:204:in `main'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:146:in `run_command'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `block (2 levels) in run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:470:in `plugin_hook'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `block in run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util.rb:478:in `exit_on_fail'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:137:in `run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:91:in `execute'
==> default: /usr/bin/puppet:4:in `<main>'
==> default: Error: undefined method `ref' for nil:NilClass on node vagrant.edward.local
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:527:in `block in to_catalog'
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:515:in `each'
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:515:in `to_catalog'
==> default: /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:402:in `to_resource'
==> default: /usr/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:23:in `compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:116:in `block (2 levels) in compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/profiler/none.rb:6:in `profile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/profiler.rb:31:in `profile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:114:in `block in compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util.rb:161:in `block in benchmark'
==> default: /usr/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:113:in `compile'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:46:in `find'
==> default: /usr/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:201:in `find'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:204:in `main'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:146:in `run_command'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `block (2 levels) in run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:470:in `plugin_hook'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `block in run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util.rb:478:in `exit_on_fail'
==> default: /usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:137:in `run'
==> default: /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:91:in `execute'
==> default: /usr/bin/puppet:4:in `<main>

@ddepaoli3
Copy link

Same error of @jpmorris, both with ruby 1.9 and 2.0.0. And with puppet-nodejs v0.8.0 and 1.0
Other info: puppet 3.4.3, ubuntu 14.04 64 bit. I don't install the module, I include it inside another project.

@ffrank
Copy link
Contributor

ffrank commented Jul 23, 2015

Reopening, thanks for the info. Will try and look into it "soon".

@ffrank ffrank reopened this Jul 23, 2015
@hco
Copy link

hco commented Aug 3, 2015

I can reproduce this, and it somehow seems to be related to "contain" in my setup.

@masterzen
Copy link

Just hit this issue too (with puppet 3.5.1).

The generated catalog is malformed: a relationship edge points to nil, the edge source is nodejs::repo::nodesource.

This apparently comes from the contain method that is called in nodejs::repo::nodesource (in my case to the nodejs::repo::nodesource::apt class). Commenting the contain call works (but then there's no containment).

@ffrank
Copy link
Contributor

ffrank commented Aug 7, 2015

Do we have enough evidence to open a Puppet bug for this?

@juniorsysadmin
Copy link
Member

Do we have enough evidence to open a Puppet bug for this?

Could this be due to the fact that contain '::nodejs::repo::nodesource::apt'is enclosed with single quotes rather than contain ::nodejs::repo::nodesource::apt ? I seem to remember some Puppet quirks with quoting and the use of include, and since contain has include-like behviour, maybe it was affected as well.

As an aside I can't remember the reason for using both class and a contain in nodesource.pp.

@ryangraham
Copy link

I just ran into this on trusty with puppet 3.4.3. So I downgraded to puppetlabs-nodejs 0.7.1.

@fr05t1k
Copy link

fr05t1k commented Aug 22, 2015

I got the same problem on 0.8

puppet 3.4.3
puppetlabs-apt at v1.8.0
ruby ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-linux-gnu]

Part of stacktrace:

Debug: importing '/etc/puppet/modules/nodejs/manifests/install.pp' in environment production
Debug: Automatically imported nodejs::install from nodejs/install into production
Debug: importing '/etc/puppet/modules/nodejs/manifests/repo/nodesource.pp' in environment production
Debug: Automatically imported nodejs::repo::nodesource from nodejs/repo/nodesource into production
Debug: importing '/etc/puppet/modules/nodejs/manifests/repo/nodesource/apt.pp' in environment production
Debug: Automatically imported nodejs::repo::nodesource::apt from nodejs/repo/nodesource/apt into production
Debug: importing '/etc/puppet/modules/apt/manifests/source.pp' in environment production
Debug: Automatically imported apt::source from apt/source into production
Debug: Scope(Apt::Source[nodesource]): Retrieving template apt/_header.erb
Debug: template[/etc/puppet/modules/apt/templates/_header.erb]: Bound template variables for /etc/puppet/modules/apt/templates/_header.erb in 0.00 seconds
Debug: template[/etc/puppet/modules/apt/templates/_header.erb]: Interpolated template /etc/puppet/modules/apt/templates/_header.erb in 0.00 seconds
Debug: Scope(Apt::Source[nodesource]): Retrieving template apt/source.list.erb
Debug: template[/etc/puppet/modules/apt/templates/source.list.erb]: Bound template variables for /etc/puppet/modules/apt/templates/source.list.erb in 0.00 seconds
Debug: template[/etc/puppet/modules/apt/templates/source.list.erb]: Interpolated template /etc/puppet/modules/apt/templates/source.list.erb in 0.00 seconds
Debug: importing '/etc/puppet/modules/apt/manifests/key.pp' in environment production
Debug: Automatically imported apt::key from apt/key into production
Debug: Adding relationship from Anchor[::nodejs::begin] to Class[Nodejs::Repo::Nodesource] with 'before'
Debug: Adding relationship from Class[Nodejs::Repo::Nodesource] to Class[Nodejs::Install] with 'before'
Debug: Adding relationship from Class[Nodejs::Install] to Anchor[::nodejs::end] with 'before'
Debug: Adding relationship from Apt_key[Add key: 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 from Apt::Source nodesource] to Anchor[apt_key 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 present] with 'before'
Error: undefined method `ref' for nil:NilClass on node puppet-debug.int
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:527:in `block in to_catalog'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:515:in `each'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:515:in `to_catalog'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:402:in `to_resource'
/usr/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:23:in `compile'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:116:in `block (2 levels) in compile'
/usr/lib/ruby/vendor_ruby/puppet/util/profiler/none.rb:6:in `profile'
/usr/lib/ruby/vendor_ruby/puppet/util/profiler.rb:31:in `profile'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:114:in `block in compile'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:161:in `block in benchmark'
/usr/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:113:in `compile'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:46:in `find'
/usr/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:201:in `find'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:204:in `main'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:146:in `run_command'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `block (2 levels) in run'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:470:in `plugin_hook'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `block in run'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:478:in `exit_on_fail'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:137:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:91:in `execute'
/usr/bin/puppet:4:in `<main>'
Error: undefined method `ref' for nil:NilClass on node puppet-debug.int
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:527:in `block in to_catalog'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:515:in `each'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:515:in `to_catalog'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:402:in `to_resource'
/usr/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:23:in `compile'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:116:in `block (2 levels) in compile'
/usr/lib/ruby/vendor_ruby/puppet/util/profiler/none.rb:6:in `profile'
/usr/lib/ruby/vendor_ruby/puppet/util/profiler.rb:31:in `profile'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:114:in `block in compile'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:161:in `block in benchmark'
/usr/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:113:in `compile'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:46:in `find'
/usr/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:201:in `find'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:204:in `main'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:146:in `run_command'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `block (2 levels) in run'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:470:in `plugin_hook'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `block in run'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:478:in `exit_on_fail'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:364:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:137:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:91:in `execute'
/usr/bin/puppet:4:in `<main>'

@werkins
Copy link

werkins commented Aug 26, 2015

I had the same problem with a debian wheezy running inside a vagrant box. Relevant versions:

puppet 3.4.3
ruby 1.9.3p194
puppetlabs-apt (2.1.1)
puppet-nodejs (1.2.0)

Tried @juniorsysadmin tip (removing the ' to the contains line) doesn't work either.

@sysadmin1139
Copy link

I've been chasing this one all day and only found this issue. Looks like I'm hitting the same problem. We're running puppet 3.6.2, and nodejs version 0.8.0. I also tried the master-branch here and hit the same problem. This can be reproduced through a pretty simple method

FACTER_factname=things puppet apply --environment=test --modulepath [..] --hiera-config [..] --noop -e 'include nodejs'

And we hit the problem. Our stack-strace:

Error: undefined method `ref' for nil:NilClass on node hal.my.example.com
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:525:in `to_catalog'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:513:in `each'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:513:in `to_catalog'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:400:in `to_resource'
/usr/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:23:in `compile'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:95:in `compile'
/usr/lib/ruby/vendor_ruby/puppet/util/profiler/none.rb:6:in `profile'
/usr/lib/ruby/vendor_ruby/puppet/util/profiler.rb:43:in `profile'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:93:in `compile'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:161:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:92:in `compile'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:52:in `find'
/usr/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:201:in `find'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:214:in `main'
/usr/lib/ruby/vendor_ruby/puppet/context.rb:51:in `override'
/usr/lib/ruby/vendor_ruby/puppet.rb:233:in `override'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:190:in `main'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:151:in `run_command'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:372:in `run'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:479:in `plugin_hook'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:372:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:479:in `exit_on_fail'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:372:in `run'
/usr/lib/ruby/vendor_ruby/puppet/context.rb:51:in `override'
/usr/lib/ruby/vendor_ruby/puppet.rb:233:in `override'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:362:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:137:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:91:in `execute'
/usr/bin/puppet:4
Error: undefined method `ref' for nil:NilClass on node hal.my.example.com
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:525:in `to_catalog'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:513:in `each'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:513:in `to_catalog'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:400:in `to_resource'
/usr/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:23:in `compile'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:95:in `compile'
/usr/lib/ruby/vendor_ruby/puppet/util/profiler/none.rb:6:in `profile'
/usr/lib/ruby/vendor_ruby/puppet/util/profiler.rb:43:in `profile'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:93:in `compile'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:161:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:92:in `compile'
/usr/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:52:in `find'
/usr/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:201:in `find'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:214:in `main'
/usr/lib/ruby/vendor_ruby/puppet/context.rb:51:in `override'
/usr/lib/ruby/vendor_ruby/puppet.rb:233:in `override'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:190:in `main'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:151:in `run_command'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:372:in `run'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:479:in `plugin_hook'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:372:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:479:in `exit_on_fail'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:372:in `run'
/usr/lib/ruby/vendor_ruby/puppet/context.rb:51:in `override'
/usr/lib/ruby/vendor_ruby/puppet.rb:233:in `override'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:362:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:137:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:91:in `execute'
/usr/bin/puppet:4

@masterzen's analysis is spookily close to my own. Whatever problem it's running into, it isn't giving a usual puppet dependency fail.

@sysadmin1139
Copy link

After much hammering, this looks to be a manifestation of this:

https://tickets.puppetlabs.com/browse/PUP-1597

Which is fixed in the 3.7.0 codebase. Upgrading my local puppet to a 3.7 version caused things to start working again.

@ffrank
Copy link
Contributor

ffrank commented Sep 17, 2015

Thanks for the feedback!

It's weird that the OP hit this failure with Puppet 3.8.1. A regression perhaps?

@sysadmin1139 are you in a position to test a 3.8.1 master?

It would appear that @igalic might know what's what.

@igalic
Copy link
Contributor

igalic commented Sep 21, 2015

weird.

even weirder, in $bigCo we're always running latest stable puppet, and are not hitting this. (our roles and profiles and private modules are filled with contain)


we also have spec tests that should be catching that…

@sysadmin1139
Copy link

@ffrank We're deployed on 3.8.2 at the moment, and it's working fine. When we discovered we had to update past where we were, we bit the bullet and went to 'latest 3.x'. And we're still running the 0.8.0 code. It could be that the newer 1.2.0 rev makes the bug more visible?

@adamsea
Copy link

adamsea commented Sep 22, 2015

I'm experiencing this as well, tried Puppet 3.8.2 and 3.8.3 and module versions 1.2.0 and 0.8.0. Trace is identical to the others (save for the node name).

@aisouard
Copy link

Here is a workaround if you need to retrieve the package from nodesource :

class { '::nodejs':
  repo_url_suffix => 'node_0.12',
  manage_package_repo => false,
  npm_package_ensure => 'present',
  require => Exec['nodesource']
}

@igalic
Copy link
Contributor

igalic commented Sep 24, 2015

@aisouard i've edited your comment because the recommendation you're making is not something i would want to stand for in public.

@aisouard
Copy link

@igalic Whoops, sorry. I will be more careful about that next time.

A safer workaround would be telling people to provide their own nodejs package instead of manually retrieving the package from apt.

@igalic
Copy link
Contributor

igalic commented Sep 25, 2015

anyway, i'm currently using this module to install node 4.x from apt with puppet 4.2.2.

it works for me.

what am i doing wrong?

@ffrank
Copy link
Contributor

ffrank commented Oct 6, 2015

Failing to reproduce this with puppet apply version 3.8.1 and 4.2.3.

Will try it through puppet master later - the more exciting Puppet bugs are invisible to apply, sadly.

@ffrank
Copy link
Contributor

ffrank commented Oct 7, 2015

I just managed to reproduced with puppet 3.4.3 and 3.5.1.

Everyone who saw this with newer master versions, could you make extra sure that the binary from the installed package is really really running? Think rebooting the master machine etc.

@JamesWiley
Copy link

I am able to reproduce this with puppet 3.6.2 with puppet provisioning my vagrant CentOS 7 box

@igalic
Copy link
Contributor

igalic commented Oct 30, 2015

@JamesWiley, @ffrank contain was only really fixed in 3.7.0

@juniorsysadmin juniorsysadmin added the needs-feedback Further information is requested label Nov 16, 2015
@juniorsysadmin
Copy link
Member

Closing as a result of merging #178 . Will re-open if pain persists.

@linuxbandit
Copy link

I believe this is still an issue

I encounter the error when I vagrant up the machine for the first time and puppet runs the provisioner. My code was working through

class { 'nodejs':
    # TODO: The following setting installs nodejs from apt, which is not very
    #       recent. However, installing from NodeSource currently fails due to a
    #       bug in puppet-nodejs. See
    #       https://github.com/puppet-community/puppet-nodejs/issues/149
    #       Try to update puppet-nodejs once the bug is fixed.
    manage_package_repo       => false,
    nodejs_dev_package_ensure => 'present',
    npm_package_ensure        => 'present',
    legacy_debian_symlinks    => true,
  }

However commenting out the 4 lines gives me the error.

I would like to provide more information but I am not really expert at puppet, so if you'd like to guide me I can be more of help. For instance, it may just be that I did not update puppet, or the module... If it is not done automagically by vagrant, then how to? Sorry but my teammate who was taking care of puppet is busy and I am not as skilled as he is!

@linuxbandit
Copy link

Of course I spent all this time googling and found out that no, probably puppet isn't automatically the last version!
With this script I managed to update puppet to (I think) the latest available for trusty64 boxes, and after removing the 4 lines mentioned above, it works.

However npm is not the latest version, anybody knows why?

@igalic
Copy link
Contributor

igalic commented Dec 24, 2015

@serviceman npm, when installed from nodesource's repository, comes with the version bundled with nodejs. we do not explicitly install the latest version with this module.
you can do this yourself with:

package { 'npm':
  ensure   => 'latest',
  provider => 'npm',
}

and if you're lucky, this won't conflict with anything in the module _

@petems
Copy link
Member

petems commented Dec 24, 2015

Yeah, you're gonna come up against #160 unless you're using Puppet > 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-feedback Further information is requested
Projects
None yet
Development

No branches or pull requests