schubergphilis / vagrant-chef-zero

Vagrant Plugin for Chef Zero
Apache License 2.0
91 stars 41 forks source link

Vagrant throws error when an array of paths is used in some config attributes #70

Closed miguelaferreira closed 9 years ago

miguelaferreira commented 9 years ago

Commit 4c845d0f354983ab5dd0d48b3246a5b47c1e9890 introduced file path expansion to some of the config attributes. However, some of those attributes can actually be arrays of paths and in that case vagrant will throw and exception like the following:

lib/vagrant-chef-zero/config.rb:79:in `expand_path': no implicit conversion of Array into String (TypeError)
    from /Users/mferreira/development/git/vagrant-chef-zero/lib/vagrant-chef-zero/config.rb:79:in `finalize!'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/v2/root.rb:50:in `block in finalize!'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/v2/root.rb:49:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/v2/root.rb:49:in `finalize!'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/v2/loader.rb:21:in `finalize'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:158:in `load'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/vagrantfile.rb:28:in `initialize'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:691:in `new'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:691:in `vagrantfile'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:441:in `host'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:207:in `block in action_runner'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:33:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:33:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:428:in `hook'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:673:in `unload'
    from /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.7.2/bin/vagrant:177:in `ensure in <main>'
    from /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.7.2/bin/vagrant:177:in `<main>'

To reproduce set, for instance, the cookbooks attribute in Vagrant file like this:

...
config.chef_zero.cookbooks    = [ 'test/fixtures/cookbooks', 'test/fixtures/test_cookbooks' ]
...