How can I add to an array from a loaded Vagrantfile?
I can override the setting, but if I try to add to the array, I get an error. Here is the loaded Vagrantfile. The filename is Vagrantfile.general
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure('2') do |config|
config.vm.provider 'cloud_service' do |cs|
cs.tags = ['ExampleTag1']
end
end
Here is the Vagrantfile that loads the above:
load 'Vagrantfile.general'
Vagrant.configure('2') do |config|
config.vm.provider 'cloud_service' do |cs|
cs.tags << 'ExampleTag2'
end
end
Here is the error:
Message: NoMethodError: undefined method `<<' for :__UNSET__VALUE__:Symbol
Here is a workaround, but this is not a good way to do it:
load 'Vagrantfile.general'
Vagrant.configure('2') do |config|
config.vm.provider 'cloud_service' do |cs|
cs.tags = ['ExampleTag1', 'ExampleTag2']
end
end