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?

Thanks a lot!
Guy

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

> On Wed, Nov 09, 2011 at 01:08:37PM -0500, Guy Matz wrote:
> > Hi!  I am soooo close to getting my vncserver type to work; I have one
> last
> > hurdle.  There are two kinds of record lines in a vncserver config file,
> so
> > I have two record_line definitions in my provider.  Only one of them gets
> > called, though!  The one that has the same name, ":parsed", as what I
> pass
> > to provide . . .
> >
> > require 'puppet/provider/parsedfile'
> >
> > vncservers = "/etc/sysconfig/vncservers"
> >
> > Puppet::Type.type(:vncserver).provide(:parsed,
> >                                       :parent =>
> > Puppet::Provider::ParsedFile,
> >                                       :filetype => :flat,
> >                                       :default_target => vncservers
> >                                       ) do
> >
> >   desc "The vncserver provider that uses the ParsedFile class"
> >
> >   confine :exists => vncservers
> >
> >   text_line :comment, :match => /^\s*#/;
> >   text_line :blank, :match => /^\s*$/;
> >
> >   record_line :parsed_opts,
> >               :fields => %w{name pre_geo_opts geometry post_geo_opts},
> >               :optional => %w{pre_geo_opts post_geo_opts},
> >               :match => /^VNCSERVERARGS\[(\d+)\]="(.*)\s*-geometry
> > (\d+x\d+)(.*)"$/,
> >               :to_line => proc { |record|
> >                 # Should end up looking like:
> >                 # VNCSERVERARGS[92]="-geometry 1280x1024"
> >                 'VNCSERVERARGS[' + record[:name] +
> >                       ']="-geometry ' + record[:geometry] + '"'
> >               };
> >   record_line :parsed_portuser,
> >               :fields => %w{name username},
> >               :match => /^VNCSERVERS="\$VNCSERVERS\s+(\d+):(\w+)\s*"$/,
> >               :to_line => proc { |record|
> >                 # Should end up looking like:
> >                 # VNCSERVERS="$VNCSERVERS 2:firstuser"
> >                 'VNCSERVERS="$VNCSERVERS ' +
> >                   record[:name] + ':' + record[:username] + '"'
> >               };
> > end
> >
> >
> > Thanks a lot!!
> >
> > Guy
>
> To be clear here can you have something like
>
>    VNCSERVERARGS[23]=...
>    VNCSERVERS="$VNCSERVERS 23:user"
>
> Because after parsing the whole file, puppet will have two records with
> record[:name] = 23 but the contents are not merged.
>
> So when prefetching happens and you have a resource type with the name 23,
> the resource will get a provider with pre_geo_opts, geometry and
> post_geo_opts OR a provider with username set but never both.
>
> -Stefan
>

-- 
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