Adding Attributes to Test Kitchen

Kevin Meredith picture Kevin Meredith · Apr 22, 2014 · Viewed 18.1k times · Source

I'm trying to override attributes in the java cookbook with test-kitchen.

When I try run kitchen converge default-centos-64, a bad YAML error shows up.

---
driver:
  name: vagrant
  customize:
    memory: 1024
    cpuexecutioncap: 50

provisioner:
  name: chef_solo

platforms:
  - name: centos-6.4

suites:
  - name: default
    run_list: 
      - recipe[java::default]
      - recipe[maven::default]
    attributes: {
                  java.install_flavor: "oracle",
                  java.jdk_version: "7"
                }

I pasted the above into http://yamllint.com/. When I hit "Go," it removes all lines beginning at "attributes", and then shows a Green "Valid YAML".

Answer

StephenKing picture StephenKing · Apr 23, 2014

Attributes are supplied as normal yaml content:

suites:
  - name: default
    run_list: 
      - recipe[java::default]
      - recipe[maven::default]
    attributes:
       java:
         install_flavor: "oracle",
         jdk_version: "7"

The Getting Started shows a syntax similar to yours:

suites:
  - name: default
    run_list: 
      - recipe[java::default]
      - recipe[maven::default]
    attributes: { 'java': { 'install_flavor': 'oracle' } }