vagrant-unbundled 2.2.10.0 → 2.2.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -0
  3. data/Gemfile +1 -1
  4. data/README.md +4 -44
  5. data/RELEASE.md +1 -1
  6. data/contrib/zsh/_vagrant +3 -1
  7. data/contrib/zsh/generate_zsh_completion.rb +2 -3
  8. data/lib/vagrant.rb +0 -4
  9. data/lib/vagrant/action/builder.rb +6 -15
  10. data/lib/vagrant/action/builtin/box_add.rb +5 -1
  11. data/lib/vagrant/action/builtin/cloud_init_setup.rb +10 -15
  12. data/lib/vagrant/action/builtin/synced_folders.rb +8 -2
  13. data/lib/vagrant/action/runner.rb +1 -1
  14. data/lib/vagrant/box.rb +8 -2
  15. data/lib/vagrant/box_collection.rb +1 -1
  16. data/lib/vagrant/bundler.rb +43 -16
  17. data/lib/vagrant/machine.rb +8 -5
  18. data/lib/vagrant/machine_index.rb +1 -0
  19. data/lib/vagrant/plugin/v2/command.rb +2 -1
  20. data/lib/vagrant/shared_helpers.rb +8 -0
  21. data/lib/vagrant/util/downloader.rb +3 -2
  22. data/lib/vagrant/util/is_port_open.rb +1 -1
  23. data/lib/vagrant/util/mime.rb +92 -0
  24. data/lib/vagrant/util/platform.rb +2 -1
  25. data/lib/vagrant/util/template_renderer.rb +2 -2
  26. data/lib/vagrant/util/uploader.rb +7 -4
  27. data/plugins/commands/cap/command.rb +5 -1
  28. data/plugins/commands/cloud/auth/login.rb +20 -23
  29. data/plugins/commands/cloud/auth/logout.rb +2 -10
  30. data/plugins/commands/cloud/auth/middleware/add_downloader_authentication.rb +57 -0
  31. data/plugins/commands/cloud/auth/whoami.rb +18 -20
  32. data/plugins/commands/cloud/box/create.rb +33 -29
  33. data/plugins/commands/cloud/box/delete.rb +30 -24
  34. data/plugins/commands/cloud/box/show.rb +41 -31
  35. data/plugins/commands/cloud/box/update.rb +34 -26
  36. data/plugins/commands/cloud/client/client.rb +50 -81
  37. data/plugins/commands/cloud/list.rb +3 -4
  38. data/plugins/commands/cloud/locales/en.yml +9 -9
  39. data/plugins/commands/cloud/plugin.rb +10 -0
  40. data/plugins/commands/cloud/provider/create.rb +38 -28
  41. data/plugins/commands/cloud/provider/delete.rb +39 -29
  42. data/plugins/commands/cloud/provider/update.rb +37 -28
  43. data/plugins/commands/cloud/provider/upload.rb +44 -34
  44. data/plugins/commands/cloud/publish.rb +185 -108
  45. data/plugins/commands/cloud/search.rb +34 -21
  46. data/plugins/commands/cloud/util.rb +266 -162
  47. data/plugins/commands/cloud/version/create.rb +33 -28
  48. data/plugins/commands/cloud/version/delete.rb +35 -28
  49. data/plugins/commands/cloud/version/release.rb +35 -29
  50. data/plugins/commands/cloud/version/revoke.rb +36 -29
  51. data/plugins/commands/cloud/version/update.rb +29 -25
  52. data/plugins/commands/login/plugin.rb +0 -13
  53. data/plugins/guests/arch/cap/smb.rb +1 -1
  54. data/plugins/guests/darwin/cap/darwin_version.rb +40 -0
  55. data/plugins/guests/darwin/cap/mount_smb_shared_folder.rb +1 -1
  56. data/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb +12 -2
  57. data/plugins/guests/darwin/plugin.rb +10 -0
  58. data/plugins/guests/debian/cap/change_host_name.rb +8 -7
  59. data/plugins/guests/linux/cap/mount_smb_shared_folder.rb +16 -41
  60. data/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +6 -0
  61. data/plugins/guests/linux/cap/persist_mount_shared_folder.rb +18 -5
  62. data/plugins/guests/linux/cap/reboot.rb +10 -5
  63. data/plugins/guests/redhat/cap/change_host_name.rb +6 -2
  64. data/plugins/guests/suse/cap/change_host_name.rb +32 -11
  65. data/plugins/guests/windows/cap/reboot.rb +8 -4
  66. data/plugins/kernel_v2/config/cloud_init.rb +7 -0
  67. data/plugins/kernel_v2/config/disk.rb +1 -1
  68. data/plugins/kernel_v2/config/vm.rb +5 -4
  69. data/plugins/providers/hyperv/action.rb +1 -1
  70. data/plugins/providers/virtualbox/cap/mount_options.rb +1 -1
  71. data/plugins/providers/virtualbox/model/storage_controller_array.rb +4 -6
  72. data/plugins/providers/virtualbox/provider.rb +2 -1
  73. data/plugins/synced_folders/smb/cap/mount_options.rb +21 -1
  74. data/plugins/synced_folders/smb/plugin.rb +10 -0
  75. data/scripts/website_push_www.sh +1 -1
  76. data/vagrant.gemspec +5 -6
  77. data/version.txt +1 -1
  78. metadata +1202 -1595
  79. data/plugins/commands/login/client.rb +0 -253
  80. data/plugins/commands/login/command.rb +0 -137
  81. data/plugins/commands/login/errors.rb +0 -24
  82. data/plugins/commands/login/locales/en.yml +0 -49
  83. data/scripts/website_push_docs.sh +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d625edeb97ba13f5f08f17901d1bc642034e6742e3a790c7392487d8b65548d1
4
- data.tar.gz: 7b1c09badb49f546e1d13db200840007ed671428f55b702591daed6a23fb512a
3
+ metadata.gz: 66676a3a6dbd082059b30ec7f0e605c435d33bc9854a2db0184457ba735939b0
4
+ data.tar.gz: 742ad824c94d7329205e98578cb6fcd4c6c756919e09966c9a83ea23a13fd32f
5
5
  SHA512:
6
- metadata.gz: 01e2904251bdfc815bf1dd5a6272c2b84a99225842d8ec2a761296af1479ab3fa112ad4c52460604296299471cc28c1a01cfcf237cc13a04867342feb4dc135f
7
- data.tar.gz: f1a8ab0331ca605242690523fd479b292ec43a34719fa787e8617fb3a3bd7512824e468b72e32e9b5b89f48867b15e68a9556c52d4c6beb3fbf291ae9d7bb9bd
6
+ metadata.gz: 88acd31085bcda4390bc37d58078a2be3b6b16f09cd4605c34d9874cbd92ac2b73d36f5e8f9761b5d4396338555aae682baeeaf7603c46f9f6643277a5bfd330
7
+ data.tar.gz: d31c929eb5c9f55ee68e1d11b96704bb75193b2f8314edd1515e793a20338d2b650f05da038d4efa27802d0e5b5f193d9083b6b5a761dc4af02bb33830a9ee0a
@@ -1,3 +1,63 @@
1
+ ## 2.2.14 (November 20, 2020)
2
+
3
+ IMPROVEMENTS:
4
+
5
+ - host/windows: Update filesystem type matching on WSL2 [GH-12056]
6
+
7
+ BUG FIXES:
8
+
9
+ - core: Track raw actions as they are applied to prevent multiple insertions [GH-12037]
10
+ - core/bundler: Update solution file resolution to support prerelease matching [GH-12054]
11
+ - guest/darwin: Mount vmware synced folders for big sur guests [GH-12053]
12
+
13
+ ## 2.2.13 (November 06, 2020)
14
+
15
+ BUG FIXES:
16
+
17
+ - core/bundler: Adjust request sets properly with non-development prerelease [GH-12025]
18
+
19
+ ## 2.2.12 (November 06, 2020)
20
+
21
+ BUG FIXES:
22
+
23
+ - core/bundler: Automatically enable prerelease dependency resolution [GH-12023]
24
+
25
+ NOTE: This is a fix release to resolve an immediate issue with Vagrant
26
+ plugin functionality
27
+
28
+ ## 2.2.11 (November 05, 2020)
29
+
30
+ IMPROVEMENTS:
31
+
32
+ - command/cap: Add ability to specify target [GH-11965]
33
+ - command/cloud: Add --force flag to `version release` command [GH-11912]
34
+ - command/cloud: Updates to utilize the 3.0 version of vagrant_cloud [GH-11916]
35
+ - core: Switch from unmaintained gem erubis to erubi [GH-11893]
36
+ - core: Download Vagrant boxes using auth headers [GH-11835]
37
+ - core: Remove dependency on mime gem [GH-11857]
38
+ - core: Handle Errno::EALREADY exceptions on port check [GH-12008]
39
+ - core: Fix missing hook/trigger insertion into action stack [GH-12014]
40
+ - guest/linux: Make max reboot wait duration configurable [GH-12011]
41
+ - guest/windows: Make max reboot wait duration configurable [GH-12011]
42
+ - providers/virtualbox: Fix availability check of provider [GH-11936]
43
+ - tests: Add integration tests for Docker provider [GH-11907]
44
+
45
+ BUG FIXES:
46
+
47
+ - core/synced_folders: Don't persist synced folders to fstab if guest is not reachable [GH-11900]
48
+ - core: Don't try to recover machine without a uuid [GH-11863]
49
+ - config/disks: Transform provider specific config to common form [GH-11939]
50
+ - config/vm: Override synced-folder `:nfs` option [GH-11988]
51
+ - contrib/zsh: Remove newline from beginning of completion script [GH-11963]
52
+ - guests/arch: Install smbclient when setting up arch smb [GH-11923]
53
+ - guest/linux: Check for /etc/fstab before trying to modify [GH-11897]
54
+ - guest/linux: Create an /etc/fstab if does not exist [GH-11909]
55
+ - guest/linux: Persist SMB mounts [GH-11846]
56
+ - guest/debian: Set hostname in /etc/hosts as first step to changing hostname [GH-11885]
57
+ - guest/rhel: Check for existence of network files before trying to update them [GH-11877]
58
+ - guest/suse: Don't use hostnamectl to set hostname if not available on system [GH-11996]
59
+ - tests: Remove rsync dependency from tests [GH-11889]
60
+
1
61
  ## 2.2.10 (August 24, 2020)
2
62
 
3
63
  FEATURES:
data/Gemfile CHANGED
@@ -5,5 +5,5 @@ gemspec
5
5
  if File.exist?(File.expand_path("../../vagrant-spec", __FILE__))
6
6
  gem 'vagrant-spec', path: "../vagrant-spec"
7
7
  else
8
- gem 'vagrant-spec', git: "https://github.com/hashicorp/vagrant-spec.git"
8
+ gem 'vagrant-spec', git: "https://github.com/hashicorp/vagrant-spec.git", branch: :main
9
9
  end
data/README.md CHANGED
@@ -17,7 +17,8 @@ between Windows, Mac OS X, and Linux.
17
17
 
18
18
  ## Quick Start
19
19
 
20
- Package dependencies: Vagrant requires `bsdtar` to be available on your system PATH to run successfully.
20
+ Package dependencies: Vagrant requires `bsdtar` and `curl` to be available on
21
+ your system PATH to run successfully.
21
22
 
22
23
  For the quick-start, we'll bring up a development machine on
23
24
  [VirtualBox](https://www.virtualbox.org/) because it is free and works
@@ -45,52 +46,11 @@ To learn how to build a fully functional development environment, follow the
45
46
 
46
47
  ## Installing from Source
47
48
 
48
- If you want the bleeding edge version of Vagrant, we try to keep master pretty stable
49
+ If you want the bleeding edge version of Vagrant, we try to keep main pretty stable
49
50
  and you're welcome to give it a shot. Please review the installation page [here](https://www.vagrantup.com/docs/installation/source).
50
51
 
51
52
  ## Contributing to Vagrant
52
53
 
53
- Once your Vagrant bundle is installed from Git repository, you can run the test suite with:
54
-
55
- bundle exec rake
56
-
57
- This will run the unit test suite, which should come back all green!
58
-
59
- If you are developing Vagrant on a machine that already has a Vagrant package installation present, both will attempt to use the same folder for their configuration (location of this folder depends on system). This can cause errors when Vagrant attempts to load plugins. In this case, override the `VAGRANT_HOME` environment variable for your development version of Vagrant before running any commands, to be some new folder within the project or elsewhere on your machine. For example, in Bash:
60
-
61
- export VAGRANT_HOME=~/.vagrant-dev
62
-
63
- You can now run Vagrant commands against the development version:
64
-
65
- bundle exec vagrant
66
-
67
- Please take time to read the [HashiCorp Community Guidelines](https://www.hashicorp.com/community-guidelines) and the [Vagrant Contributing Guide](https://github.com/hashicorp/vagrant/blob/master/.github/CONTRIBUTING.md).
54
+ Please take time to read the [HashiCorp Community Guidelines](https://www.hashicorp.com/community-guidelines) and the [Vagrant Contributing Guide](https://github.com/hashicorp/vagrant/blob/main/.github/CONTRIBUTING.md).
68
55
 
69
56
  Then you're good to go!
70
-
71
- ### Acceptance Tests
72
-
73
- Vagrant also comes with an acceptance test suite that does black-box
74
- tests of various Vagrant components. Note that these tests are **extremely
75
- slow** because actual VMs are spun up and down. The full test suite can
76
- take hours. Instead, try to run focused component tests.
77
-
78
- To run the acceptance test suite, first copy `vagrant-spec.config.example.rb`
79
- to `vagrant-spec.config.rb` and modify it to valid values. The places you
80
- should fill in are clearly marked.
81
-
82
- Next, see the components that can be tested:
83
-
84
- ```
85
- $ rake acceptance:components
86
- cli
87
- provider/virtualbox/basic
88
- ...
89
- ```
90
-
91
- Then, run one of those components:
92
-
93
- ```
94
- $ rake acceptance:run COMPONENTS="cli"
95
- ...
96
- ```
data/RELEASE.md CHANGED
@@ -22,7 +22,7 @@ targeted at Vagrant core members who have the ability to cut a release.
22
22
  to the latest version, commit, and push.
23
23
 
24
24
  1. Publish the webiste by deleting the `stable-website` branch, recreate the branch,
25
- and force push. From the `master` branch, run:
25
+ and force push. From the `main` branch, run:
26
26
 
27
27
  ```
28
28
  $ git branch -D stable-website
@@ -1,4 +1,3 @@
1
-
2
1
  #compdef _vagrant vagrant
3
2
 
4
3
  # ZSH completion for Vagrant
@@ -26,6 +25,7 @@ __plugin_list ()
26
25
  function _vagrant () {
27
26
 
28
27
  local -a sub_commands && sub_commands=(
28
+ 'autocomplete:manages autocomplete installation on host'
29
29
  'box:manages boxes: installation, removal, etc.'
30
30
  'cloud:manages everything related to Vagrant Cloud'
31
31
  'destroy:stops and deletes all traces of the vagrant machine'
@@ -316,6 +316,8 @@ case $state in
316
316
 
317
317
  (options)
318
318
  case $line[1] in
319
+ autocomplete)
320
+ __vagrant-autocomplete ;;
319
321
  box)
320
322
  __vagrant-box ;;
321
323
  cloud)
@@ -1,7 +1,6 @@
1
1
  require 'open3'
2
2
 
3
- HEAD = """
4
- #compdef _vagrant vagrant
3
+ HEAD = """#compdef _vagrant vagrant
5
4
 
6
5
  # ZSH completion for Vagrant
7
6
  #
@@ -163,4 +162,4 @@ def generate_script
163
162
  script
164
163
  end
165
164
 
166
- puts generate_script
165
+ puts generate_script
@@ -93,10 +93,6 @@ if ENV["VAGRANT_LOG"] && ENV["VAGRANT_LOG"] != ""
93
93
  date_pattern: "%F %T"
94
94
  )
95
95
  end
96
- # Vagrant Cloud gem uses RestClient to make HTTP requests, so
97
- # log them if debug is enabled and use Vagrants logger
98
- require 'rest_client'
99
- RestClient.log = logger
100
96
 
101
97
  Log4r::Outputter.stderr.formatter = Vagrant::Util::LoggingFormatter.new(base_formatter)
102
98
  logger = nil
@@ -258,7 +258,9 @@ module Vagrant
258
258
  # @param [Hash] env Call environment
259
259
  # @return [Builder]
260
260
  def apply_action_name(env)
261
+ env[:builder_raw_applied] ||= []
261
262
  return self if !env[:action_name]
263
+
262
264
  hook = Hook.new
263
265
  machine_name = env[:machine].name if env[:machine]
264
266
 
@@ -285,7 +287,9 @@ module Vagrant
285
287
  # are the originally implemented trigger style. They run before
286
288
  # and after specific provider actions (like :up, :halt, etc) and
287
289
  # are different from true action triggers
288
- if env[:triggers]
290
+ if env[:triggers] && !env[:builder_raw_applied].include?(env[:raw_action_name])
291
+ env[:builder_raw_applied] << env[:raw_action_name]
292
+
289
293
  if !env[:triggers].find(env[:raw_action_name], :before, machine_name, :action, all: true).empty?
290
294
  hook.prepend(Vagrant::Action::Builtin::Trigger,
291
295
  env[:raw_action_name], env[:triggers], :before, :action, all: true)
@@ -306,21 +310,8 @@ module Vagrant
306
310
  # we can just send ourself back
307
311
  return self if hook.empty?
308
312
 
309
- # These are the options to pass into hook application.
310
- options = {}
311
-
312
- # If we already ran through once and did append/prepends,
313
- # then don't do it again.
314
- if env[:action_hooks_already_ran]
315
- options[:no_prepend_or_append] = true
316
- end
317
-
318
- # Specify that we already ran, so in the future we don't repeat
319
- # the prepend/append hooks.
320
- env[:action_hooks_already_ran] = true
321
-
322
313
  # Apply all the hooks to the new builder instance
323
- hook.apply(self, options)
314
+ hook.apply(self)
324
315
 
325
316
  self
326
317
  end
@@ -436,13 +436,16 @@ module Vagrant
436
436
  downloader_options[:location_trusted] = env[:box_download_location_trusted]
437
437
  downloader_options[:box_extra_download_options] = env[:box_extra_download_options]
438
438
 
439
- Util::Downloader.new(url, temp_path, downloader_options)
439
+ d = Util::Downloader.new(url, temp_path, downloader_options)
440
+ env[:hook].call(:authenticate_box_downloader, downloader: d)
441
+ d
440
442
  end
441
443
 
442
444
  def download(url, env, **opts)
443
445
  opts[:ui] = true if !opts.key?(:ui)
444
446
 
445
447
  d = downloader(url, env, **opts)
448
+ env[:hook].call(:authenticate_box_downloader, downloader: d)
446
449
 
447
450
  # Download the box to a temporary path. We store the temporary
448
451
  # path as an instance variable so that the `#recover` method can
@@ -486,6 +489,7 @@ module Vagrant
486
489
  # @return [Boolean] true if metadata
487
490
  def metadata_url?(url, env)
488
491
  d = downloader(url, env, json: true, ui: false)
492
+ env[:hook].call(:authenticate_box_downloader, downloader: d)
489
493
 
490
494
  # If we're downloading a file, cURL just returns no
491
495
  # content-type (makes sense), so we just test if it is JSON
@@ -1,4 +1,4 @@
1
- require 'mime'
1
+ require 'vagrant/util/mime'
2
2
  require 'tmpdir'
3
3
 
4
4
  module Vagrant
@@ -32,7 +32,7 @@ module Vagrant
32
32
  # @param [Vagrant::Machine] machine
33
33
  # @param [Vagrant::Environment] env
34
34
  # @param [Array<#VagrantPlugins::Kernel_V2::VagrantConfigCloudInit>] user_data_cfgs
35
- # @return [MIME::Text] user_data
35
+ # @return [Vagrant::Util::Mime::MultiPart] user_data
36
36
  def setup_user_data(machine, env, user_data_cfgs)
37
37
  machine.ui.info(I18n.t("vagrant.actions.vm.cloud_init_user_data_setup"))
38
38
 
@@ -47,7 +47,7 @@ module Vagrant
47
47
  #
48
48
  # @param [Vagrant::Machine] machine
49
49
  # @param [VagrantPlugins::Kernel_V2::VagrantConfigCloudInit] cfg
50
- # @return [MIME::Text] text_msg
50
+ # @return [Vagrant::Util::Mime::Entity] text_msg
51
51
  def read_text_cfg(machine, cfg)
52
52
  if cfg.path
53
53
  text = File.read(Pathname.new(cfg.path).expand_path(machine.env.root_path))
@@ -55,13 +55,8 @@ module Vagrant
55
55
  text = cfg.inline
56
56
  end
57
57
 
58
- # Note: content_type must remove the leading `text/` because
59
- # the MIME::Text initializer hardcodes `text/` already to the type.
60
- # We assume content_type is correct due to the validation step
61
- # in VagrantConfigCloudInit.
62
- content_type = cfg.content_type.split('/', 2).last
63
- text_msg = MIME::Text.new(text, content_type)
64
-
58
+ text_msg = Vagrant::Util::Mime::Entity.new(text, cfg.content_type)
59
+ text_msg.disposition = "attachment; filename=\"#{File.basename(cfg.content_disposition_filename).gsub('"', '\"')}\"" if cfg.content_disposition_filename
65
60
  text_msg
66
61
  end
67
62
 
@@ -69,11 +64,11 @@ module Vagrant
69
64
  # message
70
65
  #
71
66
  # @param [Vagrant::Machine] machine
72
- # @param [Array<MIME::Text>] text_msg - One or more text configs
73
- # @return [MIME::Multipart::Mixed] msg
67
+ # @param [Array<Vagrant::Util::Mime::Entity>] text_msg - One or more text configs
68
+ # @return [Vagrant::Util::Mime::Multipart] msg
74
69
  def generate_cfg_msg(machine, text_cfgs)
75
- msg = MIME::Multipart::Mixed.new
76
- msg.headers.set("MIME-Version", "1.0")
70
+ msg = Vagrant::Util::Mime::Multipart.new
71
+ msg.headers["MIME-Version"] = "1.0"
77
72
 
78
73
  text_cfgs.each do |c|
79
74
  msg.add(c)
@@ -87,7 +82,7 @@ module Vagrant
87
82
  # written to an iso
88
83
  #
89
84
  # @param [Vagrant::Machine] machine
90
- # @param [MIME::Multipart::Mixed] user_data
85
+ # @param [Vagrant::Util::Mime::Multipart] user_data
91
86
  # @param [Hash] meta_data
92
87
  def write_cfg_iso(machine, env, user_data, meta_data)
93
88
  iso_path = nil
@@ -129,8 +129,14 @@ module Vagrant
129
129
  save_synced_folders(env[:machine], original_folders, **save_opts)
130
130
  end
131
131
 
132
- # Persist the mounts by adding them to fstab
133
- if env[:machine].guest.capability?(:persist_mount_shared_folder)
132
+ # Persist the mounts by adding them to fstab (only if the guest is available)
133
+ begin
134
+ persist_mount = env[:machine].guest.capability?(:persist_mount_shared_folder)
135
+ rescue Errors::MachineGuestNotReady
136
+ persist_mount = false
137
+ end
138
+ if persist_mount
139
+ # Persist the mounts by adding them to fstab
134
140
  if env[:machine].config.vm.allow_fstab_modification
135
141
  fstab_folders = original_folders
136
142
  else
@@ -85,7 +85,7 @@ module Vagrant
85
85
  action_name = environment[:action_name]
86
86
 
87
87
  # We place a process lock around every action that is called
88
- @logger.info("Running action: #{environment[:action_name]} #{callable_id}")
88
+ @logger.info("Running action: #{action_name} #{callable_id}")
89
89
  Util::Busy.busy(int_callback) { callable.call(environment) }
90
90
 
91
91
  # Return the environment in case there are things in there that
@@ -58,12 +58,14 @@ module Vagrant
58
58
  # @param [Pathname] directory The directory where this box exists on
59
59
  # disk.
60
60
  # @param [String] metadata_url Metadata URL for box
61
- def initialize(name, provider, version, directory, metadata_url: nil)
61
+ # @param [Hook] hook A hook to apply to the box downloader, for example, for authentication
62
+ def initialize(name, provider, version, directory, metadata_url: nil, hook: nil)
62
63
  @name = name
63
64
  @version = version
64
65
  @provider = provider
65
66
  @directory = directory
66
67
  @metadata_url = metadata_url
68
+ @hook = hook
67
69
 
68
70
  metadata_file = directory.join("metadata.json")
69
71
  raise Errors::BoxMetadataFileNotFound, name: @name if !metadata_file.file?
@@ -133,7 +135,11 @@ module Vagrant
133
135
  end
134
136
 
135
137
  opts = { headers: ["Accept: application/json"] }.merge(download_options)
136
- Util::Downloader.new(url, tf.path, opts).download!
138
+ d = Util::Downloader.new(url, tf.path, opts)
139
+ if @hook
140
+ @hook.call(:authenticate_box_downloader, downloader: d)
141
+ end
142
+ d.download!
137
143
  BoxMetadata.new(File.open(tf.path, "r"))
138
144
  rescue Errors::DownloaderError => e
139
145
  raise Errors::BoxMetadataDownloadError,
@@ -325,7 +325,7 @@ module Vagrant
325
325
 
326
326
  return Box.new(
327
327
  name, provider, version_dir_map[v.to_s], provider_dir,
328
- metadata_url: metadata_url,
328
+ metadata_url: metadata_url, hook: @hook
329
329
  )
330
330
  end
331
331
  end
@@ -23,13 +23,13 @@ module Vagrant
23
23
  attr_reader :plugin_file
24
24
  # @return [Pathname] path to solution file
25
25
  attr_reader :solution_file
26
- # @return [Array<Gem::Dependency>] list of required dependencies
26
+ # @return [Array<Gem::Resolver::DependencyRequest>] list of required dependencies
27
27
  attr_reader :dependency_list
28
28
 
29
29
  # @param [Pathname] plugin_file Path to plugin file
30
30
  # @param [Pathname] solution_file Custom path to solution file
31
31
  def initialize(plugin_file:, solution_file: nil)
32
- @logger = Log4r::Logger.new("vagrant::bundler::signature_file")
32
+ @logger = Log4r::Logger.new("vagrant::bundler::solution_file")
33
33
  @plugin_file = Pathname.new(plugin_file.to_s)
34
34
  if solution_file
35
35
  @solution_file = Pathname.new(solution_file.to_s)
@@ -46,13 +46,16 @@ module Vagrant
46
46
  # Set the list of dependencies for this solution
47
47
  #
48
48
  # @param [Array<Gem::Dependency>] dependency_list List of dependencies for the solution
49
+ # @return [Array<Gem::Resolver::DependencyRequest>]
49
50
  def dependency_list=(dependency_list)
50
51
  Array(dependency_list).each do |d|
51
52
  if !d.is_a?(Gem::Dependency)
52
53
  raise TypeError, "Expected `Gem::Dependency` but received `#{d.class}`"
53
54
  end
54
55
  end
55
- @dependency_list = dependency_list.map(&:freeze).freeze
56
+ @dependency_list = dependency_list.map do |d|
57
+ Gem::Resolver::DependencyRequest.new(d, nil).freeze
58
+ end.freeze
56
59
  end
57
60
 
58
61
  # @return [Boolean] contained solution is valid
@@ -62,8 +65,9 @@ module Vagrant
62
65
 
63
66
  # @return [FalseClass] invalidate this solution file
64
67
  def invalidate!
65
- @logger.debug("manually invalidating solution file")
66
68
  @valid = false
69
+ @logger.debug("manually invalidating solution file #{self}")
70
+ @valid
67
71
  end
68
72
 
69
73
  # Delete the solution file
@@ -92,7 +96,7 @@ module Vagrant
92
96
  @logger.debug("writing solution file contents to disk")
93
97
  solution_file.write({
94
98
  dependencies: dependency_list.map { |d|
95
- [d.name, d.requirements_list]
99
+ [d.dependency.name, d.dependency.requirements_list]
96
100
  },
97
101
  checksum: plugin_file_checksum,
98
102
  vagrant_version: Vagrant::VERSION
@@ -121,9 +125,10 @@ module Vagrant
121
125
  version: solution[:vagrant_version]
122
126
  )
123
127
  @logger.debug("loading solution dependency list")
124
- @dependency_list = solution[:dependencies].map do |name, requirements|
125
- Gem::Dependency.new(name, requirements)
126
- end
128
+ @dependency_list = Array(solution[:dependencies]).map do |name, requirements|
129
+ gd = Gem::Dependency.new(name, requirements)
130
+ Gem::Resolver::DependencyRequest.new(gd, nil).freeze
131
+ end.freeze
127
132
  @logger.debug("solution dependency list: #{dependency_list}")
128
133
  @valid = true
129
134
  end
@@ -158,6 +163,7 @@ module Vagrant
158
163
  Vagrant::Util::HashWithIndifferentAccess.new(hash)
159
164
  rescue => err
160
165
  @logger.warn("failed to load solution file, ignoring (error: #{err})")
166
+ nil
161
167
  end
162
168
  end
163
169
  end
@@ -240,6 +246,12 @@ module Vagrant
240
246
  solution = nil
241
247
  composed_set = generate_vagrant_set
242
248
 
249
+ # Force the composed set to allow prereleases
250
+ if Vagrant.allow_prerelease_dependencies?
251
+ @logger.debug("enabling prerelease dependency matching due to user request")
252
+ composed_set.prerelease = true
253
+ end
254
+
243
255
  if solution_file&.valid?
244
256
  @logger.debug("loading cached solution set")
245
257
  solution = solution_file.dependency_list.map do |dep|
@@ -550,13 +562,19 @@ module Vagrant
550
562
 
551
563
  # Create the request set for the new plugins
552
564
  request_set = Gem::RequestSet.new(*plugin_deps)
553
- request_set.prerelease = Vagrant.prerelease?
554
565
 
555
566
  installer_set = Gem::Resolver.compose_sets(
556
567
  installer_set,
557
568
  generate_builtin_set(system_plugins),
558
569
  generate_plugin_set(skips)
559
570
  )
571
+
572
+ if Vagrant.allow_prerelease_dependencies?
573
+ @logger.debug("enabling prerelease dependency matching based on user request")
574
+ request_set.prerelease = true
575
+ installer_set.prerelease = true
576
+ end
577
+
560
578
  @logger.debug("Generating solution set for installation.")
561
579
 
562
580
  # Generate the required solution set for new plugins
@@ -582,7 +600,7 @@ module Vagrant
582
600
  install_path = extra[:env_local] ? env_plugin_gem_path : plugin_gem_path
583
601
  result = request_set.install_into(install_path.to_s, true,
584
602
  ignore_dependencies: true,
585
- prerelease: Vagrant.prerelease?,
603
+ prerelease: Vagrant.prerelease? || Vagrant.allow_prerelease_dependencies?,
586
604
  wrappers: true,
587
605
  document: []
588
606
  )
@@ -740,7 +758,6 @@ module Vagrant
740
758
  request.name == matcher["gem_name"]
741
759
  end
742
760
  if desired_activation_request && !desired_activation_request.full_spec.activated?
743
- activation_request = desired_activation_request
744
761
  @logger.warn("Found misordered activation request for #{desired_activation_request.full_name}. Moving to solution HEAD.")
745
762
  solution.delete(desired_activation_request)
746
763
  solution.unshift(desired_activation_request)
@@ -812,12 +829,22 @@ module Vagrant
812
829
  end
813
830
 
814
831
  def find_all(req)
815
- @specs.select do |spec|
816
- allow_prerelease = spec.name == "vagrant-unbundled" && Vagrant.prerelease?
817
- req.match?(spec, allow_prerelease)
832
+ r = @specs.select do |spec|
833
+ # When matching requests against builtin specs, we _always_ enable
834
+ # prerelease matching since any prerelease that's found in this
835
+ # set has been added explicitly and should be available for all
836
+ # plugins to resolve against. This includes Vagrant itself since
837
+ # it is considered a prerelease when in development mode
838
+ req.match?(spec, true)
818
839
  end.map do |spec|
819
840
  Gem::Resolver::InstalledSpecification.new(self, spec)
820
841
  end
842
+ # If any of the results are a prerelease, we need to mark the request
843
+ # to allow prereleases so the solution can be properly fulfilled
844
+ if r.any? { |x| x.version.prerelease? }
845
+ req.dependency.prerelease = true
846
+ end
847
+ r
821
848
  end
822
849
  end
823
850
 
@@ -851,7 +878,7 @@ module Vagrant
851
878
  # DependencyRequest +req+.
852
879
  def find_all(req)
853
880
  @specs.values.flatten.select do |spec|
854
- req.match?(spec)
881
+ req.match?(spec, prerelease)
855
882
  end.map do |spec|
856
883
  source = Gem::Source::Vendor.new(@directories[spec])
857
884
  Gem::Resolver::VendorSpecification.new(self, spec, source)
@@ -861,7 +888,7 @@ module Vagrant
861
888
  ##
862
889
  # Loads a spec with the given +name+. +version+, +platform+ and +source+ are
863
890
  # ignored.
864
- def load_spec (name, version, platform, source)
891
+ def load_spec(name, version, platform, source)
865
892
  version = Gem::Version.new(version) if !version.is_a?(Gem::Version)
866
893
  @specs.fetch(name, []).detect{|s| s.name == name && s.version == version}
867
894
  end