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

Failure to create user in macOS 10.14 #7893

Open
pludi opened this Issue Nov 8, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@pludi

pludi commented Nov 8, 2018

Description

Attempting to create a user with a password fails in macOS 10.14. Most likely related to #7763

Chef Version

14.6.67

Platform Version

macOS 10.14 BuildVersion: 18A391

Replication Case

Attempt to create a new user using the user resource, including setting the password in one run:

user 'ouradmin' do
  comment 'Central Client Admin'
  manage_home true
  salt '5edf4bd231222403c42f17c8151442173330ae72472b23c28bb6db6563b95da0'
  # Password is 'my_awesome_password' from https://docs.chef.io/resource_user.html#examples
  password 'f9ff80286dc39daae9c83fe310f5d58797b815893669dfa0347af7f65e2b4a4eb1fff1df121552a16c023ced5fd0969054e913ba9d1baaa42fbf398808a8599cbcae076abd976e6f54d1bfea8d90251fa171a73a5252c1d87480e296efde483ced2dba200067965e38192afe4fb481551b1488904165596f67550f0b104f79a0'
  iterations 25000
  action :create
end

Client Output

* dscl_user[ouradmin] action create
    
    ================================================================================
    Error executing action `create` on resource 'dscl_user[ouradmin]'
    ================================================================================
    
    NoMethodError
    -------------
    undefined method `[]=' for nil:NilClass
    
    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/workstation/recipes/macos.rb
    
      5: user 'ouradmin' do
      6:   comment 'Central Client Admin'
      7:   manage_home true
      8:   password 'fb490bb1b5cd7b5fabc55d00c29c97c299ee44a9943289e983960792ee87cb7e9ebc2040bd6830e6f686f14693e055441a1b70008b5e663c96886aba43a36de05b21667b0ad059123b9275b513a87b85f19af2c63d7be72084ad1f39846d9b05f3378d5f706ac25df2479aeaa2c03a540ace1ed3c926d21ff53f65b09288b0d7'
      9:   salt '3ecae7d22ed1bbfddabebb1211a6a7421ea96b4faf86cc5cf75a1f2f8e658c35'
     10:   iterations 25000
     11:   action :create
     12: end
     13: 
    
    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/workstation/recipes/macos.rb:5:in `from_file'
    
    dscl_user("ouradmin") do
      action [:create]
      default_guard_interpreter :default
      username "ouradmin"
      comment "Central Client Admin"
      uid nil
      gid nil
      home nil
      password "f9ff80286dc39daae9c83fe310f5d58797b815893669dfa0347af7f65e2b4a4eb1fff1df121552a16c023ced5fd0969054e913ba9d1baaa42fbf398808a8599cbcae076abd976e6f54d1bfea8d90251fa171a73a5252c1d87480e296efde483ced2dba200067965e38192afe4fb481551b1488904165596f67550f0b104f79a0"
      manage_home true
      iterations 25000
      salt "5edf4bd231222403c42f17c8151442173330ae72472b23c28bb6db6563b95da0"
      declared_type :user
      cookbook_name "workstation"
      recipe_name "macos"
    end
    
    System Info:
    ------------
    chef_version=14.6.47
    platform=mac_os_x
    platform_version=10.14
    ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin15]
    program_name=/opt/chef/bin/chef-client
    executable=/opt/chef/bin/chef-client
    

Running handlers:
[2018-11-06T14:07:48+01:00] ERROR: Running exception handlers
Running handlers complete
[2018-11-06T14:07:48+01:00] ERROR: Exception handlers complete
Chef Client failed. 3 resources updated in 14 seconds
[2018-11-06T14:07:48+01:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2018-11-06T14:07:48+01:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-11-06T14:07:48+01:00] FATAL: NoMethodError: dscl_user[ouradmin] (workstation::macos line 5) had an error: NoMethodError: undefined method `[]=' for nil:NilClass
All done!

Stacktrace

NoMethodError: dscl_user[ouradmin] (workstation::macos line 5) had an error: NoMethodError: undefined method `[]=' for nil:NilClass
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/provider/user/dscl.rb:616:in `dscl_set'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/provider/user/dscl.rb:380:in `set_password'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/provider/user/dscl.rb:174:in `create_user'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/provider/user.rb:122:in `block in action_create'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/mixin/why_run.rb:51:in `add_action'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/provider.rb:227:in `converge_by'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/provider/user.rb:121:in `action_create'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/provider.rb:182:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/resource.rb:577:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/runner.rb:70:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/runner.rb:98:in `block (2 levels) in converge'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/runner.rb:98:in `each'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/runner.rb:98:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/runner.rb:97:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/client.rb:720:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/client.rb:715:in `catch'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/client.rb:715:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/client.rb:754:in `converge_and_save'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/client.rb:286:in `run'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/application.rb:303:in `run_with_graceful_exit_option'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/application.rb:279:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/application.rb:261:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/application/client.rb:440:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/lib/chef/application.rb:66:in `run'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.6.47/bin/chef-client:25:in `<top (required)>'
/opt/chef/bin/chef-client:74:in `load'
/opt/chef/bin/chef-client:74:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment