Puppet Types auto generator

38 views
Skip to first unread message

Christoph Andreas Torlinsky

unread,
Apr 7, 2016, 9:23:51 AM4/7/16
to Puppet Users
Hello there, i'm looking for a puppet types generator tool / toolkit as we have an API (Restful interface) and spec files that we would like
to convert to puppet types for some use. If anyone has any tips, that is most welcomed. 

many thanks, 

c

Trevor Vaughan

unread,
Apr 7, 2016, 9:46:23 AM4/7/16
to puppet...@googlegroups.com
Hi,

It's not a generator, but this should get you started with an understandable example framework https://forge.puppet.com/onyxpoint/learning_custom_types.

It doesn't cover 100% of the functionality but it will allow you to create an understandable and maintainable Type and Provider.

Thanks,

Trevor

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/d714b52a-c7f7-4104-ba1a-cb697a893d0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699

-- This account not approved for unencrypted proprietary information --

Christoph Andreas Torlinsky

unread,
Apr 8, 2016, 3:47:59 PM4/8/16
to Puppet Users
thanks

c

Corey Osman

unread,
Apr 9, 2016, 10:49:18 AM4/9/16
to Puppet Users
I have taken a stab at generating types, providers and other items with puppet-retrospec.


retrospec puppet new_type -h

Generates a new type with the given name, parameters, and properties.
  -n, --name=<s>           The name of the type you wish to create
  -p, --parameters=<s+>    A list of parameters to initialize your type with
                           (default: name)
  -a, --properties=<s+>    A list of properties to initialize your type with
                           (default: )
  -r, --providers=<s+>     A list of providers to create and associate with
                           this type (default: default)
  -h, --help               Show this message


Corey

Gareth Rushgrove

unread,
Apr 9, 2016, 12:57:08 PM4/9/16
to puppet...@googlegroups.com
Hey Christoph

On 7 April 2016 at 09:15, Christoph Andreas Torlinsky
I'm aware of two public projects that do this currently (if other
folks know of others please link to them here, that would be great to
see):

The Puppet Labs DSC module generates the types based on DSC MOF files:

https://github.com/puppetlabs/puppetlabs-dsc/blob/master/build/dsc/templates/dsc_type.rb.erb

And my Kubernetes module
(https://github.com/garethr/garethr-kubernetes/) generates all the
types and providers based on a Swagger specification. You can see the
implementation of the generator in this repo:
https://github.com/garethr/puppet-swagger-generator. The code is
pretty rough but it works really well.

I'm not aware of any higher-level tools yet for doing this. It's not a
super common pattern yet, but my guess is it will become more and more
interesting/powerful as more and more software ships with first class
APIs for integration. If anyone wants to chat more about that problem
let me know.

Cheers

Gareth


> many thanks,
>
> c
>
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/d714b52a-c7f7-4104-ba1a-cb697a893d0a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Gareth Rushgrove
@garethr

devopsweekly.com
morethanseven.net
garethrushgrove.com
Reply all
Reply to author
Forward
0 new messages