Hm, doesn't address your issue but you could probably do thus with just a definition instead of writing a new type. On Sep 15, 2011 1:22 PM, "Guy Matz" <gm...@matz.org> wrote: > hi! Does anyone have any advice on debugging a new custom type? > > Any thoughts would be greatly appreciated . . . > > BTW, I'm getting the error: > err: Could not retrieve catalog from remote server: Error 400 on SERVER: > Could not render to pson: undefined method `merge' for []:Array > > with some very rough code. > > The Type (vncserver.rb): > module Puppet > newtype(:vncserver) do > > ensurable > > newproperty(:port) do > desc "The vnc servers port assignment. Will be +5900 on the server" > validate do |value| > unless value.is_i? > raise Puppet::Error, "Invalid Port number" > end > end > end > > newproperty(:username) do > desc "The user who will own the VNC session." > isnamevar > validate do |value| > unless value !~ /\s/ > raise Puppet::Error, "Must be a valid username. No spaces, > please." > end > end > end > > newproperty(:geometry) do > desc "Resolution for VNC, in XxY, e.g. 1024x768." > validate do |value| > unless value !~ /^\d*x\d*$/ > raise Puppet::Error, "Must be a valid geometry. e.g., 1024x768." > end > end > end > > newparam(:password) do > desc "Password to be put into users .vnc/passwd." > validate do |value| > unless hostpart =~ /^([\d\w]+|[\d\w][\d\w\-]+[\d\w])$/ > raise Puppet::Error, "Invalid host name" > end > end > end > > newparam(:args) do > desc "Optional arguments to be added to the vncserver command-line." > end > 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 > > > The Provider (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 => /^#/; > text_line :blank, :match => /\s*$/; > > text_line :blank, :match => /\s*$/; > > record_line :parsed, :fields => %w{vncservers}, :match => > /^VNCSERVERS="(.*)"/ > > end > > > And The Manifest: > class vncserver { > > include common::vnc > > > package { > 'tigervnc-server': > ensure => 'installed'; > } > > vncserver { > 'gmatz': > port => '92', > geometry => '1024x768', > password => 'gmatz'; > } > } > > -- > 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.