[chef] Accessing Test Kitchen YML Attributes


Chronological Thread 
  • From: Rudi < >
  • To:
  • Subject: [chef] Accessing Test Kitchen YML Attributes
  • Date: Fri, 6 Mar 2015 11:27:29 +0800

Hi,

I have a simple test kitchen error I'm stuck on, would appreciate some guidance here.

Working though the tutorial at KitchenCI, I'm having trouble accessing attributes set inside .kitchen.yml.


If I add a port attribute under suites

suites:
  - name: default
    run_list:
      - recipe[git::default]
    attributes:
  - name: server
    run_list:
      - recipe[git::server]
    attributes:
      port: 9217

Then try to access it like so in: test/integration/server/serverspec/git_daemon_spec.rb

  require 'serverspec'

  # Required by serverspec
  set :backend, :exec

  puts node['port']

  describe "Git Daemon" do

/tmp/busser/suites/serverspec/git_daemon_spec.rb:6:in `<top (required)>': undefined local variable or method `node' for main:Object (NameError)


Can you see where I'm going wrong here?

Thanks.




Archive powered by MHonArc 2.6.16.

§