summaryrefslogtreecommitdiff
path: root/lib/chef/provider_resolver.rb
Commit message (Collapse)AuthorAgeFilesLines
* Resolve Style/RedundantCondition copTim Smith2020-09-161-1/+1
| | | | | | We have some extra conditionals that aren't getting us anything Signed-off-by: Tim Smith <tsmith@chef.io>
* Convert require to require_relativeLamont Granquist2019-05-081-2/+2
| | | | | | | This gives a speed boost since rubygems does not have to scan through every gem in the gemset in order to find the file. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* mechanical conversion of most debug log statements to traceThom May2018-03-261-4/+4
| | | | Signed-off-by: Thom May <thom@chef.io>
* Chef-13: remove more deprecated provider_resolver codeLamont Granquist2017-03-291-26/+0
| | | | | | | I think this nukes descendants tracker, although might need to clean it up in a few more spots. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Fix Chef-13 action_class bug and cleanupLamont Granquist2017-03-271-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old action_class code was doing some magical stuff with the provider accessor in order to determine if the class was supposed to be a custom resource or not and have the action_class autovivifying accessor return nil in cases when the resource wasn't a custom resource and implementing inheritance by walking back up the tree in ways that were difficult to grok. This removes the magic from the provider so that there's no longer any accessor that magically short-circuits to nil if the resource is not supposed to be a custom resource. There is now a simple inherited API for `Chef::Resource.custom_resource?` which just defines if the class is a custom resource or not. Since both `action` and `action_class` call `define_action_class` they both wind up setting this boolean on the class, which is then inherited to subclasses automatically, which eliminates the need to walk up the hierarchy. The superclass.respond_to?(:action_class) checks have also been rendered unnecessary by removing the code that walked up the inheritance hierarchy and also because Chef::Resource is never going to be a custom resource itself, so will never call `define_action_class` so from inside of `define_action_class` you can always rely on the superclass being a resource and implementing `custom_resource?` and `action_class`. The wiring for picking the provider is now moved explicitly to the ProviderResolver -- even though custom resources hardcode a 1:1 resource-to-provider mapping. This reads much clearer to me than the magical wiring to the provider accessor off of the instance. The bug that this fixes was that the way the magical accessor nil-or-action_class was implemented the old way of defining action helpers with class_eval broke: ```ruby action_class.class_eval << EOM def a "foo" end EOM ``` If that came before any action_class-with-a-block or action declaration and the resource did not inherit from another custom resource then the action_class would not be created and it would return nil, which was an API which the magical wiring in the provider accessor required. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Revert "Chef-13: remove more deprecated provider_resolver code"Lamont Granquist2017-03-201-0/+26
| | | | | | forgot to branch and need more coffee This reverts commit 02ec917f9356d999c44aceb7f1ff43957b0fe832.
* Chef-13: remove more deprecated provider_resolver codeLamont Granquist2017-03-201-26/+0
| | | | | | | I think this nukes descendants tracker, although might need to clean it up in a few more spots. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Chef-13: remove Chef::Platform.set and related methodsLamont Granquist2017-03-171-6/+1
| | | | | | Switch over the Chef-12.0 ProviderResolver is now completed. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix provider_resolver comment to remove FIXMELamont Granquist2016-12-081-2/+4
| | | | | | | no, we should not do this only in why-run mode, add more yapping to make that clear. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Structure deprecations with additional metadatatm/deprecation_with_urlThom May2016-11-161-2/+2
| | | | | | | | This adds URLs to each class of deprecation, and correctly prints and formats them for maximum user efficiency. We also provide the URL to the data collector for Visibility to ingest. Signed-off-by: Thom May <thom@chef.io>
* Copyright year update for 2016 and massive cleanup.Noah Kantrowitz2016-02-021-1/+1
| | | Generated via git ls-files | xargs perl -pi -e "s/[Cc]opyright (?:\([Cc]\) )?((?\!$(date +%Y))\\d{4})(-\\d{4})?([, ][ \d]+)*(,|(?= ))/Copyright \\1-$(date +%Y),/g"
* Use double quotes by defaultThom May2016-01-141-2/+2
| | | | | | | This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
* Rename log.deprecation to log_deprecationJohn Keiser2015-09-011-2/+2
|
* Pass deprecations through formatter instead of logsJohn Keiser2015-09-011-2/+2
|
* Memoize enabled_handlers so it is not recomputedjk/separate-priority-mapJohn Keiser2015-07-061-1/+1
|
* Re-separate priority map and DSL handler map so that provides has veto power ↵John Keiser2015-07-061-21/+25
| | | | over priority
* Code review commentsJohn Keiser2015-06-301-3/+3
|
* Optimize logic on class initialize so it doesn't fall into theJohn Keiser2015-06-301-22/+31
| | | | | | "look at all classes to see if they provide the DSL" else clause when you're just setting resource_name (which happens on every class). Perf fix for tests.
* Fix broken specsJohn Keiser2015-06-301-17/+16
|
* Call provides? when resolving, reduce number of calls to provides?John Keiser2015-06-301-43/+37
| | | | in Provider
* Fix issue with supported_handlers including disabled handlersJohn Keiser2015-06-021-1/+1
|
* Bring back platform mapping resolution call, fix automatic ubuntu provider testsJohn Keiser2015-06-021-1/+2
|
* Remove platform mapping from lookup, add comment about how resolution now worksJohn Keiser2015-06-021-79/+15
|
* Narrow resolvers to only look at parts of the map we supportJohn Keiser2015-06-021-57/+73
|
* Add `provides` to remaining provider resourcesJohn Keiser2015-05-131-0/+87
|
* typo fix in commentlcg/fix-provider-resolver-api-breakLamont Granquist2015-04-271-1/+1
|
* Fix API break in 12.3.0.rc.0Lamont Granquist2015-04-241-1/+3
| | | | | | | provides? on a provider was passed the full resource. provides? on a resource class cannot be passed the resource and must be passed the declared_type instead. i tried to make them the same, but that would change the API on the provider.
* Revert "Fix API break in 12.3.0.rc.0"Lamont Granquist2015-04-241-3/+1
| | | | This reverts commit 57cdbe124f63e47cab960e714572539d3979b90f.
* Fix API break in 12.3.0.rc.0Lamont Granquist2015-04-241-1/+3
| | | | | | | provides? on a provider was passed the full resource. provides? on a resource class cannot be passed the resource and must be passed the declared_type instead. i tried to make them the same, but that would change the API on the provider.
* add resource_resolver and resource_priority_mapLamont Granquist2015-04-151-5/+10
| | | | also wire them up through the Chef class.
* provider resolver perf improvementLamont Granquist2014-11-211-2/+2
| | | | | | move the sorting of the providers to after we make the first cut, still keeps deterministic ordering, but avoids sorting providers we are just going to throw away.
* polishing provider_resolverLamont Granquist2014-11-081-14/+23
| | | | | | | | * makes provides? more correct for linux services * makes supports? more targetted for linux services * remove provider_resolver from the run_context * fix timestamped deploy spec * add more specs
* add some more debug output and commentsLamont Granquist2014-11-081-2/+7
|
* Chef-12 RC Provider ResolverLamont Granquist2014-10-241-18/+64
| | | | | makes resource and provider class resolution more dynamic. begins deprecation of Chef::Platform static mapping.
* Initial sketch for provider resolverRichard Manyanza2014-10-221-0/+57