writing providers

60 views
Skip to first unread message

Darin Perusich

unread,
Sep 25, 2012, 11:09:20 AM9/25/12
to puppet...@googlegroups.com
Hello All,

Does anyone have any good documentation, with examples, on writing
providers? I have both the puppet books and I've been reviewing the
various providers that are distributed w/puppet and modules but I'm
not seeing things like how to properly execute commands, best way to
parse output, or how to debug them during development.

Thanks!

--
Later,
Darin

Cosmin-Viorel Ilie

unread,
Sep 25, 2012, 1:40:46 PM9/25/12
to puppet...@googlegroups.com

Jakov Sosic

unread,
Sep 25, 2012, 1:47:52 PM9/25/12
to puppet...@googlegroups.com
I can send you my providers for Cobbler that I am writing.


They are kinda simple so you can get around? Drop me a private mail if
you want.

Justin Stoller

unread,
Sep 25, 2012, 2:14:03 PM9/25/12
to puppet...@googlegroups.com
I know that yours was more a question for the community but have you
checked out:
http://docs.puppetlabs.com/puppet/#hacking-and-extending

If those aren't super helpful we'd love to make them better.


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

Darin Perusich

unread,
Sep 25, 2012, 5:16:12 PM9/25/12
to puppet...@googlegroups.com
HI Justin,

I have reviewed those documents and the Provider Development doc
doesn't tell me much more than what a provider does. There are no
example other than how to set a command or limit to a certain system
type. Take for example the docs on Using Parameterized Classes. I can
take that document and after reading it can start writing a
parameterized class to fit most situations, you can't do that with the
provider docs.

--
Later,
Darin

Jakov Sosic

unread,
Sep 25, 2012, 5:50:36 PM9/25/12
to puppet...@googlegroups.com
On 09/25/2012 08:14 PM, Justin Stoller wrote:
> I know that yours was more a question for the community but have you
> checked out:
> http://docs.puppetlabs.com/puppet/#hacking-and-extending
>
> If those aren't super helpful we'd love to make them better.

Hmm, I've read:
http://docs.puppetlabs.com/guides/custom_types.html
2 or 3 times when I started, but somehow I missed the links to:

http://docs.puppetlabs.com/guides/complete_resource_example.html
and
http://docs.puppetlabs.com/guides/provider_development.html

Maybe you could add a link to next article at the end of the current one?


Now that I've gone through the second one, I finally get the idea of
param vs property.

Also, I think you should add puppet code snippet in "Complete resource
example", so that the reader can get an idea about how the puppet code
will look like and how the "engine" (type/provider) behind it works and
should be implemented. For someone who starts from scratch it's hard to
understand why all that code if you didn't provide resource example for
the code you want to write.

So, IMHO, that article should look something like this:

"if you want to write a custom type for foo, which has param bar and
property boo, like this:

foo {"myfoo":
ensure => present,
bar => 'something',
boo => 'something_else',
}

you should start by coding type...."

Or at lease, this kind of snippet should be present at the bottom of the
article so people can connect those two things.


Next thing I didn't see is - when to use param and when to use property?
What is current best practice and what do puppet-guys suggest...

And finally - hashes... Maybe another (advanced) article describing
hashes and how to generate hash from current system state, and how to
apply settings from hash to the system (in property methods). I could
help about this one because I've really pushed to get it done with just
reading f5_pool and f5_message providers, and trying/failing
consistently until I figured it out...


--
Jakov Sosic
www.srce.unizg.hr
Reply all
Reply to author
Forward
0 new messages