This works by now calling the `:ssh` action on the provider. This action is allowed to do whatever it pleases, but should at some point probably call the `SSHExec` built-in middleware. The `SSHExec` built-in middleware was added. This uses the information returned by `Machine#ssh_info` and uses the `Vagrant::Util::SSH` helper to exec into the remote machine. The provider should do any work upfront in verifying that the machine is ready to be SSHed into.
22 lines
511 B
Ruby
22 lines
511 B
Ruby
module VagrantPlugins
|
|
module ProviderVirtualBox
|
|
module Action
|
|
# This middleware checks that the VM is created, and raises an exception
|
|
# if it is not, notifying the user that creation is required.
|
|
class CheckCreated
|
|
def initialize(app, env)
|
|
@app = app
|
|
end
|
|
|
|
def call(env)
|
|
if env[:machine].state == :not_created
|
|
raise Vagrant::Errors::VMNotCreatedError
|
|
end
|
|
|
|
@app.call(env)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|