Class Puppet::Provider::ParsedFile
In: lib/puppet/provider/parsedfile.rb
Parent: Puppet::Provider

This provider can be used as the parent class for a provider that parses and generates files. Its content must be loaded via the ‘prefetch’ method, and the file will be written when ‘flush’ is called on the provider instance. At this point, the file is written once for every provider instance.

Once the provider prefetches the data, it‘s the resource‘s job to copy that data over to the @is variables.

Methods

Attributes

default_target  [RW] 
property_hash  [RW] 
target  [RW] 

Public Class methods

Make sure our file is backed up, but only back it up once per transaction. We cheat and rely on the fact that @records is created on each prefetch.

Flush all of the targets for which there are modified records. The only reason we pass a record here is so that we can add it to the stack if necessary — it‘s passed from the instance calling ‘flush’.

Flush all of the records relating to a specific target.

Return the header placed at the top of each generated file, warning users that modifying this file manually is probably a bad idea.

Add another type var.

Return a list of all of the records we can find.

Override the default method with a lot more functionality.

Mark a target as modified so we know to flush it. This only gets used within the attr= methods.

Retrieve all of the data from disk. There are three ways to know which files to retrieve: We might have a list of file objects already set up, there might be instances of our associated resource and they will have a path parameter set, and we will have a default path set. We need to turn those three locations into a list of files, prefetch each one, and make sure they‘re associated with each appropriate resource instance.

Prefetch an individual target.

Is there an existing record with this name?

Always make the resource methods.

Retrieve the text for the file. Returns nil in the unlikely event that it doesn‘t exist.

Should we skip the record? Basically, we skip text records. This is only here so subclasses can override it.

Initialize the object if necessary.

Find all of the records for a given target

Find a list of all of the targets that we should be reading. This is used to figure out what targets we need to prefetch.

Public Instance methods

Write our data to disk.

Retrieve the current state from disk.

[Validate]