Class: VagrantPlugins::Rimu::Actions::Reload
- Inherits:
-
AbstractAction
- Object
- AbstractAction
- VagrantPlugins::Rimu::Actions::Reload
- Defined in:
- lib/vagrant-rimu/actions/reload.rb
Instance Method Summary collapse
- #execute(env) ⇒ Object
-
#initialize(app, env) ⇒ Reload
constructor
A new instance of Reload.
Methods inherited from AbstractAction
Constructor Details
#initialize(app, env) ⇒ Reload
Returns a new instance of Reload.
9 10 11 12 13 |
# File 'lib/vagrant-rimu/actions/reload.rb', line 9 def initialize(app, env) @app = app @machine = env[:machine] @logger = Log4r::Logger.new('vagrant::rimu::reload') end |
Instance Method Details
#execute(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vagrant-rimu/actions/reload.rb', line 15 def execute(env) client = env[:rimu_api] env[:ui].info I18n.t('vagrant_rimu.reloading') begin client.servers.reboot(@machine.id.to_i) rescue ::Rimu::RimuAPI::RimuRequestError, ::Rimu::RimuAPI::RimuResponseError => e raise Errors::ApiError, {:stderr=>e} end @app.call(env) end |