Skip to end of metadata
Go to start of metadata


While we love Ruby, you should be able to write Chef cookbooks in your language of choice. In order to complete this process, the following changes to Chef are necessary:

Chef::CookbookLoader must understand different languages file types

Currently, the cookbook loader looks for '*.rb' files. It will need to load all the files in the tree that we understand how to parse.

Chef::Cookbook needs to run files for each language

Now that the cookbooks can contain files of different languages, we need to be able to execute them. This process is as follows:

For attributes

We should shell out to the proper interpreter, passing the node object as JSON. We should read the node object back out, replacing the original with the new version.

For libraries

We should include the libraries for the given language as included on the command line (when supported).

For definitions

In order for definitions to work, we need to have a mechanism for re-constituting a Chef::ResourceDefinition object in ruby for each. That will allow us to take the resources generated in any language and utilize the definition for each properly.

For recipes

The languages should send out an interim-format as JSON for the resources to add to the collection. We should then take this format and build resource objects as normal, doing validation. (This differs from the perl-based prototype I have currently, which spits out raw Chef::Resource objects.) This will allow us to keep all the same validation, etc. that exists in the ruby libs.

Perl Prototype

A working Perl prototype exists, that works for just recipes. You can find it on CPAN and the source on GitHub. To give it a shot:

  • Install the Chef perl module, and its dependencies. (Moose and JSON::Any)
  • Stick the perl cookbook in your chef repository.
  • Put your perl recipes in the cookbooks files/default/perl_recipes directory, and watch in amazement as they get executed.
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.