File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed
lib/vagrant-hostmanager/hosts_file Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -17,17 +17,14 @@ def update_guest(machine)
17
17
18
18
if ( machine . communicate . test ( "uname -s | grep SunOS" ) )
19
19
realhostfile = '/etc/inet/hosts'
20
- move_cmd = 'mv'
21
20
elsif ( machine . communicate . test ( "test -d $Env:SystemRoot" ) )
22
21
windir = ""
23
22
machine . communicate . execute ( "echo %SYSTEMROOT%" , { :shell => :cmd } ) do |type , contents |
24
23
windir << contents . gsub ( "\r \n " , '' ) if type == :stdout
25
24
end
26
25
realhostfile = "#{ windir } \\ System32\\ drivers\\ etc\\ hosts"
27
- move_cmd = 'mv -force'
28
26
else
29
27
realhostfile = '/etc/hosts'
30
- move_cmd = 'mv -f'
31
28
end
32
29
# download and modify file with Vagrant-managed entries
33
30
file = @global_env . tmp_path . join ( "hosts.#{ machine . name } " )
@@ -37,11 +34,9 @@ def update_guest(machine)
37
34
# upload modified file and remove temporary file
38
35
machine . communicate . upload ( file , '/tmp/hosts' )
39
36
if windir
40
- machine . communicate . sudo ( "#{ move_cmd } /tmp/hosts/hosts.#{ machine . name } #{ realhostfile } " )
41
- elsif machine . communicate . test ( 'test -f /.dockerinit' )
42
- machine . communicate . sudo ( "cat /tmp/hosts > #{ realhostfile } " )
37
+ machine . communicate . sudo ( "mv -force /tmp/hosts/hosts.#{ machine . name } #{ realhostfile } " )
43
38
else
44
- machine . communicate . sudo ( "#{ move_cmd } /tmp/hosts #{ realhostfile } " )
39
+ machine . communicate . sudo ( "cat /tmp/hosts > #{ realhostfile } " )
45
40
end
46
41
end
47
42
You can’t perform that action at this time.
0 commit comments