Class: VagrantPlugins::Deltacloud::Action::StopServer
- Inherits:
-
AbstractAction
- Object
- AbstractAction
- VagrantPlugins::Deltacloud::Action::StopServer
- Defined in:
- lib/vagrant-deltacloud-provider/action/stop_server.rb
Instance Method Summary collapse
- #execute(env) ⇒ Object
-
#initialize(app, _env) ⇒ StopServer
constructor
A new instance of StopServer.
Methods inherited from AbstractAction
Constructor Details
#initialize(app, _env) ⇒ StopServer
Returns a new instance of StopServer.
10 11 12 13 |
# File 'lib/vagrant-deltacloud-provider/action/stop_server.rb', line 10 def initialize(app, _env) @app = app @logger = Log4r::Logger.new('vagrant_deltacloud::action::stop_server') end |
Instance Method Details
#execute(env) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/vagrant-deltacloud-provider/action/stop_server.rb', line 15 def execute(env) env[:deltacloud_client] = Deltacloud::DeltacloudClient.instance if env[:machine].id @logger.info "Stopping server #{env[:machine].id}..." env[:ui].info(I18n.t('vagrant_deltacloud.stopping_server')) env[:deltacloud_client].stop_instance(env, env[:machine].id) end @app.call(env) end |