diff options
author | John Keiser <john@johnkeiser.com> | 2015-07-06 12:10:33 -0600 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-07-06 12:10:33 -0600 |
commit | 59eb936978e7286fc8da4c87ba38577cef80f4c9 (patch) | |
tree | d532fa94c2aba511049563a7fea9215a63436a98 | |
parent | 591b5599f5412faa382e45d035d76535cd93736a (diff) | |
download | chef-59eb936978e7286fc8da4c87ba38577cef80f4c9.tar.gz |
Memoize enabled_handlers so it is not recomputedjk/separate-priority-map
-rw-r--r-- | lib/chef/chef_class.rb | 4 | ||||
-rw-r--r-- | lib/chef/platform/provider_handler_map.rb | 18 | ||||
-rw-r--r-- | lib/chef/platform/resource_handler_map.rb | 18 | ||||
-rw-r--r-- | lib/chef/provider_resolver.rb | 2 |
4 files changed, 39 insertions, 3 deletions
diff --git a/lib/chef/chef_class.rb b/lib/chef/chef_class.rb index 563e06434b..5cf4f95af5 100644 --- a/lib/chef/chef_class.rb +++ b/lib/chef/chef_class.rb @@ -162,8 +162,8 @@ class Chef @node = nil @provider_priority_map = nil @resource_priority_map = nil - @provider_dsl_map = nil - @resource_dsl_map = nil + @provider_handler_map = nil + @resource_handler_map = nil end # @api private diff --git a/lib/chef/platform/provider_handler_map.rb b/lib/chef/platform/provider_handler_map.rb index 37321268aa..4549d7994e 100644 --- a/lib/chef/platform/provider_handler_map.rb +++ b/lib/chef/platform/provider_handler_map.rb @@ -1,3 +1,21 @@ +# +# Author:: John Keiser (<jkeiser@chef.io>) +# Copyright:: Copyright (c) 2015 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + require 'singleton' require 'chef/platform/handler_map' diff --git a/lib/chef/platform/resource_handler_map.rb b/lib/chef/platform/resource_handler_map.rb index 532d4ff656..27a7bb1342 100644 --- a/lib/chef/platform/resource_handler_map.rb +++ b/lib/chef/platform/resource_handler_map.rb @@ -1,3 +1,21 @@ +# +# Author:: John Keiser (<jkeiser@chef.io>) +# Copyright:: Copyright (c) 2015 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + require 'singleton' require 'chef/platform/handler_map' diff --git a/lib/chef/provider_resolver.rb b/lib/chef/provider_resolver.rb index 2fd9d7e8eb..8459bc1328 100644 --- a/lib/chef/provider_resolver.rb +++ b/lib/chef/provider_resolver.rb @@ -69,7 +69,7 @@ class Chef end def enabled_handlers - potential_handlers.select { |handler| !overrode_provides?(handler) || handler.provides?(node, resource) } + @enabled_handlers ||= potential_handlers.select { |handler| !overrode_provides?(handler) || handler.provides?(node, resource) } end # TODO deprecate this and allow actions to be passed as a filter to |