2012-08-05 20:45:24 +00:00
|
|
|
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)
|
2013-01-21 17:38:37 +00:00
|
|
|
if env[:machine].state.id == :not_created
|
2012-08-05 20:45:24 +00:00
|
|
|
raise Vagrant::Errors::VMNotCreatedError
|
|
|
|
end
|
|
|
|
|
|
|
|
@app.call(env)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|