Vagrant Reload after config file change

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Vagrant Reload after config file change

Makrand
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

--
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 [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: Vagrant Reload after config file change

Alvaro Miranda Aguilera
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

On Mon, Nov 27, 2017 at 8:36 AM, Makrand <[hidden email]> wrote:
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

--
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 [hidden email].
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0ezv_seGTZ-ooTC5U%3DHpPSQ-oj_8N3zGJ%3DcA2%2BJR-GNa7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Vagrant Reload after config file change

Makrand
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/7567550c-e1c5-495d-adce-8f0004e6d5f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Vagrant Reload after config file change

Alvaro Miranda Aguilera
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 <[hidden email]> 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/7567550c-e1c5-495d-adce-8f0004e6d5f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0ezLxm7DkAxGK2EH8Wny0wfRaLVQ_PDaO1r4bzd_fn__tw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.