Class: Vagrant::Action::VM::CheckBox
- Inherits:
-
Object
- Object
- Vagrant::Action::VM::CheckBox
- Defined in:
- lib/vagrant/action/vm/check_box.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ CheckBox
constructor
A new instance of CheckBox.
Constructor Details
#initialize(app, env) ⇒ CheckBox
Returns a new instance of CheckBox.
5 6 7 |
# File 'lib/vagrant/action/vm/check_box.rb', line 5 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vagrant/action/vm/check_box.rb', line 9 def call(env) box_name = env[:vm].config.vm.box raise Errors::BoxNotSpecified if !box_name if !env[:box_collection].find(box_name) box_url = env[:vm].config.vm.box_url raise Errors::BoxSpecifiedDoesntExist, :name => box_name if !box_url # Add the box then reload the box collection so that it becomes # aware of it. env[:ui].info I18n.t("vagrant.actions.vm.check_box.not_found", :name => box_name) env[:box_collection].add(box_name, box_url) env[:box_collection].reload! # Reload the environment and set the VM to be the new loaded VM. env[:vm].env.reload! env[:vm] = env[:vm].env.vms[env[:vm].name] end @app.call(env) end |