Ask Your Question

Status of generate method on custom type?

asked 2015-12-30 07:18:49 -0600

dbschofield gravatar image

I am interested in using the generate method on a custom type to do some sub-resource management work. However I can find no documentation regarding the generate callback for a type class which make me nervous to make my custom type dependent on it. Is this safe to use? Will it be stable and supported in future releases?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2016-01-05 12:19:09 -0600

Branan gravatar image

updated 2016-01-05 12:32:27 -0600

Unfortunately there is no well-defined API around types and providers. As far as generate goes, though, that is on the list of things that we are unlikely to touch, since it is widely used outside of Puppet Labs.

As a rule when we are looking at defining APIs in places where Puppet is unclear on what's public, we do our best to create a parallel implementation with a long deprecation period (see the "future" parser which became Puppet 4). "Generate" will not go away until we have had such a transition period with a new Type API. We've been talking about doing so, but it's still pretty far in the future. You should feel confident using generate, and when we have a new API that functionality will definitely still exist.

edit flag offensive delete link more

answered 2015-12-30 19:04:05 -0600

GregLarkin gravatar image

Can you provide a bit more detail about what you're trying to do? The generate function is used from the Puppet DSL to invoke a process on the master during catalog compilation. You can spawn subprocesses from your custom type/provider directly, so I'm not sure if you need the generate function.

With more information, though, perhaps I can understand more specifically what you'd like to do and can offer some options.

edit flag offensive delete link more

answered 2015-12-31 07:41:26 -0600

dbschofield gravatar image

To clarify, I am not referring to the generate method available in the Puppet DSL. But rather to the generate callback on a custom type which generates resources. The user resource makes use of this method to generate sshauthorizedkey resources and setting their ensure state to absent for purging. ( I am basically doing the same thing with middleware products which have their own management API. When an instance of a middleware product is laid down the custom type will discover all the sub-resources via the management API and mark any resources found on the server but not found in the catalog for purging.

It works great following the pattern established by the user resource. But the lack of documentation in puppetlabs literature makes me nervous I may be setting my company up for difficulties should the method be deprecated or changed. So my question is if the generate method is a stable public API for custom types?

edit flag offensive delete link more


Hi again, and thanks for the clarification on the generate callback vs. the DSL function. I checked with various members of the engineering team, and the consensus is that you can safely use that callback without any concern for deprecation in the forseeable future. Hope that helps!

GregLarkin gravatar imageGregLarkin ( 2016-01-05 12:17:33 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-12-30 07:18:49 -0600

Seen: 108 times

Last updated: Jan 05 '16