diff --git a/lib/vagrant/box/remote.rb b/lib/vagrant/box/remote.rb index 60eb95100..13509c099 100644 --- a/lib/vagrant/box/remote.rb +++ b/lib/vagrant/box/remote.rb @@ -19,7 +19,7 @@ module Vagrant # disk. # @param [String] metadata_url Metadata URL for box # @param [Hook] hook A hook to apply to the box downloader, for example, for authentication - def initialize(name, provider, version, directory, metadata_url: nil, hook: nil) + def initialize(name, provider, version, directory, metadata_url: nil, hook: nil, client: nil) @logger = Log4r::Logger.new("vagrant::box") @name = name @@ -28,6 +28,12 @@ module Vagrant @directory = directory @metadata_url = metadata_url @hook = hook + + if client.nil? + raise ArgumentError, + "Remote client is required for `#{self.class.name}'" + end + @client = client end def destroy! @@ -57,10 +63,6 @@ module Vagrant def to_proto client.proto end - - def client=(c) - @client = c - end end end end diff --git a/plugins/commands/serve/client/target/machine.rb b/plugins/commands/serve/client/target/machine.rb index 62e7bc77c..3f9c758f6 100644 --- a/plugins/commands/serve/client/target/machine.rb +++ b/plugins/commands/serve/client/target/machine.rb @@ -19,15 +19,13 @@ module VagrantPlugins def box b = client.box(Empty.new) box_client = Box.load(b, broker: broker) - logger.debug("got box client #{box_client}") box = Vagrant::Box.new( box_client.name, box_client.provider.to_sym, box_client.version, Pathname.new(box_client.directory), + client: box_client ) - logger.debug("generate box from box client #{box}") - box.client = box_client box end