Merge branch 'enable_using_private_ips_from_aws' of
https://github.com/sevos/vagrant-hostmanager into master.
Conflicts:
lib/vagrant-hostmanager/config.rb
lib/vagrant-hostmanager/hosts_file.rb
Keep track of machines that have been destroyed (they have a nil id).
Do not include them when updating the hosts file.
Since it is impossible to match on id, this is accomplished by matching
the exact ip / hostname / alias. If any of these have been altered
since the entry was created the entry will not be removed from the hosts
file.
Potentially, this could be relaxed to only match on ip / hostname pairs.
i have added a 'if windows' for the update_host method, to deal with a windows host machine.
sometimes i had an error on line 17, because the file was no longer there (maybe mv removed it?), so i just added a exception block to catch it. it does nothing, but now it is working for me.
update_all.rb checks if @machine.config.hostmanager.enabled is set to true.
The default value of @enabled is set to false by config.rb.
If the Vagrantfile has a global value of true for enabled but it sets vm
specific hostmanager options, such as when specifying hostmanager.aliases,
then the @machine.config.hostmanager.enabled will default to false and
hostmanager will not think it is enabled.
Check @global_env.config_global.hostmanager.enabled instead.
Hosts entries shouldn't only be added/removed upon creation/destruction.
The persistence of /etc/hosts entries while a vm is in a halted or
suspended state is undesirable especially when hostmanager.manage_host
is set to true. That would mean your host's /etc/hosts would retain
entries even if you aren't currently using a vm. The vm would have to
be destroyed for the entry to be removed from the host's /etc/hosts.
Adding hooks for halt, resume and suspend commands and changing the
concept of active and offline states from created or not_created to
running or not running allows a vm's entry to be added when it is put
in a running state and removed when it is not running.
The hostmanager.include_offline can be set to true if one still desires
to have not_created or not running machines' entries included in the
/etc/hosts file.
This commit cleaned up the plugin's configuration and added code
comments for the hosts_file module. Additionally, display messages were
re-organized based on the single action.
The command still requires code to validate the configuration before
execution.
This closes pull request #18. Thanks to @b2jrock for his contribution.
If include_offline is enabled, we loop over all available boxes picking
those with the correct provider.
If a box has no private ip set or is offline, it is skipped (a warning is shown).
The lambda that gets the ip will return nil for the boxes.