Module: Chef::ProviderResolver::Deprecated

Included in:
Chef::ProviderResolver
Defined in:
lib/chef/provider_resolver.rb

Instance Method Summary collapse

Instance Method Details

#enabled_handlersObject



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/chef/provider_resolver.rb', line 150

def enabled_handlers
  @enabled_handlers ||= begin
    handlers = super
    if handlers.empty?
      # Look through all providers, and find ones that return true to provides.
      # Don't bother with ones that don't override provides?, since they
      # would have been in enabled_handlers already if that were so. (It's a
      # perf concern otherwise.)
      handlers = providers.select { |handler| overrode_provides?(handler) && handler.provides?(node, resource) }
      handlers.each do |handler|
        Chef.log_deprecation("#{handler}.provides? returned true when asked if it provides DSL #{resource.resource_name}, but provides #{resource.resource_name.inspect} was never called!")
        Chef.log_deprecation("In Chef 13, this will break: you must call provides to mark the names you provide, even if you also override provides? yourself.")
      end
    end
    handlers
  end
end

#providersObject

return a deterministically sorted list of Chef::Provider subclasses



146
147
148
# File 'lib/chef/provider_resolver.rb', line 146

def providers
  @providers ||= Chef::Provider.descendants
end