[PUP-6437] directoryservice user provider crashes if no ShadowHashData is found Created: 2016/06/24  Updated: 2016/08/11  Resolved: 2016/07/11

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: PUP 4.5.2
Fix Version/s: PUP 4.6.0

Type: Bug Priority: Normal
Reporter: Clay Caviness Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

macOS 10.11.5


Issue Links:
Relates
relates to PUP-6410 launchd service provider crashes if a... Closed
Template:
Story Points: 0
Sprint: Client 2016-06-29, Client 2016-07-13 (HA, 1.5.3)
Release Notes: Bug Fix
Release Notes Summary: This change fixes an issue with the directoryservice user provider in OSX, where puppet would crash in certain circumstances while fetching bad ShadowHashData from the system. Puppet now handles this gracefully.

 Description   

Possibly related to link PUP-6410, if the user/directoryservice provider's get_attribute_from_dscl method returns nil when trying to fetch ShadowHashData, the whole thing explodes.

We've only seen this rarely, and only when the provider's trying to read an empty username (which is probably another bug that should be handled).

Debug: Prefetching directoryservice resources for user
Debug: Executing: '/usr/bin/dscl -plist . readall /Users'
Debug: Executing: '/usr/bin/dscl -plist . read /Users// ShadowHashData'
Debug: Failed with NoMethodError on : #<NoMethodError: undefined method `elements' for nil:NilClass>
Debug: Executing: '/usr/bin/dscl -plist . readall /Groups'
Debug: Storing state
Debug: Stored state in 0.00 seconds
Error: Failed to apply catalog: undefined method `empty?' for nil:NilClass
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/provider/user/directoryservice.rb:144:in `generate_attribute_hash'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/provider/user/directoryservice.rb:87:in `block in instances'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/provider/user/directoryservice.rb:86:in `collect'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/provider/user/directoryservice.rb:86:in `instances'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/provider/user/directoryservice.rb:73:in `prefetch'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/transaction.rb:305:in `prefetch'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/transaction.rb:205:in `prefetch_if_necessary'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/transaction.rb:97:in `block in evaluate'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/graph/relationship_graph.rb:116:in `call'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/graph/relationship_graph.rb:116:in `traverse'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/transaction.rb:142:in `evaluate'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/resource/catalog.rb:222:in `block in apply'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/util/log.rb:155:in `with_destination'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/transaction/report.rb:118:in `as_logging_destination'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/resource/catalog.rb:221:in `apply'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/configurer.rb:171:in `block in apply_catalog'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/util.rb:223:in `block in benchmark'
/Library/GoogleCorpSupport/Ruby/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/util.rb:222:in `benchmark'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/configurer.rb:170:in `apply_catalog'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/configurer.rb:315:in `run_internal'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/configurer.rb:186:in `block in run'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/context.rb:65:in `override'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet.rb:240:in `override'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/configurer.rb:185:in `run'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/application/apply.rb:350:in `apply_catalog'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/application/apply.rb:274:in `block in main'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/context.rb:65:in `override'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet.rb:240:in `override'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/application/apply.rb:225:in `main'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/application/apply.rb:170:in `run_command'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/application.rb:344:in `block in run'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/util.rb:540:in `exit_on_fail'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/application.rb:344:in `run'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/util/command_line.rb:128:in `run'
/Library/GoogleCorpSupport/Ruby/lib/ruby/site_ruby/puppet/util/command_line.rb:72:in `execute'
/Library/GoogleCorpSupport/bin/puppet:5:in `<main>'



 Comments   
Comment by Clay Caviness [ 2016/06/24 ]

https://github.com/puppetlabs/puppet/pull/5056

Comment by John Duarte [ 2016/07/06 ]

Validated using pre-release version of puppet-agent at SHA 7a15e92 containing puppet at SHA 7e67d60.

Comment by Glenn Sarti [ 2016/07/08 ]

Merged into master at;
https://github.com/puppetlabs/puppet/commit/42becdebfc1d8ae666d71441ebb9c1ed929711e1

Generated at Wed Aug 21 00:10:03 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.