module PuppetX::NetDev::EosProviderClassMethods
EosProviderClassMethods
implements common methods, e.g. ‘self.prefetch` for EOS providers.
Public Instance Methods
prefetch(resources)
click to toggle source
prefetch associates resources declared in the Puppet catalog with resources discovered on the system using the instances class method. Each resource that has a matching provider in the instances list will have the provider bound to the resource.
@param [Hash] resources The set of resources declared in the catalog.
@return [Hash<String,Puppet::Type>] catalog resources with updated
provider instances.
# File lib/puppet_x/net_dev/eos_api.rb, line 1000 def prefetch(resources) provider_hash = instances.each_with_object({}) do |provider, hsh| hsh[provider.name] = provider end resources.each_pair do |name, resource| resource.provider = provider_hash[name] if provider_hash[name] end end