Method: Puppet::Provider::ParsedFile.match_providers_with_resources

Defined in:
lib/vendor/puppet/provider/parsedfile.rb

.match_providers_with_resources(resources) ⇒ Object



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/vendor/puppet/provider/parsedfile.rb', line 189

def self.match_providers_with_resources(resources)
  return unless resources
  matchers = resources.dup
  @records.each do |record|
    # Skip things like comments and blank lines
    next if skip_record?(record)

    if name = record[:name] and resource = resources[name]
      resource.provider = new(record)
    elsif respond_to?(:match)
      if resource = match(record, matchers)
        # Remove this resource from circulation so we don't unnecessarily try to match
        matchers.delete(resource.title)
        record[:name] = resource[:name]
        resource.provider = new(record)
      end
    end
  end
end