Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-1547

PR (2311) Undefined method `groups' for nil:NilClass

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 3.4.2
    • Fix Version/s: PUP 3.6.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      Week 2014-3-12 to 2014-3-19, Week 2014-4-02 to 2014-4-09, Week 2014-4-09 to 2014-4-16

      Description

      Lost quite some time in a rspec-puppet issue due to this error
      Ultimately it was due to being on os x and setting operatingsystem fact to centos, making puppet unable to find providers for the user type.

           NoMethodError:
             undefined method `groups' for nil:NilClass
           # /Users/csanchez/.rvm/gems/ruby-1.9.3-p484/gems/puppet-3.4.2/lib/puppet/property/list.rb:57:in `retrieve'
           # /Users/csanchez/.rvm/gems/ruby-1.9.3-p484/gems/puppet-3.4.2/lib/puppet/property/list.rb:46:in `should'
           # /Users/csanchez/.rvm/gems/ruby-1.9.3-p484/gems/puppet-3.4.2/lib/puppet/type/user.rb:359:in `block (2 levels) in <module:Puppet>'
      

        Attachments

          Issue Links

            Activity

            Show
            csanchez Carlos Sanchez added a comment - PR at https://github.com/puppetlabs/puppet/pull/2311
            Hide
            flozano Francisco A. Lozano added a comment -

            Having similar problem here, using puppet 3.4.2 (gem-installed) under a centos docker/lxc container. It doesn't reproduce in our rpm-installed EC2 instances.

            Error: Got an uncaught exception of type NoMethodError: undefined method `groups' for nil:NilClass
            /usr/local/lib/ruby/gems/2.0.0/gems/puppet-3.4.1/lib/puppet/property/list.rb:59:in `retrieve'
            /usr/local/lib/ruby/gems/2.0.0/gems/puppet-3.4.1/lib/puppet/property/list.rb:46:in `should'
            /usr/local/lib/ruby/gems/2.0.0/gems/puppet-3.4.1/lib/puppet/type/user.rb:359:in `block (2 levels) in <module:Puppet>'
            /usr/local/lib/ruby/gems/2.0.0/gems/puppet-3.4.1/lib/puppet/type.rb:1979:in `instance_eval'
            /usr/local/lib/ruby/gems/2.0.0/gems/puppet-3.4.1/lib/puppet/type.rb:1979:in `block in autorequire'
            /usr/local/lib/ruby/gems/2.0.0/gems/puppet-3.4.1/lib/puppet/type.rb:1957:in `block in eachautorequire'
            

            Show
            flozano Francisco A. Lozano added a comment - Having similar problem here, using puppet 3.4.2 (gem-installed) under a centos docker/lxc container. It doesn't reproduce in our rpm-installed EC2 instances. Error: Got an uncaught exception of type NoMethodError: undefined method `groups' for nil:NilClass /usr/local/lib/ruby/gems/2.0.0/gems/puppet-3.4.1/lib/puppet/property/list.rb:59:in `retrieve' /usr/local/lib/ruby/gems/2.0.0/gems/puppet-3.4.1/lib/puppet/property/list.rb:46:in `should' /usr/local/lib/ruby/gems/2.0.0/gems/puppet-3.4.1/lib/puppet/type/user.rb:359:in `block (2 levels) in <module:Puppet>' /usr/local/lib/ruby/gems/2.0.0/gems/puppet-3.4.1/lib/puppet/type.rb:1979:in `instance_eval' /usr/local/lib/ruby/gems/2.0.0/gems/puppet-3.4.1/lib/puppet/type.rb:1979:in `block in autorequire' /usr/local/lib/ruby/gems/2.0.0/gems/puppet-3.4.1/lib/puppet/type.rb:1957:in `block in eachautorequire'
            Hide
            andy Andrew Parker added a comment -

            Joshua Partlow, I think the consensus was the the PR looks OK, but there is a missing test and the commit message needs to have a bit more information explaining what happened before, what changes, and what should now happen.

            Show
            andy Andrew Parker added a comment - Joshua Partlow , I think the consensus was the the PR looks OK, but there is a missing test and the commit message needs to have a bit more information explaining what happened before, what changes, and what should now happen.
            Hide
            csanchez Carlos Sanchez added a comment -

            updated the PR commit msg and added a spec

            Show
            csanchez Carlos Sanchez added a comment - updated the PR commit msg and added a spec
            Hide
            tony.vu Tony Vu added a comment -

            Verified spec_tests passed for

            bundle exec rspec spec/unit/property/list_spec.rb

            Show
            tony.vu Tony Vu added a comment - Verified spec_tests passed for bundle exec rspec spec/unit/property/list_spec.rb
            Hide
            rtyler R Tyler added a comment -

            Was there a work-around you discovered to make it possible to continue using rspec-puppet sanely until this fix is in a publicly available Puppet release?

            Show
            rtyler R Tyler added a comment - Was there a work-around you discovered to make it possible to continue using rspec-puppet sanely until this fix is in a publicly available Puppet release?
            Show
            csanchez Carlos Sanchez added a comment - yes, mocking some methods, https://github.com/maestrodev/maestro-puppet-example/blob/master/spec/spec_helper.rb#L19
            Hide
            alexharv074 Alex Harvey added a comment -

            For anyone else searching for a workaround for earlier versions of Puppet, you can also add a global default in spec/fixtures/manifests/site.pp:

            # workaround for https://tickets.puppetlabs.com/browse/PUP-1547
            if $::operatingsystem == 'CentOS' {
              User {
                provider => 'useradd',
              }
            }
            

            Carlos Sanchez's work around doesn't work on some earlier versions of puppet, e.g. the 3.3.1 system I'm using.

            Show
            alexharv074 Alex Harvey added a comment - For anyone else searching for a workaround for earlier versions of Puppet, you can also add a global default in spec/fixtures/manifests/site.pp: # workaround for https://tickets.puppetlabs.com/browse/PUP-1547 if $::operatingsystem == 'CentOS' { User { provider => 'useradd', } } Carlos Sanchez 's work around doesn't work on some earlier versions of puppet, e.g. the 3.3.1 system I'm using.

              People

              • Assignee:
                tony.vu Tony Vu
                Reporter:
                csanchez Carlos Sanchez
              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support