Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant.Environment property :vagrantfile_name does not work as expected #778

Closed
coreyoconnor opened this issue Mar 7, 2012 · 8 comments

Comments

@coreyoconnor
Copy link

According to the documentation :vagrantfile_name is "The valid name for a Vagrantfile for this environment". Which, IMO, means that setting this will just tell Vagrant to load the file at the provided path instead of Vagrantfile or vagrantfile. However, in my tests this causes env.cli('up') to fail with
vm: * Base MAC address for eth0/NAT must be set. Contact box maintainer for more information.

regardless of value.

Setting this property appears to also modify the vagrant home and root paths. Which is not as expected.

DEBUG loader: Set :home = #<Pathname:/home/corey/Development/jenkins/test/unit/Vagrantfile>
DEBUG loader: Populating proc cache for #<Pathname:/home/corey/Development/jenkins/test/unit/Vagrantfile>
DEBUG loader: Load procs for pathname: #<Pathname:/home/corey/Development/jenkins/test/unit/Vagrantfile>
DEBUG loader: Set :root = #<Pathname:/home/corey/Development/jenkins/test/unit/Vagrantfile>

Note the "Set :root" and "Set :home". This I find to be odd.

@mitchellh
Copy link
Contributor

Sorry, where is this documentation?

@coreyoconnor
Copy link
Author

Line 22 in lib/vagrant/environment.rb

@mitchellh
Copy link
Contributor

Can you show me how you're setting up the env?

@coreyoconnor
Copy link
Author

  1. create a new directory
  2. Add the 'base' box with "vagrant box add base URL"
  3. Create the default Vagrantfile with "vagrant init"
  4. Rename Vagrantfile to non_standard_name
  5. Execute the Ruby 1.9 script below
require 'vagrant'

env = Vagrant::Environment.new( :vagrantfile_name => File.dirname(__FILE__) + '/non_standard_name' )

env.cli('up')

The output I receive is:


/home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/config/top.rb:68:in `validate!': There was a problem with the configuration of Vagrant. The error message(s) (Vagrant::Errors::ConfigValidationFailed)
are printed below:

vm:
* Base MAC address for eth0/NAT must be set. Contact box maintainer for more information.

        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/action/general/validate.rb:12:in `call'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/action/warden.rb:33:in `call'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/action/general/check_virtualbox.rb:23:in `call'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/action/warden.rb:33:in `call'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/action/builder.rb:92:in `call'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/action/runner.rb:49:in `block in run'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/util/busy.rb:19:in `busy'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/action/runner.rb:49:in `run'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/vm.rb:190:in `run_action'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/vm.rb:143:in `up'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/command/up.rb:46:in `block in execute'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/command/base.rb:106:in `block in with_target_vms'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/command/base.rb:101:in `each'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/command/base.rb:101:in `with_target_vms'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/command/up.rb:39:in `execute'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/cli.rb:38:in `execute'
        from /home/corey/.gem/ruby/1.9.1/gems/vagrant-0.9.99.2/lib/vagrant/environment.rb:163:in `cli'
        from ./test.rb:5:in `<main>'

@mitchellh
Copy link
Contributor

Ah hah! The issue is that :vagrantfile_name should just be a single filename. In the above case:

:vagrantfile_name => "non_standard_name"

@mitchellh
Copy link
Contributor

I'll add validation for this case.

@mitchellh
Copy link
Contributor

Actually it didn't fix anything. Researching more.

@mitchellh
Copy link
Contributor

Now I really fixed it. :)

@hashicorp hashicorp locked and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants