vagrant-unbundled 2.3.3.0 → 2.3.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/CHANGELOG.md +42 -0
  4. data/Gemfile.lock +32 -32
  5. data/Makefile +53 -9
  6. data/contrib/bash/completion.sh +15 -0
  7. data/go.mod +1 -1
  8. data/go.sum +2 -10
  9. data/lib/vagrant/action/builtin/box_add.rb +16 -6
  10. data/lib/vagrant/environment.rb +1 -1
  11. data/lib/vagrant/errors.rb +8 -0
  12. data/lib/vagrant/plugin/v2/config.rb +0 -5
  13. data/lib/vagrant/shared_helpers.rb +21 -0
  14. data/lib/vagrant/util/file_mutex.rb +47 -0
  15. data/lib/vagrant/util/platform.rb +8 -2
  16. data/lib/vagrant/util.rb +1 -0
  17. data/lib/vagrant.rb +1 -0
  18. data/pkg/vagrant-unbundled-2.3.3.0.gem +0 -0
  19. data/plugins/commands/box/command/outdated.rb +1 -1
  20. data/plugins/commands/serve/command.rb +22 -24
  21. data/plugins/commands/serve/constants.rb +8 -0
  22. data/plugins/communicators/ssh/communicator.rb +11 -20
  23. data/plugins/hosts/arch/host.rb +1 -1
  24. data/plugins/kernel_v2/config/vm.rb +0 -9
  25. data/plugins/providers/docker/action.rb +1 -2
  26. data/plugins/providers/docker/driver.rb +17 -1
  27. data/plugins/providers/hyperv/driver.rb +6 -1
  28. data/plugins/providers/hyperv/scripts/set_enhanced_session_transport_type.ps1 +11 -2
  29. data/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 +15 -0
  30. data/plugins/providers/virtualbox/action/check_virtualbox.rb +0 -6
  31. data/plugins/providers/virtualbox/action/network.rb +15 -0
  32. data/plugins/providers/virtualbox/driver/base.rb +47 -1
  33. data/plugins/providers/virtualbox/driver/version_7_0.rb +24 -7
  34. data/plugins/provisioners/ansible/cap/guest/debian/ansible_install.rb +5 -1
  35. data/plugins/provisioners/ansible/cap/guest/posix/ansible_installed.rb +2 -2
  36. data/plugins/provisioners/ansible/provisioner/guest.rb +1 -1
  37. data/plugins/provisioners/ansible/provisioner/host.rb +3 -2
  38. data/plugins/synced_folders/rsync/helper.rb +3 -6
  39. data/templates/commands/init/Vagrantfile.erb +7 -0
  40. data/templates/locales/en.yml +12 -0
  41. data/tools.go +10 -0
  42. data/vagrant.gemspec +9 -9
  43. data/version.txt +1 -1
  44. metadata +24 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d80f12bb6896767fb93de74dca7ff025aeb935c32bf6a2ab202b30582329ea1
4
- data.tar.gz: ff5d56384a90926d3393a85400f3b34579f1e901b348318ae71b0219b8a29049
3
+ metadata.gz: 56801a2f5c2faf956d305ef49f1513549a059133c9131e3a588d7c985e725d6d
4
+ data.tar.gz: f10390220e89207bd05dd07deef7c004d745338c985c8058d9faa34ed9cedc6f
5
5
  SHA512:
6
- metadata.gz: c84b9f9edc34fcecd13ca1b740903d1074242e0797cef80d849055959ea95da61b77eb07fe86ba5e53cf3db23aeddec02d91459972101fc2bd18efa026a690e6
7
- data.tar.gz: 3cf8aebc8ff49c47dc52c47bf4ef329ed7fd3e2109c72aacbc06d751aafbecdb2e10be61f2405015683031bb5a9ca9bbf639d8b0c08809078eb72a9a1f060fcc
6
+ metadata.gz: b443c030b4db01b126dc84ac6478db69418c09177a41103683eb08a097b85c5346497bc3d3c4887a6a1c0c1b068194587a18a4c19c18d4e51b3393790dee45a3
7
+ data.tar.gz: 5dc9803a4af2fc545dc209382d8194651455ed300bcec8621f9672d69d36b9ed27ae9b97a0017afeb2991e65c784e3363ca8215de7e5479d497907d9ef143c8f
data/.gitignore CHANGED
@@ -70,3 +70,6 @@ __debug_bin
70
70
  # solargraph (ruby lsp) & rubocop
71
71
  .solargraph.yml
72
72
  .rubocop.yml
73
+
74
+ # Ignore generated binaries
75
+ bin/vagrant-go*
data/CHANGELOG.md CHANGED
@@ -1,3 +1,45 @@
1
+ ## 2.3.6 (May 19, 2023)
2
+
3
+ BUG FIXES:
4
+
5
+ - command/serve: Isolate proto constants to file for auto-loading [GH-13165]
6
+ - core/util: Unlock file prior to deletion [GH-13159]
7
+ - provider/docker: Attempt using docker command for bridge ip [GH-13153]
8
+ - provider/virtualbox: Update preferred locale values for driver [GH-13160]
9
+
10
+ ## 2.3.5 (May 15, 2023)
11
+
12
+ BUG FIXES:
13
+
14
+ - communicator/ssh: Use netssh builtin keep alive functionality [GH-13069]
15
+ - communicator/ssh: Update connection settings when using a password to connect ssh [GH-13052]
16
+ - core: Add a file mutex when downloading box files [GH-13057]
17
+ - guest/arch: Support differentiating between Artix and Arch Linux [GH-13055]
18
+ - host/windows: Get state of Windows feature "Microsoft-Hyper-V-Hypervisor" [GH-11933]
19
+ - provider/docker: Ignore inactive docker containers when assigning ports [GH-13146]
20
+ - provider/docker: Sync folders before preparing nfs settings [GH-13149]
21
+ - provider/virtualbox: De-duplicate machine port forward info [GH-13056]
22
+ - provider/virtualbox: Remove check for hyperv being enabled when verifying virtualbox is usable on windows [GH-13090]
23
+ - provider/virtualbox: Validate LANG value when possible [GH-13150]
24
+ - provider/hyperv: Check for hyper-v feature "EnhancedSessionTransportType" [GH-12280]
25
+ - provisioner/ansible: Fix installing Ansible provisioner with version and pip [GH-13054]
26
+ - synced_folders/rsync: allow rsync-auto to also ignore relative paths [GH-13066]
27
+
28
+ NOTE: Vagrant installer packages were updated to Ruby 3
29
+
30
+ ## 2.3.4 (December 9, 2022)
31
+
32
+ IMPROVEMENTS:
33
+
34
+ - host/darwin: Isolate loading incompatible libraries to support EOL platforms [GH-13022]
35
+ - provider/virtualbox: Detect network type when not provided [GH-13024]
36
+
37
+ BUG FIXES:
38
+
39
+ - host/windows: Add fix for Powershell 7.3.0 [GH-13006]
40
+ - provider/virtualbox: Adjust hostnet DHCP configuration, ignore invalid devices [GH-13004]
41
+ - provisioner/ansible: Fix install package names on older debian (and derivatives) versions [GH-13017]
42
+
1
43
  ## 2.3.3 (November 15, 2022)
2
44
 
3
45
  IMPROVEMENTS:
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- vagrant-unbundled (2.3.3.0)
15
+ vagrant-unbundled (2.3.6.0)
16
16
  bcrypt_pbkdf (~> 1.1)
17
17
  childprocess (~> 4.1.0)
18
18
  ed25519 (~> 1.3.0)
@@ -20,24 +20,24 @@ PATH
20
20
  googleapis-common-protos-types (~> 1.3)
21
21
  grpc
22
22
  hashicorp-checkpoint (~> 0.1.5)
23
- i18n (~> 1.8)
23
+ i18n (~> 1.12)
24
24
  ipaddr (>= 1.2.4)
25
- listen (~> 3.6)
25
+ listen (~> 3.7)
26
26
  log4r (~> 1.1.9, < 1.1.11)
27
27
  mime-types (~> 3.3)
28
- net-ftp (~> 0.1)
28
+ net-ftp (~> 0.2)
29
29
  net-scp (~> 4.0)
30
30
  net-sftp (~> 4.0)
31
31
  net-ssh (~> 7.0)
32
32
  rb-kqueue (~> 0.2.0)
33
33
  rexml (~> 3.2)
34
- rgl (~> 0.5.7)
35
- rubyzip (~> 2.0)
34
+ rgl (~> 0.5.10)
35
+ rubyzip (~> 2.3.2)
36
36
  vagrant_cloud (~> 3.0.5)
37
- wdm (~> 0.1.0)
38
- winrm (>= 2.3.4, < 3.0)
39
- winrm-elevated (>= 1.2.1, < 2.0)
40
- winrm-fs (>= 1.3.4, < 2.0)
37
+ wdm (~> 0.1.1)
38
+ winrm (>= 2.3.6, < 3.0)
39
+ winrm-elevated (>= 1.2.3, < 2.0)
40
+ winrm-fs (>= 1.3.5, < 2.0)
41
41
 
42
42
  GEM
43
43
  remote: https://rubygems.org/
@@ -45,19 +45,19 @@ GEM
45
45
  bcrypt_pbkdf (1.1.0)
46
46
  builder (3.2.4)
47
47
  childprocess (4.1.0)
48
- concurrent-ruby (1.1.10)
49
- date (3.2.2)
48
+ concurrent-ruby (1.2.2)
49
+ date (3.3.3)
50
50
  diff-lcs (1.5.0)
51
51
  ed25519 (1.3.0)
52
- erubi (1.11.0)
53
- excon (0.94.0)
52
+ erubi (1.12.0)
53
+ excon (0.104.0)
54
54
  fake_ftp (0.3.0)
55
- ffi (1.15.5)
56
- google-protobuf (3.21.9)
57
- googleapis-common-protos-types (1.4.0)
58
- google-protobuf (~> 3.14)
59
- grpc (1.50.0)
60
- google-protobuf (~> 3.21)
55
+ ffi (1.16.3)
56
+ google-protobuf (3.24.4)
57
+ googleapis-common-protos-types (1.9.0)
58
+ google-protobuf (~> 3.18)
59
+ grpc (1.58.0)
60
+ google-protobuf (~> 3.23)
61
61
  googleapis-common-protos-types (~> 1.0)
62
62
  grpc-tools (1.50.0)
63
63
  gssapi (1.3.1)
@@ -67,10 +67,10 @@ GEM
67
67
  rexml (~> 3.0)
68
68
  hashicorp-checkpoint (0.1.5)
69
69
  httpclient (2.8.3)
70
- i18n (1.12.0)
70
+ i18n (1.14.1)
71
71
  concurrent-ruby (~> 1.0)
72
- ipaddr (1.2.4)
73
- listen (3.7.1)
72
+ ipaddr (1.2.5)
73
+ listen (3.8.0)
74
74
  rb-fsevent (~> 0.10, >= 0.10.3)
75
75
  rb-inotify (~> 0.9, >= 0.9.10)
76
76
  little-plugger (1.1.4)
@@ -78,30 +78,30 @@ GEM
78
78
  logging (2.3.1)
79
79
  little-plugger (~> 1.1)
80
80
  multi_json (~> 1.14)
81
- mime-types (3.4.1)
81
+ mime-types (3.5.1)
82
82
  mime-types-data (~> 3.2015)
83
- mime-types-data (3.2022.0105)
83
+ mime-types-data (3.2023.1003)
84
84
  multi_json (1.15.0)
85
85
  net-ftp (0.2.0)
86
86
  net-protocol
87
87
  time
88
- net-protocol (0.1.3)
88
+ net-protocol (0.2.1)
89
89
  timeout
90
90
  net-scp (4.0.0)
91
91
  net-ssh (>= 2.6.5, < 8.0.0)
92
92
  net-sftp (4.0.0)
93
93
  net-ssh (>= 5.0.0, < 8.0.0)
94
- net-ssh (7.0.1)
94
+ net-ssh (7.2.0)
95
95
  nori (2.6.0)
96
- pairing_heap (1.0.0)
96
+ pairing_heap (3.0.1)
97
97
  rake (13.0.6)
98
98
  rb-fsevent (0.11.2)
99
99
  rb-inotify (0.10.1)
100
100
  ffi (~> 1.0)
101
101
  rb-kqueue (0.2.8)
102
102
  ffi (>= 0.5.0)
103
- rexml (3.2.5)
104
- rgl (0.5.9)
103
+ rexml (3.2.6)
104
+ rgl (0.5.10)
105
105
  pairing_heap (>= 0.3.0)
106
106
  rexml (~> 3.2, >= 3.2.4)
107
107
  stream (~> 0.5.3)
@@ -125,9 +125,9 @@ GEM
125
125
  rubyzip (2.3.2)
126
126
  stream (0.5.5)
127
127
  thor (0.18.1)
128
- time (0.2.0)
128
+ time (0.2.2)
129
129
  date
130
- timeout (0.3.0)
130
+ timeout (0.4.0)
131
131
  vagrant_cloud (3.0.5)
132
132
  excon (~> 0.73)
133
133
  log4r (~> 1.1.10)
data/Makefile CHANGED
@@ -10,31 +10,75 @@ CGO_ENABLED?=0
10
10
  .PHONY: bin
11
11
  bin: # bin creates the binaries for Vagrant for the current platform
12
12
  @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }
13
- CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -gcflags="$(GCFLAGS)" -tags assetsembedded -o ./vagrant ./cmd/vagrant
13
+ CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -gcflags="$(GCFLAGS)" -tags assetsembedded -o ./bin/vagrant-go ./cmd/vagrant
14
14
 
15
15
  .PHONY: debug
16
16
  debug: # debug creates an executable with optimizations off, suitable for debugger attachment
17
17
  GCFLAGS="all=-N -l" $(MAKE) bin
18
18
 
19
+ .PHONY: all
20
+ all:
21
+ $(MAKE) bin/windows
22
+ $(MAKE) bin/linux
23
+ $(MAKE) bin/darwin
24
+
19
25
  .PHONY: bin/windows
20
- bin/windows: # create windows binaries
21
- @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }#
22
- GOOS=windows GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -tags assetsembedded -o ./vagrant.exe ./cmd/vagrant
26
+ bin/windows:
27
+ $(MAKE) bin/windows-amd64
28
+ $(MAKE) bin/windows-386
29
+
30
+ .PHONY: bin/windows-amd64
31
+ bin/windows-amd64: # create windows binaries
32
+ @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }
33
+ GOOS=windows GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -tags assetsembedded -o ./bin/vagrant-go_windows_amd64.exe ./cmd/vagrant
34
+
35
+ .PHONY: bin/windows-386
36
+ bin/windows-386: # create windows binaries
37
+ @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }
38
+ GOOS=windows GOARCH=386 CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -tags assetsembedded -o ./bin/vagrant-go_windows_386.exe ./cmd/vagrant
23
39
 
24
40
  .PHONY: bin/linux
25
- bin/linux: # create Linux binaries
41
+ bin/linux:
42
+ $(MAKE) bin/linux-amd64
43
+ $(MAKE) bin/linux-386
44
+
45
+ .PHONY: bin/linux-amd64
46
+ bin/linux-amd64: # create Linux binaries
26
47
  @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }
27
- GOOS=linux GOARCH=amd64 $(MAKE) bin
48
+ GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -gcflags="$(GCFLAGS)" -tags assetsembedded -o ./bin/vagrant-go_linux_amd64 ./cmd/vagrant
28
49
 
29
50
  .PHONY: bin/linux-386
30
51
  bin/linux-386: # create Linux binaries
31
52
  @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }
32
- GOOS=linux GOARCH=386 $(MAKE) bin
53
+ GOOS=linux GOARCH=386 CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -gcflags="$(GCFLAGS)" -tags assetsembedded -o ./bin/vagrant-go_linux_386 ./cmd/vagrant
33
54
 
34
55
  .PHONY: bin/darwin
35
- bin/darwin: # create Darwin binaries
56
+ bin/darwin:
57
+ $(MAKE) bin/darwin-amd64
58
+ $(MAKE) bin/darwin-arm64
59
+ $(MAKE) bin/darwin-universal
60
+
61
+ .PHONY: bin/darwin-amd64
62
+ bin/darwin-amd64: # create Darwin binaries
63
+ @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }
64
+ GOOS=darwin GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -gcflags="$(GCFLAGS)" -tags assetsembedded -o ./bin/vagrant-go_darwin_amd64 ./cmd/vagrant
65
+
66
+ .PHONY: bin/darwin-arm64
67
+ bin/darwin-arm64: # create Darwin binaries
36
68
  @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }
37
- GOOS=darwin GOARCH=amd64 $(MAKE) bin
69
+ GOOS=darwin GOARCH=arm64 CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -gcflags="$(GCFLAGS)" -tags assetsembedded -o ./bin/vagrant-go_darwin_arm64 ./cmd/vagrant
70
+
71
+ .PHONY: bin/darwin-universal
72
+ bin/darwin-universal:
73
+ @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }
74
+ GOOS=darwin GOARCH=arm64 CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -gcflags="$(GCFLAGS)" -tags assetsembedded -o ./bin/.vagrant-go_darwin_arm64 ./cmd/vagrant
75
+ GOOS=darwin GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -gcflags="$(GCFLAGS)" -tags assetsembedded -o ./bin/.vagrant-go_darwin_amd64 ./cmd/vagrant
76
+ go run github.com/randall77/makefat ./bin/vagrant-go_darwin_universal ./bin/.vagrant-go_darwin_arm64 ./bin/.vagrant-go_darwin_amd64
77
+ rm -f ./bin/.vagrant-go_darwin*
78
+
79
+ .PHONY: clean
80
+ clean:
81
+ rm -f ./bin/vagrant-go* ./bin/.vagrant-go_darwin*
38
82
 
39
83
  .PHONY: test
40
84
  test: # run tests
@@ -153,6 +153,21 @@ _vagrant() {
153
153
  COMPREPLY=($(compgen -W "${box_list}" -- ${cur}))
154
154
  return 0
155
155
  ;;
156
+ "add")
157
+ local add_commands="\
158
+ --name \
159
+ --checksum \
160
+ --checksum-type \
161
+ -c --clean \
162
+ -f --force \
163
+ "
164
+ if [[ $cur == -* ]]; then
165
+ COMPREPLY=($(compgen -W "${add_commands}" -- ${cur}))
166
+ else
167
+ COMPREPLY=($(compgen -o default -- "${cur}"))
168
+ fi
169
+ return 0
170
+ ;;
156
171
  *)
157
172
  ;;
158
173
  esac
data/go.mod CHANGED
@@ -43,6 +43,7 @@ require (
43
43
  github.com/oklog/ulid/v2 v2.0.2
44
44
  github.com/pkg/errors v0.9.1
45
45
  github.com/posener/complete v1.2.3
46
+ github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844
46
47
  github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
47
48
  github.com/stretchr/testify v1.7.5
48
49
  github.com/zclconf/go-cty v1.10.0
@@ -94,7 +95,6 @@ require (
94
95
  github.com/go-git/gcfg v1.5.0 // indirect
95
96
  github.com/go-git/go-billy/v5 v5.0.0 // indirect
96
97
  github.com/go-test/deep v1.0.7 // indirect
97
- github.com/gogo/googleapis v1.4.1 // indirect
98
98
  github.com/gogo/protobuf v1.3.2 // indirect
99
99
  github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
100
100
  github.com/golang/protobuf v1.5.2 // indirect
data/go.sum CHANGED
@@ -209,8 +209,6 @@ github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M=
209
209
  github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
210
210
  github.com/gofrs/flock v0.8.0 h1:MSdYClljsF3PbENUUEx85nkWfJSGfzYI9yEBZOJz6CY=
211
211
  github.com/gofrs/flock v0.8.0/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
212
- github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0=
213
- github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4=
214
212
  github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
215
213
  github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
216
214
  github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
@@ -361,14 +359,6 @@ github.com/hashicorp/hcl/v2 v2.11.1 h1:yTyWcXcm9XB0TEkyU/JCRU6rYy4K+mgLtzn2wlrJb
361
359
  github.com/hashicorp/hcl/v2 v2.11.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg=
362
360
  github.com/hashicorp/nomad/api v0.0.0-20200814140818-42de70466a9d h1:afuZ/KNbxwUgjEzq2NXO2bRKZgsIJQgFxgIRGETF0/A=
363
361
  github.com/hashicorp/nomad/api v0.0.0-20200814140818-42de70466a9d/go.mod h1:DCi2k47yuUDzf2qWAK8E1RVmWgz/lc0jZQeEnICTxmY=
364
- github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220913204040-793a2626f6f9 h1:wfdFsM/smge6K+RDgGLxWF4TcmAXZJis/IVUyT+G3JQ=
365
- github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220913204040-793a2626f6f9/go.mod h1:zA5vDskG3gH306C+obL+yURiUiLMAlx52yqO8MC2r9w=
366
- github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220919180525-50c632cd450d h1:TqCLroDhxzGMXE7LrgqDayOku2oRJ4vjROX7ghpzqsI=
367
- github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220919180525-50c632cd450d/go.mod h1:zA5vDskG3gH306C+obL+yURiUiLMAlx52yqO8MC2r9w=
368
- github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220919180735-d47bfe003e94 h1:CGq9dOg/kK0ihxx81H59xEHGfTvRs0ls8qCL3Bujdgo=
369
- github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220919180735-d47bfe003e94/go.mod h1:zA5vDskG3gH306C+obL+yURiUiLMAlx52yqO8MC2r9w=
370
- github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220928204300-c0e4b14e08c5 h1:xxwRPE6ISOz4CFFJlk3DmDD+4ZBt7iO9YiGwk4W/CYY=
371
- github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220928204300-c0e4b14e08c5/go.mod h1:zA5vDskG3gH306C+obL+yURiUiLMAlx52yqO8MC2r9w=
372
362
  github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220928204555-798e860a8593 h1:A75xYKrvyA/fNB6nSLBosbcrEmGTZSyMvuFHH7agscY=
373
363
  github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220928204555-798e860a8593/go.mod h1:zA5vDskG3gH306C+obL+yURiUiLMAlx52yqO8MC2r9w=
374
364
  github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
@@ -517,6 +507,8 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr
517
507
  github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo=
518
508
  github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
519
509
  github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
510
+ github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 h1:GranzK4hv1/pqTIhMTXt2X8MmMOuH3hMeUR0o9SP5yc=
511
+ github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844/go.mod h1:T1TLSfyWVBRXVGzWd0o9BI4kfoO9InEgfQe4NV3mLz8=
520
512
  github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
521
513
  github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
522
514
  github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
@@ -6,6 +6,7 @@ require "uri"
6
6
  require "vagrant/box_metadata"
7
7
  require "vagrant/util/downloader"
8
8
  require "vagrant/util/file_checksum"
9
+ require "vagrant/util/file_mutex"
9
10
  require "vagrant/util/platform"
10
11
 
11
12
  module Vagrant
@@ -479,12 +480,21 @@ module Vagrant
479
480
  end
480
481
 
481
482
  begin
482
- d.download!
483
- rescue Errors::DownloaderInterrupted
484
- # The downloader was interrupted, so just return, because that
485
- # means we were interrupted as well.
486
- @download_interrupted = true
487
- env[:ui].info(I18n.t("vagrant.actions.box.download.interrupted"))
483
+ mutex_path = d.destination + ".lock"
484
+ Util::FileMutex.new(mutex_path).with_lock do
485
+ begin
486
+ d.download!
487
+ rescue Errors::DownloaderInterrupted
488
+ # The downloader was interrupted, so just return, because that
489
+ # means we were interrupted as well.
490
+ @download_interrupted = true
491
+ env[:ui].info(I18n.t("vagrant.actions.box.download.interrupted"))
492
+ end
493
+ end
494
+ rescue Errors::VagrantLocked
495
+ raise Errors::DownloadAlreadyInProgress,
496
+ dest_path: d.destination,
497
+ lock_file_path: mutex_path
488
498
  end
489
499
 
490
500
  Pathname.new(d.destination)
@@ -846,7 +846,7 @@ module Vagrant
846
846
  begin
847
847
  @logger.info("Creating: #{dir}")
848
848
  FileUtils.mkdir_p(dir)
849
- rescue Errno::EACCES
849
+ rescue Errno::EACCES, Errno::EROFS
850
850
  raise Errors::HomeDirectoryNotAccessible, home_path: @home_path.to_s
851
851
  end
852
852
  end
@@ -376,6 +376,10 @@ module Vagrant
376
376
  error_key(:dotfile_upgrade_json_error)
377
377
  end
378
378
 
379
+ class DownloadAlreadyInProgress < VagrantError
380
+ error_key(:download_already_in_progress_error)
381
+ end
382
+
379
383
  class DownloaderError < VagrantError
380
384
  error_key(:downloader_error)
381
385
  end
@@ -920,6 +924,10 @@ module Vagrant
920
924
  error_key(:uploader_interrupted)
921
925
  end
922
926
 
927
+ class VagrantLocked < VagrantError
928
+ error_key(:vagrant_locked)
929
+ end
930
+
923
931
  class VagrantInterrupt < VagrantError
924
932
  error_key(:interrupted)
925
933
  end
@@ -15,11 +15,6 @@ module Vagrant
15
15
 
16
16
  UNSET_VALUE = :__UNSET__VALUE__
17
17
 
18
- if Vagrant.server_mode?
19
- GENERAL_CONFIG_CLS = Hashicorp::Vagrant::Sdk::Vagrantfile::GeneralConfig
20
- SYMBOL_PROTO = Hashicorp::Vagrant::Sdk::Args::Symbol
21
- end
22
-
23
18
  # This is called as a last-minute hook that allows the configuration
24
19
  # object to finalize itself before it will be put into use. This is
25
20
  # a useful place to do some defaults in the case the user didn't
@@ -235,6 +235,7 @@ module Vagrant
235
235
  # @return [true]
236
236
  def self.enable_server_mode!
237
237
  if !server_mode?
238
+ load_vagrant_proto!
238
239
  SERVER_MODE_CALLBACKS.each(&:call)
239
240
  Util::HCLogOutputter.new("hclog")
240
241
  Log4r::Outputter["hclog"].formatter = Util::HCLogFormatter.new
@@ -257,6 +258,26 @@ module Vagrant
257
258
  @_server_mode = true
258
259
  end
259
260
 
261
+ # Load the vagrant proto messages
262
+ def self.load_vagrant_proto!
263
+ return if @_vagrant_proto_loaded
264
+ # Update the load path so our protos can be located
265
+ $LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs").to_s
266
+ $LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs/proto").to_s
267
+ $LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs/proto/vagrant_plugin_sdk").to_s
268
+
269
+ # Load our protos so they are available
270
+ require 'vagrant/protobufs/proto/vagrant_server/server_pb'
271
+ require 'vagrant/protobufs/proto/vagrant_server/server_services_pb'
272
+ require 'vagrant/protobufs/proto/ruby_vagrant/ruby-server_pb'
273
+ require 'vagrant/protobufs/proto/ruby_vagrant/ruby-server_services_pb'
274
+ require 'vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_pb'
275
+ require 'vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_services_pb'
276
+ require 'vagrant/protobufs/proto/plugin/grpc_broker_pb'
277
+ require 'vagrant/protobufs/proto/plugin/grpc_broker_services_pb'
278
+ @_vagrant_proto_loaded = true
279
+ end
280
+
260
281
  SERVER_MODE_CALLBACKS = [
261
282
  ->{ Vagrant::Box.prepend(Vagrant::Box::Remote) },
262
283
  ->{ Vagrant::BoxCollection.prepend(Vagrant::BoxCollection::Remote) },
@@ -0,0 +1,47 @@
1
+ module Vagrant
2
+ module Util
3
+ # Utility to provide a simple mutex via file lock
4
+ class FileMutex
5
+ # Create a new FileMutex instance
6
+ #
7
+ # @param mutex_path [String] path for file
8
+ def initialize(mutex_path)
9
+ @mutex_path = mutex_path
10
+ end
11
+
12
+ # Execute provided block within lock and unlock
13
+ # when completed
14
+ def with_lock(&block)
15
+ lock
16
+ begin
17
+ block.call
18
+ rescue => e
19
+ raise e
20
+ ensure
21
+ unlock
22
+ end
23
+ end
24
+
25
+ # Attempt to acquire the lock
26
+ def lock
27
+ if lock_file.flock(File::LOCK_EX|File::LOCK_NB) === false
28
+ raise Errors::VagrantLocked, lock_file_path: @mutex_path
29
+ end
30
+ end
31
+
32
+ # Unlock the file
33
+ def unlock
34
+ lock_file.flock(File::LOCK_UN)
35
+ lock_file.close
36
+ File.delete(@mutex_path) if File.file?(@mutex_path)
37
+ end
38
+
39
+ protected
40
+
41
+ def lock_file
42
+ return @lock_file if @lock_file && !@lock_file.closed?
43
+ @lock_file = File.open(@mutex_path, "w+")
44
+ end
45
+ end
46
+ end
47
+ end
@@ -139,14 +139,20 @@ module Vagrant
139
139
  return @_windows_hyperv_enabled if defined?(@_windows_hyperv_enabled)
140
140
 
141
141
  @_windows_hyperv_enabled = -> {
142
- ["Get-WindowsOptionalFeature", "Get-WindowsFeature"].each do |cmd_name|
143
- ps_cmd = "$(#{cmd_name} -FeatureName Microsoft-Hyper-V-Hypervisor).State"
142
+ check_commands = Array.new.tap do |c|
143
+ c << "(Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-Hypervisor -Online).State"
144
+ c << "(Get-WindowsFeature -FeatureName Microsoft-Hyper-V-Hypervisor).State"
145
+ end
146
+ check_commands.each do |ps_cmd|
144
147
  begin
145
148
  output = Vagrant::Util::PowerShell.execute_cmd(ps_cmd)
146
149
  return true if output == "Enabled"
147
150
  rescue Errors::PowerShellInvalidVersion
148
151
  logger.warn("Invalid PowerShell version detected during Hyper-V enable check")
149
152
  return false
153
+ rescue Errors::PowerShellError
154
+ logger.warn("Powershell command not found or error on execution of command")
155
+ return false
150
156
  end
151
157
  end
152
158
  return false
data/lib/vagrant/util.rb CHANGED
@@ -20,6 +20,7 @@ module Vagrant
20
20
  autoload :Experimental, 'vagrant/util/experimental'
21
21
  autoload :FileChecksum, 'vagrant/util/file_checksum'
22
22
  autoload :FileMode, 'vagrant/util/file_mode'
23
+ autoload :FileMutex, 'vagrant/util/file_mutex'
23
24
  autoload :GuestHosts, 'vagrant/util/guest_hosts'
24
25
  autoload :GuestInspection, 'vagrant/util/guest_inspection'
25
26
  autoload :HashWithIndifferentAccess, 'vagrant/util/hash_with_indifferent_access'
data/lib/vagrant.rb CHANGED
@@ -39,6 +39,7 @@ module VagrantPlugins
39
39
  OptionParser = Vagrant::OptionParser
40
40
  end
41
41
 
42
+ # Load in our helpers and utilities
42
43
  require "vagrant/shared_helpers"
43
44
  require "rubygems"
44
45
  require "vagrant/util"
Binary file
@@ -16,7 +16,7 @@ module VagrantPlugins
16
16
  o.banner = "Usage: vagrant box outdated [options]"
17
17
  o.separator ""
18
18
  o.separator "Checks if there is a new version available for the box"
19
- o.separator "that are you are using. If you pass in the --global flag,"
19
+ o.separator "that you are using. If you pass in the --global flag,"
20
20
  o.separator "all boxes will be checked for updates."
21
21
  o.separator ""
22
22
  o.separator "Options:"
@@ -1,39 +1,37 @@
1
- $LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs").to_s
2
- $LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs/proto").to_s
3
- $LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs/proto/vagrant_plugin_sdk").to_s
4
-
5
- require 'vagrant/protobufs/proto/vagrant_server/server_pb'
6
- require 'vagrant/protobufs/proto/vagrant_server/server_services_pb'
7
- require 'vagrant/protobufs/proto/ruby_vagrant/ruby-server_pb'
8
- require 'vagrant/protobufs/proto/ruby_vagrant/ruby-server_services_pb'
9
- require 'vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_pb'
10
- require 'vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_services_pb'
11
- require 'vagrant/protobufs/proto/plugin/grpc_broker_pb'
12
- require 'vagrant/protobufs/proto/plugin/grpc_broker_services_pb'
13
-
14
1
  require "optparse"
15
- require 'grpc'
16
- require 'grpc/health/checker'
17
- require 'grpc/health/v1/health_services_pb'
18
2
 
19
3
  module VagrantPlugins
20
4
  module CommandServe
21
- # Simple constant aliases to reduce namespace typing
22
- SDK = Hashicorp::Vagrant::Sdk
23
- SRV = Hashicorp::Vagrant
24
- Empty = ::Google::Protobuf::Empty
25
-
26
5
  autoload :Broker, Vagrant.source_root.join("plugins/commands/serve/broker").to_s
27
6
  autoload :Client, Vagrant.source_root.join("plugins/commands/serve/client").to_s
28
7
  autoload :Mappers, Vagrant.source_root.join("plugins/commands/serve/mappers").to_s
29
8
  autoload :Service, Vagrant.source_root.join("plugins/commands/serve/service").to_s
30
9
  autoload :Type, Vagrant.source_root.join("plugins/commands/serve/type").to_s
31
10
  autoload :Util, Vagrant.source_root.join("plugins/commands/serve/util").to_s
11
+ autoload :SDK, Vagrant.source_root.join("plugins/commands/serve/constants").to_s
12
+ autoload :SRV, Vagrant.source_root.join("plugins/commands/serve/constants").to_s
13
+ autoload :Empty, Vagrant.source_root.join("plugins/commands/serve/constants").to_s
32
14
 
33
15
  class << self
34
16
  attr_accessor :broker
35
17
  attr_accessor :server
36
18
  attr_reader :cache
19
+
20
+ # Loads the required dependencies for this command. This is isolated
21
+ # into a method so that the dependencies can be loaded just in time when
22
+ # the command is actually executed.
23
+ def load_dependencies!
24
+ return if @dependencies_loaded
25
+ require 'grpc'
26
+ require 'grpc/health/checker'
27
+ require 'grpc/health/v1/health_services_pb'
28
+
29
+ # Add conversion patches
30
+ require Vagrant.source_root.join("plugins/commands/serve/util/direct_conversions.rb").to_s
31
+
32
+ # Mark dependencies as loaded
33
+ @dependencies_loaded = true
34
+ end
37
35
  end
38
36
  @cache = Util::Cacher.new
39
37
 
@@ -49,6 +47,9 @@ module VagrantPlugins
49
47
  end
50
48
 
51
49
  def execute
50
+ # Load dependencies before we start
51
+ CommandServe.load_dependencies!
52
+
52
53
  options = {
53
54
  bind: DEFAULT_BIND,
54
55
  min_port: DEFAULT_PORT_RANGE.first,
@@ -138,6 +139,3 @@ module VagrantPlugins
138
139
  end
139
140
  end
140
141
  end
141
-
142
- # Load in our conversions down here so all the autoload stuff is in place
143
- require Vagrant.source_root.join("plugins/commands/serve/util/direct_conversions.rb").to_s