Class: VagrantVbguest::Middleware
- Inherits:
-
Object
- Object
- VagrantVbguest::Middleware
- Includes:
- Helpers::Rebootable
- Defined in:
- lib/vagrant-vbguest/middleware.rb
Overview
A Vagrant middleware which checks the installed VirtualBox Guest Additions to match the installed VirtualBox installation on the host system.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ Middleware
constructor
A new instance of Middleware.
Methods included from Helpers::Rebootable
Constructor Details
#initialize(app, env) ⇒ Middleware
Returns a new instance of Middleware.
10 11 12 13 |
# File 'lib/vagrant-vbguest/middleware.rb', line 10 def initialize(app, env) @app = app @env = env end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vagrant-vbguest/middleware.rb', line 15 def call(env) @env = env vm = env[:vm] || env[:machine] = vm.config.vbguest.to_hash.freeze if [:auto_update] machine = VagrantVbguest::Machine.new vm, status = machine.state vm.env.ui.send((:ok == status ? :success : :warn), I18n.t("vagrant.plugins.vbguest.status.#{status}", machine.info)) machine.run reboot(vm, ) if machine.reboot? end @app.call(env) end |