Fudge!!  Thanks for the pointer, Stefan . . .  Yeah, the lines in
match_providers_with_resources that says:
if resource = match(record, matchers)
# Remove this resource from circulation so we don’t unnecessarily try to
match
matchers.delete(resource.title)
.
.
.

Means that it can never match two lines, I guess!

Thanks again  . . .

On Wed, Nov 9, 2011 at 3:48 PM, Stefan Schulte <
stefan.schu...@taunusstein.net> wrote:

> On Wed, Nov 09, 2011 at 02:45:30PM -0500, Guy Matz wrote:
> > Stefan,
> > Right!  I think.  With a resource that looks like :
> > vncserver { '92':
> >       username => 'athusr',
> >       geometry => '123x78',
> >       ensure => 'present';
> > }
> >
> > I should get two entries in /etc/sysconfig/vncserver:
> > VNCSERVERARGS[92]="-geometry 123x78"
> > VNCSERVERS="$VNCSERVERS 92:athusr"
> >
> > I'm sorry if I am not understanding your post, and responding to it
> > nonsensically.  Are you saying that with a single "name" of 92, I will
> not
> > be able to make changes on two lines?
> >
>
> Yes. Every line in your config file (that is not a text line like a
> comment) will be parsed as one record.  During prefetching puppet tries
> to match the resources the user has defined in his manifest with the
> records of your target file(s).
>
> It works like this
> Puppet iterates over every record.  If puppet has a resource with a name
> that matches the current record's name then puppet creates a provider
> instance
> and assignes the provider to this resource.
>
> So in short
> * each resource has zero or one prefetched provider
> * one provider corresponds to one specific record in your file
>
> Have a look at provider/parsedfile.rb method
> match_providers_with_resources
>
> You may be able to define a custom prefetch_hook method in your
> provider where you merge your different records into one.  But I
> currently don't know how puppet behaves when it has to rewrite the file
> after possible changes.
>
> Untested prefetch hook:
>
>    def prefetch_hook(records)
>      merged_records = {} # hash with the record's name as key
>      records.each do |record|
>        if name = record[:name]
>          merged_record[name] ||= {}
>          merged_record[name].merge!(record)
>        end
>      end
>      merged_records.values
>    end
>
> You may get additional suggestions if you look at the cron provider.
>
> But in general I'm afraid that the parsedfile provider is not really
> good when information spanning over multiple lines.
>
> -Stefan
>
> > Thanks a lot!
> > Guy
> >
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to