diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-11-03 18:03:00 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-11-08 11:26:07 -0800 |
commit | 74889fe64a8a71c48fb1d0ffa124f3d28fb9695c (patch) | |
tree | a11f0989f70c038e2741387180c255076fa9bf20 /lib | |
parent | 7be31e8c29760c600f7af0dd7413055c5c276525 (diff) | |
download | chef-74889fe64a8a71c48fb1d0ffa124f3d28fb9695c.tar.gz |
add some more debug output and comments
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/provider_resolver.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/chef/provider_resolver.rb b/lib/chef/provider_resolver.rb index c819b0c87f..0c3a798d3c 100644 --- a/lib/chef/provider_resolver.rb +++ b/lib/chef/provider_resolver.rb @@ -67,13 +67,16 @@ class Chef Chef::Log.debug "providers that refused resource #{resource} were: #{enabled_handlers - supported_handlers}" Chef::Log.debug "providers that support resource #{resource} include: #{supported_handlers}" + # if none of the providers specifically support the resource, we still need to pick one of the providers that are + # enabled on the node to handle the why-run use case. handlers = supported_handlers.empty? ? enabled_handlers : supported_handlers + Chef::Log.debug "no providers supported the resource, falling back to enabled handlers" if supported_handlers.empty? if handlers.count >= 2 + # this magic stack ranks the providers by where they appear in the provider_priority_map, it is mostly used + # to pick amongst N different ways to start init scripts on different debian/ubuntu systems. priority_list = [ get_provider_priority_map(resource.resource_name, node) ].flatten.compact - handlers = handlers.sort_by { |x| i = priority_list.index x; i.nil? ? Float::INFINITY : i } - handlers = [ handlers.first ] end @@ -81,6 +84,8 @@ class Chef raise Chef::Exceptions::AmbiguousProviderResolution.new(resource, handlers) if handlers.count >= 2 + Chef::Log.debug "dynamic provider resolver FAILED to resolve a provider" if handlers.empty? + return nil if handlers.empty? handlers[0] |