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

Creating new user with chef-client 15.4.45 client throws a NilClass error. #9109

Open
johnmccrae opened this issue Nov 18, 2019 · 2 comments
Open

Comments

@johnmccrae
Copy link

@johnmccrae johnmccrae commented Nov 18, 2019

Description

Facebook reports a NilClient error creating a user resource. Below is my repro of the error.

Chef Version

System Info:
------------
chef_version=15.4.45
platform=mac_os_x
platform_version=10.15.1
ruby=ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin17]
program_name=/opt/chef-workstation/bin/chef-client
executable=/opt/chef-workstation/bin/chef-client

Platform Version

Mac OSX 10.15.1

Replication Case

  1. build a cookbook called whatever (I used cpe_test).
  2. the cookbook should have one recipe in it.
  3. that recipe should look like this:
user 'fooadmin' do

end
  1. Now run sudo chef-client -z -o cpe_test
  2. You get a NilClass error

Client Output

Recipe: cpe_test::default

  • mac_user[fooadmin] action create

    • create user
      ================================================================================
      Error executing action create on resource 'mac_user[fooadmin]'
      ================================================================================

    NoMethodError

    undefined method `[]' for nil:NilClass

    Resource Declaration:

    In /Users/johnmccrae/.chef/local-mode-cache/cache/cookbooks/cpe_test/recipes/default.rb

    1: user 'fooadmin' do
    2:
    3: end

    Compiled Resource:

    Declared in /Users/johnmccrae/.chef/local-mode-cache/cache/cookbooks/cpe_test/recipes/default.rb:1:in `from_file'

    mac_user("fooadmin") do
    action [:create]
    default_guard_interpreter :default
    declared_type :user
    cookbook_name "cpe_test"
    recipe_name "default"
    username "fooadmin"
    home "/Users/fooadmin"
    end

    System Info:

    chef_version=15.4.45
    platform=mac_os_x
    platform_version=10.15.1
    ruby=ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin17]
    program_name=/opt/chef-workstation/bin/chef-client
    executable=/opt/chef-workstation/bin/chef-client


Stacktrace

https://gist.github.com/johnmccrae/1adaca34434034c9baa9057d1523cfe5

@johnmccrae

This comment has been minimized.

Copy link
Author

@johnmccrae johnmccrae commented Nov 19, 2019

The bug also repros on the 15.5.9 client as well.

@johnmccrae

This comment has been minimized.

Copy link
Author

@johnmccrae johnmccrae commented Nov 25, 2019

Second update. If you look through the local users list in System Preferences after you run the code sample, you'll see that it actually created the user but you can't set most attributes after the fact and if you set a password you can't read the user?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.