Kitchen mulitple chef runs

Is it possible to have kitchen run chef on a new machine twice with
different node attributes?

My primary goal is to test an upgrade feature of a cookbook. do one run
with the old version then do another run with a new version.

If it is possible my google skills have failed me and I need some
assistance in finding it.

Bill Warner

It's a wee-bit hackish, but I've used .kitchen.local.yml for this purpose,
populating it with the override stuff, naming it something different, and
then moving it into place when needed.

  • run kitchen verify
  • mv kitchen-phase2 .kitchen.local.yml
  • run kitchen converge && kitchen verify
  • mv .kitchen.local.yml kitchen-phase2

Okay.... not "wee-bit hackish," it's ugly as sin :slight_smile: But it may help you
out.

Adam

On Fri, Mar 20, 2015 at 21:35 Bill Warner bill.warner@gmail.com wrote:

Is it possible to have kitchen run chef on a new machine twice with
different node attributes?

My primary goal is to test an upgrade feature of a cookbook. do one run
with the old version then do another run with a new version.

If it is possible my google skills have failed me and I need some
assistance in finding it.

--

Bill Warner

I always forget that .kitchen.yml is passed through ERb, so this may be
even easier. In your .kitchen.yml:

attributes:
<% if ENV['UPGRADE'] == 'true' %>
do_upgrade: true
<% else %>
do_upgrade: false
<% end %>

... and then run kitchen twice but changing your environ meant variable:

kitchen verify
export UPGRADE=true
kitchen converge && kitchen verify

Disclaimer: haven't tried it yet, but peeking at the code leads me to
believe this should work!

Adam

On Fri, Mar 20, 2015 at 21:41 Adam Leff adam@leff.co wrote:

It's a wee-bit hackish, but I've used .kitchen.local.yml for this purpose,
populating it with the override stuff, naming it something different, and
then moving it into place when needed.

  • run kitchen verify
  • mv kitchen-phase2 .kitchen.local.yml
  • run kitchen converge && kitchen verify
  • mv .kitchen.local.yml kitchen-phase2

Okay.... not "wee-bit hackish," it's ugly as sin :slight_smile: But it may help you
out.

Adam

On Fri, Mar 20, 2015 at 21:35 Bill Warner bill.warner@gmail.com wrote:

Is it possible to have kitchen run chef on a new machine twice with
different node attributes?

My primary goal is to test an upgrade feature of a cookbook. do one run
with the old version then do another run with a new version.

If it is possible my google skills have failed me and I need some
assistance in finding it.

--

Bill Warner

There's also an ENV variable you can set to point at different .yml files

export KITCHEN_YAML=.kitchen.seq-1.yml ; kitchen converge ; kitchen verify
export KITCHEN_YAML=.kitchen.seq-2.yml ; kitchen converge ; kitchen verify
export KITCHEN_YAML=.kitchen.seq-3.yml ; kitchen converge ; kitchen verify

-s

On Sat, Mar 21, 2015 at 9:05 AM, Adam Leff adam@leff.co wrote:

I always forget that .kitchen.yml is passed through ERb, so this may be even
easier. In your .kitchen.yml:

attributes:
<% if ENV['UPGRADE'] == 'true' %>
do_upgrade: true
<% else %>
do_upgrade: false
<% end %>

... and then run kitchen twice but changing your environ meant variable:

kitchen verify
export UPGRADE=true
kitchen converge && kitchen verify

Disclaimer: haven't tried it yet, but peeking at the code leads me to
believe this should work!

Adam

On Fri, Mar 20, 2015 at 21:41 Adam Leff adam@leff.co wrote:

It's a wee-bit hackish, but I've used .kitchen.local.yml for this purpose,
populating it with the override stuff, naming it something different, and
then moving it into place when needed.

  • run kitchen verify
  • mv kitchen-phase2 .kitchen.local.yml
  • run kitchen converge && kitchen verify
  • mv .kitchen.local.yml kitchen-phase2

Okay.... not "wee-bit hackish," it's ugly as sin :slight_smile: But it may help you
out.

Adam

On Fri, Mar 20, 2015 at 21:35 Bill Warner bill.warner@gmail.com wrote:

Is it possible to have kitchen run chef on a new machine twice with
different node attributes?

My primary goal is to test an upgrade feature of a cookbook. do one run
with the old version then do another run with a new version.

If it is possible my google skills have failed me and I need some
assistance in finding it.

--

Bill Warner

I'll give these a try and see what ends up working the best. Thanks all.

On Sat, Mar 21, 2015 at 9:16 AM, Sean OMeara someara@chef.io wrote:

There's also an ENV variable you can set to point at different .yml files

export KITCHEN_YAML=.kitchen.seq-1.yml ; kitchen converge ; kitchen verify
export KITCHEN_YAML=.kitchen.seq-2.yml ; kitchen converge ; kitchen verify
export KITCHEN_YAML=.kitchen.seq-3.yml ; kitchen converge ; kitchen verify

-s

On Sat, Mar 21, 2015 at 9:05 AM, Adam Leff adam@leff.co wrote:

I always forget that .kitchen.yml is passed through ERb, so this may be
even
easier. In your .kitchen.yml:

attributes:
<% if ENV['UPGRADE'] == 'true' %>
do_upgrade: true
<% else %>
do_upgrade: false
<% end %>

... and then run kitchen twice but changing your environ meant variable:

kitchen verify
export UPGRADE=true
kitchen converge && kitchen verify

Disclaimer: haven't tried it yet, but peeking at the code leads me to
believe this should work!

Adam

On Fri, Mar 20, 2015 at 21:41 Adam Leff adam@leff.co wrote:

It's a wee-bit hackish, but I've used .kitchen.local.yml for this
purpose,
populating it with the override stuff, naming it something different,
and
then moving it into place when needed.

  • run kitchen verify
  • mv kitchen-phase2 .kitchen.local.yml
  • run kitchen converge && kitchen verify
  • mv .kitchen.local.yml kitchen-phase2

Okay.... not "wee-bit hackish," it's ugly as sin :slight_smile: But it may help you
out.

Adam

On Fri, Mar 20, 2015 at 21:35 Bill Warner bill.warner@gmail.com
wrote:

Is it possible to have kitchen run chef on a new machine twice with
different node attributes?

My primary goal is to test an upgrade feature of a cookbook. do one
run
with the old version then do another run with a new version.

If it is possible my google skills have failed me and I need some
assistance in finding it.

--

Bill Warner

--

Bill Warner