Commit Graph

55 Commits

Author SHA1 Message Date
Matthew Hopkins db958dfd67 splits hostnames across many lines, as Windows doesn't seem to like more than 8 on a line 2014-06-09 16:50:23 -04:00
colandre 78cf4b239d Force move on linux systems
If the script is run as root, usually mv has an alias to ask for
overwriting. This force the overwriting.
2014-05-14 16:06:12 +02:00
Paulo Bittencourt 5f854824e2 Merge pull request #85 from ColinHebert/fix_no_ip
Check that the IP is set before adding a new line to the hosts file
2014-04-27 12:06:50 -04:00
Colin Hebert bc997adc3b Check that the IP is set before adding a new line 2014-04-01 17:04:56 +11:00
Matthew Hopkins debf5e732a winder update 2014-03-18 09:00:11 -04:00
Matthew Hopkins 18d3083f07 Merge branch 'master' of github.com:smdahlen/vagrant-hostmanager into windows_guests 2014-03-18 08:54:11 -04:00
januzis c6219655f5 Replaced deprecated config_global with vagrantfile.config 2014-03-12 11:51:14 +01:00
Paulo Bittencourt 56ce9f895d Merge pull request #78 from thematthopkins/less_sudo_2
only update hosts file if it has changed - for both host and guest

Closes #68.
2014-02-24 23:24:42 -05:00
Matthew Hopkins 3051f4b3e3 only update hosts file if it has changed - for both host and guest 2014-02-24 14:14:57 -05:00
Paulo Bittencourt fec2c501fd Fix regression in #52.
We accidentally stopped filtering out machines from other providers.
2014-02-24 13:10:37 -05:00
Paulo Bittencourt 93fd353135 Merge pull request #64 from sstrato/patch-1
only first private_network is used
2014-02-20 20:44:34 -05:00
Paulo Bittencourt 8f041f5ef6 make get_machines return machine instances instead of machine names 2014-02-17 16:32:56 -05:00
Paulo Bittencourt ab5d82275a sync hosts file state in blocks instead of lines 2014-02-17 16:32:52 -05:00
Matthew Hopkins e59ec19a03 Fix for windows guests running on non-windows hosts. 2014-01-29 16:10:10 -05:00
Andrew Yongjoon Kong 2498e053f9 only first private_network is used
this will prevent using last private_network for the hostname
2014-01-16 17:18:49 +09:00
Lukasz Jastrzebski 566d1f2e3b tweaking couple of code review suggestions 2014-01-10 20:51:50 -08:00
Lukasz Jastrzebski 1b63859a57 adding current_machine to resolution 2013-12-19 16:08:31 -08:00
Lukasz Jastrzebski 24dc1c8ed6 fixing incorrect merge 2013-12-19 14:25:05 -08:00
Lukasz Jastrzebski ed0fe89dd0 fixing etc hosts handling to avoid duplicates 2013-12-15 17:11:51 -08:00
Lukasz Jastrzebski 3f8e617ba7 fixing custom ip resolver 2013-12-15 14:01:08 -08:00
Paulo Bittencourt 3edc923b22 use rbconfig for detecting Windows 2013-11-20 22:15:39 -05:00
Paulo Bittencourt d2b2e00939 elevate privileges in Windows host if necessary 2013-11-20 22:15:37 -05:00
Paulo Bittencourt 02758e32f0 fix indentation (using spaces instead of tabs) 2013-11-18 12:47:10 -05:00
Paulo Bittencourt a426b8503a Merge pull request #49 from Tpbrown/git-bash-windows
Support Cygwin and MinGW on Windows.  Fixes #24
2013-11-18 09:40:56 -08:00
Bryan Cribbs 3abecb0088 Merge sevos pull/15 into master
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
2013-11-15 20:15:10 -06:00
Tim Brown 8f3dd06d8e Use :SystemRoot to detect Windows, including git-bash. Also use :Windir to ensure we get correct hosts file path 2013-11-11 14:10:11 -08:00
Bryan Cribbs c53452b927 #44 Handle destroyed machines in update_file
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.
2013-11-02 16:00:23 -05:00
Rob Coward b935e4002f Changed test for windows guest to use the same as the vagrant-windows plugin 2013-10-03 14:51:49 +01:00
Rob Coward c555a98de3 Added support for windows guests 2013-10-03 14:16:53 +01:00
Chris Liles b281681b11 adding solairs support 2013-10-01 13:17:18 -07:00
S. Brent Faulkner cb9832a399 only remove lines for the current vagrantfile 2013-09-03 15:32:54 -04:00
itaymendel 1d161d0582 fixed windows compatibility issues for the hosts file
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.
2013-08-28 08:58:46 +03:00
Shawn Dahlen f189fb68cf Fix hardcoding of active state.
This commit queries the environment for active machines instead of
relying on a certain machine state. This fixes support for other Vagrant
providers.
2013-08-22 16:45:39 -04:00
Jeremiah Snapp 1cb7fc9b57 Add hooks & define active/offline as running/not
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.
2013-08-12 12:16:40 -04:00
Shawn Dahlen 4ce7cd498e Finish support for managing host /etc/hosts file.
This commit moves logic into action middleware and ensures that
config validation is executed when the hostmanager command is called.
2013-06-20 12:54:20 -04:00
Shawn Dahlen 064d9b8658 Clean up plugin configuration and add comments.
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.
2013-06-19 12:11:05 -04:00
Shawn Dahlen a39877ac27 Add support for managing host /etc/hosts file.
This commit also include preservation original /etc/hosts file on
guest machines.
2013-06-18 17:26:29 -04:00
Brian Johnson 2a190a299e Cleanup tempfiles when done. 2013-06-17 22:36:21 -07:00
Brian Johnson 782168492c - Ensure that empty regex isn't processed for deletes.
- Set the hook for deletion to run prior to machine deletion so that the id is retrieveable.
2013-06-17 12:59:07 -07:00
Brian Johnson 733e451216 Fix overwrite bug that was inadvertently regressed in the merge. 2013-06-13 16:20:00 -07:00
Brian Johnson e217beeabe Merge branch 'master' into new-hosts-os-hosts-file
Conflicts:
	lib/vagrant-hostmanager/config.rb
	lib/vagrant-hostmanager/hosts_file.rb
	locales/en.yml
2013-06-13 13:52:09 -07:00
Brian Johnson 1e698e5912 Update to do an update of hosts files while leaving existing host structure in place, rather than generating a local hosts entry automatically. 2013-06-13 13:48:38 -07:00
Brian Johnson 67644a6de0 Add management of hostsfile on the host machine. 2013-06-13 13:48:19 -07:00
Artur Roszczyk ed76e4b0e3 Allow to define custom IP resolver 2013-06-06 21:56:01 +02:00
Jan Vansteenkiste 00b8e75a7d Support include_offline boxes.
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.
2013-05-07 16:06:04 +02:00
Jan Vansteenkiste 6e4a2ae967 Abstract the get_machines part. Prepare for include offline. 2013-05-07 16:06:03 +02:00
Jan Vansteenkiste 3a96f5e170 use more I18n and do not repeat ourselves while doing config checks 2013-05-02 21:35:48 +02:00
Jan Vansteenkiste f058b3025f Fix small scoping issue. @logger is not available from the provisioner 2013-05-02 08:02:58 +02:00
Shawn Dahlen 9c984b6abb Merge pull request #4 from nagas/feature/hosts-aliases
provide aliases for host names and configuration options validation
2013-04-17 06:25:12 -07:00
Shawn Dahlen c94b1f8d52 Merge pull request #2 from nagas/improvement/ignore_private_ip
check explicitly if hostmanager.ignore_private_ip is set to true
2013-04-17 05:35:13 -07:00