0

It appears I'm unable to use erb in the .kitchen.yml when using the ENV var on Windows platforms.

$ kitchen list
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::UserError
>>>>>> Message: Error parsing C:/Users/anonymous/.kitchen.yml as YAML.
Please run `kitchen diagnose --no-instances --loader' to help debug your issue.
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

.kitchen.yml

---
driver:
  name: vagrant
  synced_folders:
    - [<%= ENV['PWD'] %>, '/tmp/foo']

provisioner:
  name: chef_zero

platforms:
  - name: ubuntu-16.04

suites:
  - name: default

ENV

$ chef -v
Chef Development Kit Version: 2.4.17
chef-client version: 13.6.4
delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427)
berks version: 6.3.1
kitchen version: 1.19.2
inspec version: 1.45.13

This works fine on my Ubuntu 16.04 machine, using the same file and software versions.

I believe this is related to a similar issue reported on the cucumber/aruba project ~ https://github.com/cucumber/aruba/issues/291

I tried submitting a new issue to the test-kitchen project but they refer me to their contributing guidelines which just goes over a release process. Since I'm unable to submit a new issue I've come to SO hoping for either some clarity or a work around.

coderanger
  • 52,400
  • 4
  • 52
  • 75
mdo123
  • 1,757
  • 3
  • 16
  • 34

1 Answers1

0

The problem is likely that after the Erb replacement, this would look like - [C:\Users\anonymous, '/tmp/foo']. The : in there is an important YAML syntax character. The simple solution would be - ["<%= ENV['PWD'] %>", '/tmp/foo'] or - [<%= ENV['PWD'].to_json %>, '/tmp/foo'] (JSON is a subset of YAML).

coderanger
  • 52,400
  • 4
  • 52
  • 75