Skip to content

Commit

Permalink
Generate a more explict form for driver & provisioner in kitchen init.
Browse files Browse the repository at this point in the history
There is a simple/default for for specify the driver and provisioner
names like so:

    driver: vagrant
    provisioner: chef_zero

which is really equivalent to:

    driver:
      name: vagrant
    provisioner:
      name: chef_zero

Since the latter is easier to add to and doesn't require any knowledge,
it should probably be the default form that newcomers see for the first
time.

Thanks to @webframp for the discussion.
  • Loading branch information
fnichol committed Nov 30, 2013
1 parent 3ff0a50 commit 5f10955
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
37 changes: 30 additions & 7 deletions features/kitchen_init_command.feature
Expand Up @@ -21,7 +21,11 @@ Feature: Add Test Kitchen support to an existing project
And a directory named "test/integration/default" should exist
And the file ".gitignore" should contain ".kitchen/"
And the file ".gitignore" should contain ".kitchen.local.yml"
And the file ".kitchen.yml" should contain "driver: vagrant"
And the file ".kitchen.yml" should contain:
"""
driver:
name: vagrant
"""
And a file named "Gemfile" should not exist
And a file named "Rakefile" should not exist
And a file named "Thorfile" should not exist
Expand Down Expand Up @@ -104,24 +108,40 @@ Feature: Add Test Kitchen support to an existing project
first driver given
Given an empty file named "Gemfile"
When I successfully run `kitchen init --driver=kitchen-bluebox kitchen-wakka`
Then the file ".kitchen.yml" should contain "driver: bluebox"
Then the file ".kitchen.yml" should contain:
"""
driver:
name: bluebox
"""

Scenario: Running init with no drivers sets the plugin_driver to the
dummy driver
Given an empty file named "Gemfile"
When I successfully run `kitchen init --no-driver`
Then the file ".kitchen.yml" should contain "driver: dummy"
Then the file ".kitchen.yml" should contain:
"""
driver:
name: dummy
"""

Scenario: Running init without a provisioner sets the default provisioner
to chef_solo in .kitchen.yml
Given an empty file named "Gemfile"
When I successfully run `kitchen init --no-driver`
Then the file ".kitchen.yml" should contain "provisioner: chef_solo"
Then the file ".kitchen.yml" should contain:
"""
provisioner:
name: chef_solo
"""

Scenario: Running init with a provisioner sets the provisioner in .kitchen.yml
Given an empty file named "Gemfile"
When I successfully run `kitchen init --no-driver --provisioner=chef_zero`
Then the file ".kitchen.yml" should contain "provisioner: chef_zero"
Then the file ".kitchen.yml" should contain:
"""
provisioner:
name: chef_zero
"""

Scenario: Running with a Rakefile file appends Kitchen tasks
Given an empty file named "Gemfile"
Expand Down Expand Up @@ -172,8 +192,11 @@ Feature: Add Test Kitchen support to an existing project
Then the file ".kitchen.yml" should contain exactly:
"""
---
driver: vagrant
provisioner: chef_solo
driver:
name: vagrant
provisioner:
name: chef_solo
platforms:
- name: ubuntu-12.04
Expand Down
7 changes: 5 additions & 2 deletions templates/init/kitchen.yml.erb
@@ -1,6 +1,9 @@
---
driver: <%= config[:driver_plugin] %>
provisioner: <%= config[:provisioner] %>
driver:
name: <%= config[:driver_plugin] %>

provisioner:
name: <%= config[:provisioner] %>

platforms:
- name: ubuntu-12.04
Expand Down

0 comments on commit 5f10955

Please sign in to comment.