Class: VagrantPlugins::Proxmox::Action::ReadState
- Inherits:
-
ProxmoxAction
- Object
- ProxmoxAction
- VagrantPlugins::Proxmox::Action::ReadState
- Defined in:
- lib/vagrant-proxmox/action/read_state.rb
Overview
This action reads the state of a Proxmox virtual machine and stores it in env.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ ReadState
constructor
A new instance of ReadState.
Constructor Details
#initialize(app, env) ⇒ ReadState
Returns a new instance of ReadState.
9 10 11 12 |
# File 'lib/vagrant-proxmox/action/read_state.rb', line 9 def initialize app, env @app = app @logger = Log4r::Logger.new 'vagrant_proxmox::action::read_state' end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vagrant-proxmox/action/read_state.rb', line 14 def call env begin env[:machine_state_id] = if env[:machine].id node, vm_id = env[:machine].id.split '/' env[:proxmox_connection].get_vm_state vm_id else :not_created end next_action env rescue => e raise Errors::CommunicationError, error_msg: e. end end |