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

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