Hi Baz,

There are two APIs for custom types/providers within modern Puppet.

The “old” API uses the Puppet::Type.newtype syntax.
I gave a talk on this topic a couple of years ago:
https://www.slideshare.net/PuppetLabs/puppetconf-2016-moving-from-exec-to-types-and-providers-martin-alfke-example42-gmbh
 
<https://www.slideshare.net/PuppetLabs/puppetconf-2016-moving-from-exec-to-types-and-providers-martin-alfke-example42-gmbh>
https://www.youtube.com/watch?v=Jr8H0wSUMBY 
<https://www.youtube.com/watch?v=Jr8H0wSUMBY>

The resourceapi is the “newer” API and uses Puppet::ResourceApi.register_type
https://puppet.com/docs/puppet/7/about_the_resource_api.html 
<https://puppet.com/docs/puppet/7/about_the_resource_api.html>
It is integrated in PDK (pdk new provider)

Note: The new Resource API can not handle refreshonly as default implementation.
You must implement this behaviour by yourself.

Choose the solution which you are more comfortable with.

Best,
Martin

> On 24. Mar 2022, at 11:29, barry haycock <bdhayc...@gmail.com> wrote:
> 
> I am migrating a Puppet 3.x to Puppet 7.x and am having to rewrite alot of 
> the code.
> 
> This includes a number of custom modules and my first foray into writing 
> custom functions/providers.
> This is where I am getting stuck as there is not really a lot of information 
> on this.
> Looking at existing Puppet modules they all seem to have been written using 
> 'Type.newtype' format,
> where as the latest puppet docs state I should be using the 'resourceapi' 
> gem/format.
> looking over recent releases on the forge shows that everyone still appears 
> to be using the old format.
> 
> What are the brains trust using and have you migrated over to resourceapi?
> 
> Would also like some better information on writing/testing custom functions 
> other than
> outdated books, URL's if anyone can point them my way.
> I haven't had much luck finding anything recent and related.
> 
> Baz
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to puppet-users+unsubscr...@googlegroups.com 
> <mailto:puppet-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/0feac523-d4a2-4d15-846c-d9304d0f8cfan%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/puppet-users/0feac523-d4a2-4d15-846c-d9304d0f8cfan%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/D8DF1B4D-588A-4991-84EE-8B2FF758730A%40gmail.com.

Reply via email to