diff --git a/bin/vagrant b/bin/vagrant index adeba4f32..989fe2d3d 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -197,6 +197,12 @@ begin # Check if we are running the server if sub_cmd == "serve" Vagrant.enable_server_mode! + # NOTE: We stub the client option to allow the environment to + # be initialized for startup since it will raise an + # exception if it is unset. We don't care about the + # initially created environment, we just need it long + # enough for our serve command to get executed. + opts[:client] = :stub end # Create the environment, which is the cwd of wherever the diff --git a/lib/vagrant/environment/remote.rb b/lib/vagrant/environment/remote.rb index b4c53e059..b1695d26e 100644 --- a/lib/vagrant/environment/remote.rb +++ b/lib/vagrant/environment/remote.rb @@ -11,6 +11,10 @@ module Vagrant def initialize(opts={}) super @client = opts[:client] + if @client.nil? + raise ArgumentError, + "Remote client is required for `#{self.class.name}'" + end end # Gets a target (machine) by name @@ -18,7 +22,7 @@ module Vagrant # @param [String] machine name # return [VagrantPlugins::CommandServe::Client::Machine] def get_target(name) - return @client.target(name) + client.target(name) end end end