[chef] Re: Re: Re: Re: Re: Re: Re: Re: Tips for running a script before kitchen converge?


Chronological Thread 
  • From: Torben Knerr < >
  • To: " " < >
  • Subject: [chef] Re: Re: Re: Re: Re: Re: Re: Re: Tips for running a script before kitchen converge?
  • Date: Wed, 30 Sep 2015 22:12:37 +0200

Hey Brian,

the vagrant-triggers plugin might come in handy for this:

HTH, Torben

On Wed, Sep 30, 2015 at 7:35 PM, Brian O'Connell < " target="_blank"> > wrote:
Torben - 
  Thanks for sharing.  Its a nifty solution.  In my case, I have things I want to do outside the VMs to prepare for each converge.  I want to package up some files to be placed into the the data_path.  I am not sure how to handle that in vagrantfile.  
 
 
 
 
----- Original message -----
From: Torben Knerr < " target="_blank"> >
To: " target="_blank">
Cc: " " target="_blank"> " < " target="_blank"> >
Subject: [chef] Re: Re: Re: Re: Re: Re: Tips for running a script before kitchen converge?
Date: Wed, Sep 30, 2015 1:11 PM
 
I had a similar issue and came to this solution:
 
 * create a global ~/.kitchen/config.yml which tells to run the provisioners for the vagrant driver (e.g. https://github.com/tknerr/bills-kitchen/blob/master/files/home/.kitchen/config.yml)
 * create a global ~/.vagrant.d/Vagrantfile with a shell provisioner (e.g. https://github.com/tknerr/bills-kitchen/blob/master/files/home/.vagrant.d/Vagrantfile#L23-L26)
 
In my case I have the whole ~/ directory under control, and I wanted it to apply globally rather than repreating in every project kitchen / Vagrantfile. Should work for local ones too
 
Just for inspiration...
 
HTH, Torben
 
 
On Wed, Sep 30, 2015 at 5:14 PM, Yoshi Spendiff < " target="_blank"> > wrote:
Looks like it's in the works: https://github.com/test-kitchen/test-kitchen/issues/329
 
You might have to use regular Vagrant for now as that supports multiple provisioners (i.e. run the shell provisioner before Chef)
 
On 29 September 2015 at 20:18, Brian O'Connell < " target="_blank"> > wrote:
I am struggling with a similar scenario.  As part of our chefdk bootstrap, we package up a set of cookbooks using berks package.  We have a a curl bash that end users execute to install/update the dev environment.
 
We have been testing using test kitchen w/ the chef provisioner but because the testing doesn't fully simulate our real environment (chef may or may not be installed, bash script to start the process not run) we have had a couple of defects escape testing.
 
The pre_create_command doesn't work because we want these set of commands to be run before every converge, not just the first create.
I have considered using the vagrantfiles directive with a custom vagrant file, but its not clear to me that would help since that only seems to get executed on create as well.
 
I could create a script that does this, but that i somewhat unsatisfying because it fights against the muscle memory for all of our other cookbooks. 
 
Has anyone come across a good solution to resolve this in test kitchen?  It feels like a pre_converge_command would be optimal for this sort of scenario.
 

Thanks, 
Brian
 
 
----- Original message -----
From: Robert Freiberger < " target="_blank"> >
To: " " target="_blank"> " < " target="_blank"> >
Cc:
Subject: [chef] Re: Re: Re: Tips for running a script before kitchen converge?
Date: Tue, Sep 29, 2015 5:46 PM
 
Hello, 
 
Thanks Brandon and Steve for your recommendations. Apologies as I was away but I'm testing these features now. My original goal was to edit a Vagrant box and make some changes (just add a Ruby script to execute during start up) but after reading, might be easier to keep this separate. 
 
Thanks again,
Robert
 
You can tell vagrant to use it's shell provisioner, but you'd likely need to provide a custom vagrantfile.erb (there's a parameter for that in the kitchen-vagrant driver).
 
The pre_create_command happens before the vagrant up, so that'd be something more for prepping your host environment (maybe staging sync'd folders or something).
 
Steve
 
 
On Fri, Sep 18, 2015 at 4:44 AM, Brandon Raabe < " target="_blank"> > wrote:
Hey Robert,
 
I'm not sure what's in the script, but the `pre_create_command` option may be what you're looking for. I'm assuming you're using kitchen-vagrant.
 
 
 
On Thu, Sep 17, 2015 at 2:53 PM, Robert Freiberger < " target="_blank"> > wrote:
Hello, 
 
I'm working on a simple Vagrant box with Test Kitchen and pretty sure this is a simple request. Is it possible to execute a script before kitchen converge? Maybe I'm not seeing this, but I checked the options from Test Kitchen. 
 
I really would like to stay away from customizing the box file if possible. 
 
Thanks,
Robert
 
 
--
Steven Murawski
Community Software Development Engineer @ Chef
Microsoft MVP - PowerShell
http://stevenmurawski.com
 
 





Archive powered by MHonArc 2.6.16.

§