I am using kitchen to test my chef cookbook. In .kitchen.yml I use
driver:
name: vagrant
vagrantfile_erb: Vagrantfile.rb
Then in the suites attribute I have
attributes: {
"myattribute" : true,
...
Can I use this attribute value inside the Vagrantfile.rb? I need to run the Vagrantfile with both Kitchen and directly with Vagrant, so I need a way to distinguish between the two methods. I wanted to set a boolean attribute in kitchen like this, but it does not work
Vagrant.configure('2') do |config|
myattribute = "<%= node['myattribute'] %>
...
end
I get the message
Message: Failed to complete #create action: [undefined local variable or method `node' for #<Kitchen::Driver::Vagrant:0x007febf431d138>]
Of course an easy solution would be to create 2 different vagrantfile, I just wanted to avoid that