mitchellh/vagrant — Issue #761: Documentation for running middleware is wrong
Author: mconigliaro
Created: 2012-02-23 23:21:41+00:00
State: open

Since my plugin isn't using its own middleware, I decided to run Vagrant::Action::General::Validate at the beginning of my Command::execute method. Unfortunately, [the middleware documentation](http://vagrantup.com/docs/extending/middleware.html) gives the following **incorrect** example (there is no **actions** method):

env.actions.run(SayHelloMiddleware)

I believe this is what I should be doing from a command:

@env.action_runner.run(Vagrant::Action::General::Validate)

But now I get the error below. Is this still not the correct way to run a middleware from a command?

```/Users/mikec/.rvm/gems/ruby-1.9.3-p0/gems/vagrant-0.9.7/lib/vagrant/action/general/validate.rb:13:in `call': undefined method `config' for nil:NilClass (NoMethodError)
from /Users/mikec/.rvm/gems/ruby-1.9.3-p0/gems/vagrant-0.9.7/lib/vagrant/action/warden.rb:33:in `call'
from /Users/mikec/.rvm/gems/ruby-1.9.3-p0/gems/vagrant-0.9.7/lib/vagrant/action/builder.rb:92:in `call'
from /Users/mikec/.rvm/gems/ruby-1.9.3-p0/gems/vagrant-0.9.7/lib/vagrant/action/runner.rb:49:in `block in run'
from /Users/mikec/.rvm/gems/ruby-1.9.3-p0/gems/vagrant-0.9.7/lib/vagrant/util/busy.rb:19:in `busy'
from /Users/mikec/.rvm/gems/ruby-1.9.3-p0/gems/vagrant-0.9.7/lib/vagrant/action/runner.rb:49:in `run'
from /Users/mikec/projects/livingsocial/merchant_platform_ops/plugins/vagrant-test.rb:42:in `execute'
from /Users/mikec/.rvm/gems/ruby-1.9.3-p0/gems/vagrant-0.9.7/lib/vagrant/cli.rb:38:in `execute'
from /Users/mikec/.rvm/gems/ruby-1.9.3-p0/gems/vagrant-0.9.7/lib/vagrant/environment.rb:156:in `cli'
from /Users/mikec/.rvm/gems/ruby-1.9.3-p0/gems/vagrant-0.9.7/bin/vagrant:43:in `'
from /Users/mikec/.rvm/gems/ruby-1.9.3-p0/bin/vagrant:19:in `load'
from /Users/mikec/.rvm/gems/ruby-1.9.3-p0/bin/vagrant:19:in `

'```