diff --git a/lib/vagrant/box/remote.rb b/lib/vagrant/box/remote.rb index f5b6e6961..40dcec1ee 100644 --- a/lib/vagrant/box/remote.rb +++ b/lib/vagrant/box/remote.rb @@ -46,7 +46,7 @@ module Vagrant end def has_update?(version=nil, **opts) - client.has_update(version) + client.update_info(version) end def automatic_update_check_allowed? diff --git a/plugins/commands/serve/client/box.rb b/plugins/commands/serve/client/box.rb index 7d82d625c..a2187f44e 100644 --- a/plugins/commands/serve/client/box.rb +++ b/plugins/commands/serve/client/box.rb @@ -21,6 +21,22 @@ module VagrantPlugins res.has_update end + # @param [String] version + # @return [Array] if there is an update available return an array of + # [metadata (hash), version (string), provider (string)], + # otherwise, return nil + def update_info(version) + res = client.update_info(SDK::Box::HasUpdateRequest.new( + version: version + )) + if res.has_update + meta = mapper.map(res.metadata, to: Hash) + return [meta, res.new_version, res.new_provider] + else + nil + end + end + # @param [Sdk::Args::TargetIndex] index # @return [Bool] is in use def in_use(index)