vagrant-openstack-provider
vagrant-openstack-provider copied to clipboard
Including options in box's Vagrantfile
Hi there,
I can't seem to pass in the openstack provider options in my box's Vagrantfile. It works fine when I specify them in my regular Vagrantfile, but I'm trying to shrink that one and put the boilerplate stuff in the box's built-in Vagrantfile (as per the Readme).
This is the Vagrantfile I include in my .box file, but vagrant doesn't read it (it complains right off the bat that there's no user, password, url, etc... unless I include them in the top level Vagrantfile).
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider :openstack do |os|
os.openstack_auth_url = 'http://openstack-controller:5000/v2.0/tokens'
os.floating_ip_pool = [ 'ext-net' ]
os.username = 'demo'
os.password = 'demo'
os.tenant_name = 'demo'
os.flavor = 'm1.medium'
os.image = 'rhel-6.6_chef-11.16.4-1'
os.networks = [ 'demo-net' ]
end
end
Any idea why?
Edit: It looks like the plugin immediately tries to validate the Vagrantfile parameters before even looking at the .box file...
Actually, the config parameter config.vm.box_url
has no effect. That means if the box you want to use is not already registered in Vagrant it is silently ignored...
If you add the box using the CLI
$ vagrant box add my-openstack /path/to/my/box/openstack.box
You can then use it in your Vagrantfile
config.vm.box = 'my-openstack'
Ok, that explains it. It would be nice if the URL could be parsed, so that users don't have to run the additional 'vagrant box add' command.
Of course, this is a bug. It will be fixed.
I've submitted PR #274 which enables this.