Class: VagrantPlugins::ProviderLibvirt::Action::HaltDomain
- Inherits:
-
Object
- Object
- VagrantPlugins::ProviderLibvirt::Action::HaltDomain
- Defined in:
- lib/vagrant-libvirt/action/halt_domain.rb
Overview
Halt the domain.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, _env) ⇒ HaltDomain
constructor
A new instance of HaltDomain.
Constructor Details
#initialize(app, _env) ⇒ HaltDomain
Returns a new instance of HaltDomain.
10 11 12 13 |
# File 'lib/vagrant-libvirt/action/halt_domain.rb', line 10 def initialize(app, _env) @logger = Log4r::Logger.new('vagrant_libvirt::action::halt_domain') @app = app end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/vagrant-libvirt/action/halt_domain.rb', line 15 def call(env) domain = env[:machine].provider.driver.connection.servers.get(env[:machine].id.to_s) if env[:machine].state.id == :running env[:ui].info(I18n.t('vagrant_libvirt.halt_domain')) domain.poweroff end @app.call(env) end |