Vagrant Reload after config file change

78 views
Skip to first unread message

Makrand

unread,
Nov 27, 2017, 2:37:11 AM11/27/17
to vagra...@googlegroups.com
Hello,

I've observed something odd. Here it is. So Initially I used most basic vagrantfile and created VM. This vagrant file location is /media/../test

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.provision :shell, path: "bootstrap.sh"
  config.vm.network "forwarded_port", guest: 80, host: 3456
end

This created a VM with default hostname precise64

I then edited vagrant file and added config.vm.hostname parameter and set the hostname to ubu-vm1. After this, I ran vagrant reload and sure enough the hostname was changed to ubu-vm1.

But after commenting config.vm.hostname and doing "vagrant reload" it did not change hostname back to default.

When I introduced few parameters for CPU (like no of CPU/CPU cap) all those changes were effective upon "vagrant reload". My VM had 1 CPU and 50% cap.


Surprisingly, when I did vagrant reload after commenting these parameters in the vagrant file, things remained same. my VM still had 1 CPU and 50% cap.

BUG? Why is vagrant still reading values which are not present in current file? I am running vagrant 2.0.0 on Linux Mint 18.3.

Note:- When I destroy VM vagrant destroy and then do vagrant up, then files it only picksup whatever is defined in file.



--
Makrand

Alvaro Miranda Aguilera

unread,
Nov 27, 2017, 4:39:29 AM11/27/17
to vagra...@googlegroups.com
Hello

Think when you set them you are overriding some value, so Vagrant will apply them.

If CPU/RAM/Hostname are present, on reload they will be set

If you don't want them, and you comment them, then you can destry and up

I don't think is a bug, is just vagrant won't touch those again, those are in the box and wont be overriden to defaults, since there are not such defaults.

When you spin a box, vagrant keep those values as they are in the base box.

Hope this helps
Alvaro.

Virusvrij. www.avast.com

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CABdC_7%3D9rAomcVRfgWeVUsKigmbqYHpEYUFd%2BzyTheDL7Ww5_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Makrand

unread,
Nov 27, 2017, 5:55:15 AM11/27/17
to Vagrant
So attributes or values once applied will remain effective unless you override them or destroy the environment.

Alvaro Miranda Aguilera

unread,
Nov 27, 2017, 7:22:35 AM11/27/17
to vagra...@googlegroups.com
some of them yes.

networking is one that come to my mind that happens every time.

each halt/up or reload all the networking gets deleted and created again, so if you add/remove/reload a network i think should dissapear.

but other won't be overriden.

Alvaro.

Virusvrij. www.avast.com

On Mon, Nov 27, 2017 at 11:55 AM, Makrand <makran...@gmail.com> wrote:
So attributes or values once applied will remain effective unless you override them or destroy the environment.
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages