Thanks!  That begs the question:  What's the difference between newparam &
newproperty?

One other thing:  Does anyone know why I would get the following error after
switching from newparam to newproperty?
err: Could not retrieve catalog from remote server: Could not intern from
pson: undefined method `merge' for []:Array

Thanks again,
Guy

On Fri, Oct 14, 2011 at 4:31 AM, Brice Figureau <
[email protected]> wrote:

> Hi,
>
> On Thu, 2011-10-13 at 17:47 -0400, Guy Matz 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'
>
> Those are properties: you want to manage them.
>
> >   }
> > } # 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
>
> But you defined them as parameters.
> Use newproperty instead of newparam.
>
> >     @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
>
> Also, you don't have any property in the type for port_name.
>
>

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

Reply via email to