Unfortunately, the parsedfile provider is mainly documented by code
that uses it. I've been meaning to write up a document on it, but I've
been unable to find the time. In the mean time, the OSUOSL has some
providers for gentoo that use the parsedfile provider, found at
https://github.com/ramereth/puppet-gentoo/blob/master/lib/puppet/provider/package_use/parsed.rb
that may give you a bit more insight. Sorry for the non-answer here,
but this might get you a bit further along.

On Thu, Oct 13, 2011 at 2:47 PM, Guy Matz <gm...@matz.org> wrote:
> Thanks for the reply!!  One more thing I can't quite figure out:  How to get
> a new entry in my target file!  I can parse, but an entry in manifests
> doesn't magically appear.  Do I need to add something to my provider or type
> to get that to happen?  Any help would be soooo appreciated; i'm getting
> tired of struggling with this!
>
> vncserver/manifests/init.pp
> class vncserver {
>   vncserver { 'guymatz':
>       port => '92',
>       geometry => '1024x768',
>       ensure => 'present'
>   }
> } # class vncserver
>
>
> vncserver/lib/puppet/type/vncserver.rb
> require 'puppet/property/list'
> require 'puppet/provider/parsedfile'
>
> Puppet::Type.newtype(:vncserver) do
>
>     ensurable
>
>     newparam(:port) do
>       desc "The vnc servers port assignment.  Will be +5900 on the server"
>     end
>
>     newparam(:name) do
>       isnamevar
>       desc "The user who will own the VNC session."
>     end
>
>     newparam(:geometry) do
>       desc "Resolution for VNC, in XxY, e.g. 1024x768."
>     end
>
>     newparam(:password) do
>       desc "Password to be put into users .vnc/passwd."
>     end
>
>     newparam(:args) do
>       desc "Optional arguments to be added to the vncserver command-line."
>     end
>
>     @doc = "Installs and manages entries for vncservers.  For Redhat-bases
>       systems, and likely many others, these entries will be in
>       /etc/sysconfig/vncservers."
>
> end
>
>
> and, finally, my very unfinished provider:
> vncserver/lib/puppet/provider/vncserver/parsed.rb:
> require 'puppet/provider/parsedfile'
>
> vncservers = "/etc/sysconfig/vncservers"
>
> Puppet::Type.type(:vncserver).provide(:parsed,
>                                       :parent =>
> Puppet::Provider::ParsedFile,
>                                       :default_target => vncservers,
>                                       :filetype => :flat
>                                       ) 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,
>               :joiner => '',
>               :fields => %w{port geometry optional_args},
>               :optional => %w{port geometry },
>               :match => /^VNCSERVERARGS\[(\d+)\]="-geometry (\d+x\d+)(.*)$/,
>               :to_line => proc { |record|
>                 "VNCSERVERARGS[#{record[:port]}]=\"-geometry
> #{record[:geometry]} #{record[:optional_args]}\""
>               }
>
>   record_line :parsed_again,
>               :joiner => '',
>               :fields => %w{port_name},
>               :optional => %w{port_name},
>               :match => /^VNCSERVERS="(.*)"$/,
>               :to_line => proc { |record|
>                 "VNCSERVERS=\"#{record[:port_name]}\""
>               }
> end
>
> --
> 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.
>

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