Unable to use custom-defined property for new resource type

7 views
Skip to first unread message

Manish Chakravarty

unread,
Apr 19, 2009, 9:11:53 AM4/19/09
to Puppet Developers, brian...@gmail.com
Hello everyone,

I am working on developing a monit provider for puppet but I seem to
have run into a (simple) issue.
I have defined a new property called "pid" which I want to be able to
specify in site.pp

Here's my current site.pp
node default
{
monit
{
"mongrel":
pid = > "manish",
ensure => present,
target => "/home/manish/monitrc",

}
}

This is the error trace
manish@manish-laptop:~$ sudo puppetd --server manish-laptop --test --
verbose
info: Retrieving plugins
err: /File[/var/lib/puppet/lib]: Failed to generate additional
resources during transaction: Cannot access mount[plugins]
err: /File[/var/lib/puppet/lib]: Failed to retrieve current state of
resource: Cannot access mount[plugins] Could not describe /plugins:
Cannot access mount[plugins]
info: Caching catalog at /var/lib/puppet/state/localconfig.yaml
notice: Starting catalog run
notice: //Node[default]/Monit[mongrel]/ensure: created
err: Got an uncaught exception of type ArgumentError: Field 'pid' is
required
info: Sent transaction report in 0.15 seconds
notice: Finished catalog run in 0.21 seconds

Here's my monit.rb
=============

module Puppet
newtype(:monit) do
@doc = "Manages monitrc"

ensurable

newparam(:processName, :namevar => true ) do
desc "The process to manage eg: mongrel_8001"
isnamevar
end

newproperty(:pid) do
desc "Location of the monitrc file file"
end

newproperty(:target) do
desc "Location of the monitrc file file"
defaultto { if
@resource.class.defaultprovider.ancestors.include?
(Puppet::Provder::ParsedFile)
@resource.class.defaultprovider.default_target
else
nil
end
}
end


end
end

============

and here's my parsed.rb
=================

require 'puppet/provider/parsedfile'

Puppet::Type.type(:monit).provide(:parsed,
:parent => Puppet::Provider::ParsedFile,
:default_target => '',
:filetype => :flat
) do

desc "The monit provider that uses the ParsedFile class"
text_line :comment, :match => /^#/;
text_line :blank, :match => /^\s*$/;

record_line :parsed, :fields => %w{name pid}
end

================

I think I am doing something wrong here.
Is the way that I have define the "pid" property wrong ( please see my
monit.rb )

Can someone help me resolve this ?

Thanks in advance!
Manish Chakravarty

Luke Kanies

unread,
Apr 20, 2009, 11:16:12 AM4/20/09
to puppe...@googlegroups.com


This looks right, but have you tried it with an actual default
target? I don't think that's the problem, but it might help resolve it.

Any progress since you sent the email?

--
The Roman Rule:
The one who says it cannot be done should never interrupt the
one who is doing it.
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com

Reply all
Reply to author
Forward
0 new messages