class VagrantPlugins::ProviderLibvirt::Action::IsSuspended
This can be used with “Call” built-in to check if the machine is suspended and branch in the middleware.
Public Class Methods
new(app, env)
click to toggle source
# File lib/vagrant-libvirt/action/is_suspended.rb, line 7 def initialize(app, env) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/vagrant-libvirt/action/is_suspended.rb, line 11 def call(env) domain = env[:libvirt_compute].servers.get(env[:machine].id.to_s) raise Errors::NoDomainError if domain == nil env[:result] = domain.state.to_s == 'paused' @app.call(env) end