Test kitchen defaults


#1

Hi,

I get a .kitchen.yml file when ever I run ‘chef generate cookbook foo’. Almost every time I end up wanting to edit that file. Is there a way to set some defaults, ie for platforms and what not?

Thanks!

jeff.


#2

@Jeff, you can make your own generator cookbook to set whatever defaults
you want and then pass that to chef generate using the -f flag.

The dudes at DNSimple posted a nice blog article about it a couple months
back. I used this as a guide to create my own generator cookbook and it
works very well.

If you have any trouble or questions I can help.

http://blog.dnsimple.com/2014/07/chef-at-dnsimple/

-Jason

On Fri, Oct 31, 2014 at 9:05 AM, Jeff MacDonald jeff@terida.com wrote:

Hi,

I get a .kitchen.yml file when ever I run ‘chef generate cookbook foo’.
Almost every time I end up wanting to edit that file. Is there a way to
set some defaults, ie for platforms and what not?

Thanks!

jeff.


#3

I’ll also point out that ChefDK just recently gained the ability to read your knife.rb config file, which means it is now possible to give ChefDK the ability to configure a default generator cookbook. The client team at Chef Software will get to this eventually, but if you want this feature right away, it should be an easy-ish patch. If you’re interested but need help getting started hacking on ChefDK, start a thread on the chef-dev list and/or join our CHEF office hours hangouts on Mondays and Wednesdays.


Daniel DeLeo

On Friday, October 31, 2014 at 6:55 AM, Jay Reslock wrote:

@Jeff, you can make your own generator cookbook to set whatever defaults you want and then pass that to chef generate using the -f flag.

The dudes at DNSimple posted a nice blog article about it a couple months back. I used this as a guide to create my own generator cookbook and it works very well.

If you have any trouble or questions I can help.

http://blog.dnsimple.com/2014/07/chef-at-dnsimple/

-Jason

On Fri, Oct 31, 2014 at 9:05 AM, Jeff MacDonald <jeff@terida.com (mailto:jeff@terida.com)> wrote:

Hi,

I get a .kitchen.yml file when ever I run ‘chef generate cookbook foo’. Almost every time I end up wanting to edit that file. Is there a way to set some defaults, ie for platforms and what not?

Thanks!

jeff.


#4

Hi Jeff,

I submitted a PR recently to allow us to feed arbitrary JSON data into the generator cookbooks, just like we already can with the chef-client:

https://github.com/opscode/chef-dk/pull/211

I think it would enable your use case, as you could feed in some arbitrary platform data and have the generator cookbook act accordingly. Our use case is similar – we want to branch our generator logic based on input from the user running the command. Right now, the only inputs are hard-coded.

Cheers,


From: Jeff MacDonald [jeff@terida.com]
Sent: Friday, October 31, 2014 8:05 AM
To: chef@lists.opscode.com
Subject: [chef] Test kitchen defaults

Hi,

I get a .kitchen.yml file when ever I run ‘chef generate cookbook foo’. Almost every time I end up wanting to edit that file. Is there a way to set some defaults, ie for platforms and what not?

Thanks!

jeff.