File tree Expand file tree Collapse file tree 4 files changed +2
-24
lines changed Expand file tree Collapse file tree 4 files changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -59,11 +59,6 @@ up or have a private ip configured will be added to the hosts file.
59
59
In addition, the ` hostmanager.aliases ` configuration attribute can be used
60
60
to provide aliases for your host names.
61
61
62
- On some systems, long alias lines have been reported to cause issues
63
- (see [ #60 ] ( https://github.com/smdahlen/vagrant-hostmanager/issues/60 ) ).
64
- In such cases, you may render aliases on separate lines by setting
65
- ``` hostmanager.aliases_on_separate_lines = true ``` .
66
-
67
62
Example configuration:
68
63
69
64
``` ruby
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ class Config < Vagrant.plugin('2', :config)
7
7
attr_accessor :aliases
8
8
attr_accessor :include_offline
9
9
attr_accessor :ip_resolver
10
- attr_accessor :aliases_on_separate_lines
11
10
12
11
alias_method :enabled? , :enabled
13
12
alias_method :include_offline? , :include_offline
@@ -20,7 +19,6 @@ def initialize
20
19
@include_offline = UNSET_VALUE
21
20
@aliases = UNSET_VALUE
22
21
@ip_resolver = UNSET_VALUE
23
- @aliases_on_separate_lines = UNSET_VALUE
24
22
end
25
23
26
24
def finalize!
@@ -30,7 +28,6 @@ def finalize!
30
28
@include_offline = false if @include_offline == UNSET_VALUE
31
29
@aliases = [ ] if @aliases == UNSET_VALUE
32
30
@ip_resolver = nil if @ip_resolver == UNSET_VALUE
33
- @aliases_on_separate_lines = false if @aliases_on_separate_lines == UNSET_VALUE
34
31
35
32
@aliases = [ @aliases ] . flatten
36
33
end
Original file line number Diff line number Diff line change @@ -92,19 +92,8 @@ def get_hosts_file_entry(machine, resolving_machine)
92
92
ip = get_ip_address ( machine , resolving_machine )
93
93
host = machine . config . vm . hostname || machine . name
94
94
aliases = machine . config . hostmanager . aliases
95
-
96
95
if ip != nil
97
- # As per GH-60, we optionally render aliases on separate lines
98
- current_machine_config = ( ( resolving_machine && resolving_machine . config ) || @config )
99
- if current_machine_config . hostmanager . aliases_on_separate_lines
100
- rendered_aliases = aliases . map { |a | "#{ ip } \t #{ a } " } . join ( "\n " )
101
- separator = "\n "
102
- else
103
- rendered_aliases = aliases . join ( " " )
104
- separator = "\t "
105
- end
106
-
107
- "#{ ip } \t #{ host } " + separator + rendered_aliases + "\n "
96
+ "#{ ip } \t #{ host } \n " + aliases . map { |a | "#{ ip } \t #{ a } " } . join ( "\n " ) + "\n "
108
97
end
109
98
end
110
99
Original file line number Diff line number Diff line change @@ -16,19 +16,16 @@ Vagrant.configure('2') do |config|
16
16
17
17
config . hostmanager . enabled = true
18
18
config . hostmanager . manage_host = true
19
- # config.hostmanager.aliases_on_separate_lines = true
20
19
21
20
config . vm . define :server1 do |server |
22
21
server . vm . hostname = 'fry'
23
22
server . vm . network :private_network , :ip => '10.0.5.2'
24
- server . hostmanager . aliases = %w( alias1 alias2 )
23
+ server . hostmanager . aliases = %w( test-alias )
25
24
end
26
25
27
26
config . vm . define :server2 do |server |
28
27
server . vm . hostname = 'bender'
29
28
server . vm . network :private_network , :ip => '10.0.5.3'
30
- server . hostmanager . aliases = %w( alias3 alias4 )
31
- server . hostmanager . aliases_on_separate_lines = true
32
29
end
33
30
34
31
config . vm . define :server3 do |server |
You can’t perform that action at this time.
0 commit comments