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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Could you provide the output of puppet agent --trace in a pastebin to accompany this? On Thu, Sep 15, 2011 at 1:22 PM, Guy Matz <gmatz@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+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- Adrien Thebo adrien@puppetlabs.com -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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" <gmatz@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 topuppet-users+unsubscribe@googlegroups.com.> For more options, visit this group athttp://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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Adrien, Thanks for the reply. can you tell me what a pastebin is? Thanks, Guy On Thu, Sep 15, 2011 at 6:50 PM, Adrien Thebo <adrien@puppetlabs.com> wrote:> Could you provide the output of puppet agent --trace in a pastebin to > accompany this? > > On Thu, Sep 15, 2011 at 1:22 PM, Guy Matz <gmatz@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+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> > > > > -- > Adrien Thebo > adrien@puppetlabs.com > > -- > 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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Scott, Thanks for the reply!! Can you tell me what you mean by "just a definition"? or point me to a doc? Thanks a lot! Guy On Thu, Sep 15, 2011 at 8:46 PM, Scott Smith <scott@ohlol.net> wrote:> 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" <gmatz@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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
ok, i found out what pastebin is. All on my own!! :-) But puppet agent --trace doesn''t give me very much output. Only: [root@gmatzpupnode ~]# puppet agent --trace /opt/puppet/lib/ruby/site_ruby/1.8/puppet/daemon.rb:47:in `create_pidfile'' /opt/puppet/lib/ruby/site_ruby/1.8/puppet/util.rb:38:in `synchronize_on'' /opt/puppet/lib/ruby/1.8/sync.rb:230:in `synchronize'' /opt/puppet/lib/ruby/site_ruby/1.8/puppet/util.rb:38:in `synchronize_on'' /opt/puppet/lib/ruby/site_ruby/1.8/puppet/daemon.rb:46:in `create_pidfile'' /opt/puppet/lib/ruby/site_ruby/1.8/puppet/daemon.rb:22:in `daemonize'' /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:255:in `setup'' /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application.rb:286:in `run'' /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application.rb:393:in `exit_on_fail'' /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application.rb:286:in `run'' /opt/puppet/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:55:in `execute'' /usr/local/bin/puppet:4 Could not prepare for execution: Could not create PID file: /var/run/pe-puppet/agent.pid it looks like it''s failing, actually . . . thanks, guy On Thu, Sep 15, 2011 at 6:50 PM, Adrien Thebo <adrien@puppetlabs.com> wrote:> Could you provide the output of puppet agent --trace in a pastebin to > accompany this? > > On Thu, Sep 15, 2011 at 1:22 PM, Guy Matz <gmatz@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+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> > > > > -- > Adrien Thebo > adrien@puppetlabs.com > > -- > 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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
With respect to this recent error, I''m guessing that the path to the pid file doesn''t exist. With the issue you''ve been having on the type/provider itself, I believe that I found that the parsedfile provider generally has name hard coded as the namevar. This may be a bit far fetched, but see if changing the name of the namevar to ''name'' and see if it fixes things. It''s a hack really, but perhaps it''ll get you what you want. On Sat, Sep 17, 2011 at 8:44 AM, Guy Matz <gmatz@matz.org> wrote:> ok, i found out what pastebin is. All on my own!! :-) But puppet agent > --trace doesn''t give me very much output. Only: > [root@gmatzpupnode ~]# puppet agent --trace > /opt/puppet/lib/ruby/site_ruby/1.8/puppet/daemon.rb:47:in `create_pidfile'' > /opt/puppet/lib/ruby/site_ruby/1.8/puppet/util.rb:38:in `synchronize_on'' > /opt/puppet/lib/ruby/1.8/sync.rb:230:in `synchronize'' > /opt/puppet/lib/ruby/site_ruby/1.8/puppet/util.rb:38:in `synchronize_on'' > /opt/puppet/lib/ruby/site_ruby/1.8/puppet/daemon.rb:46:in `create_pidfile'' > /opt/puppet/lib/ruby/site_ruby/1.8/puppet/daemon.rb:22:in `daemonize'' > /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:255:in > `setup'' > /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application.rb:286:in `run'' > /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application.rb:393:in > `exit_on_fail'' > /opt/puppet/lib/ruby/site_ruby/1.8/puppet/application.rb:286:in `run'' > /opt/puppet/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:55:in > `execute'' > /usr/local/bin/puppet:4 > Could not prepare for execution: Could not create PID file: > /var/run/pe-puppet/agent.pid > > > it looks like it''s failing, actually . . . > > thanks, > guy > > > On Thu, Sep 15, 2011 at 6:50 PM, Adrien Thebo <adrien@puppetlabs.com>wrote: > >> Could you provide the output of puppet agent --trace in a pastebin to >> accompany this? >> >> On Thu, Sep 15, 2011 at 1:22 PM, Guy Matz <gmatz@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+unsubscribe@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/puppet-users?hl=en. >>> >> >> >> >> -- >> Adrien Thebo >> adrien@puppetlabs.com >> >> -- >> 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+unsubscribe@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+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- Adrien Thebo adrien@puppetlabs.com -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Thu, Sep 15, 2011 at 04:22:45PM -0400, Guy Matz 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[...]> newproperty(:username) do[...]> newproperty(:geometry) do[...]> end > > The Provider (parsed.rb):[...]> record_line :parsed, :fields => %w{vncservers}, :match => > /^VNCSERVERS="(.*)"/ > > end >You have defined three properties (port, username, geometry) but your provider is not able to retrieve or write any of these properties. So how does a line in vncservers actually looks like? How can you get port, username and geometry of a certain vncserver? -Stefan
Stefan, thanks again for your reply. I''m just trying to get something working, even if it doesn''t actually do anything yet . . . On Mon, Sep 19, 2011 at 1:48 PM, Stefan Schulte < stefan.schulte@taunusstein.net> wrote:> On Thu, Sep 15, 2011 at 04:22:45PM -0400, Guy Matz 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 > [...] > > newproperty(:username) do > [...] > > newproperty(:geometry) do > [...] > > end > > > > The Provider (parsed.rb): > [...] > > record_line :parsed, :fields => %w{vncservers}, :match => > > /^VNCSERVERS="(.*)"/ > > > > end > > > > You have defined three properties (port, username, geometry) but your > provider is not able to retrieve or write any of these properties. So > how does a line in vncservers actually looks like? How can you get port, > username and geometry of a certain vncserver? > > -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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
But to answer your question, vncservers file is a little different . . . there are two type of lines: 1. contains a space-separated list of port and usernames separated by colons, e.g.: VNCSERVERS="92:gmatz 44:wsmith" 2. contains arguments to be supplied to vncserver, with port number acting as an aray index, e.g.: VNCSERVERARGS[92]="-geometry 1280x1024" VNCSERVERARGS[44]="-geometry 1280x1024" I was hoping to parse the vncserver config file using two different type of record_lines, one for each of the line types . . . thanks, guy On Mon, Sep 19, 2011 at 1:48 PM, Stefan Schulte < stefan.schulte@taunusstein.net> wrote:> On Thu, Sep 15, 2011 at 04:22:45PM -0400, Guy Matz 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 > [...] > > newproperty(:username) do > [...] > > newproperty(:geometry) do > [...] > > end > > > > The Provider (parsed.rb): > [...] > > record_line :parsed, :fields => %w{vncservers}, :match => > > /^VNCSERVERS="(.*)"/ > > > > end > > > > You have defined three properties (port, username, geometry) but your > provider is not able to retrieve or write any of these properties. So > how does a line in vncservers actually looks like? How can you get port, > username and geometry of a certain vncserver? > > -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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.