Class: VagrantPlugins::Proxmox::Action::SelectNode
- Inherits:
-
ProxmoxAction
- Object
- ProxmoxAction
- VagrantPlugins::Proxmox::Action::SelectNode
- Defined in:
- lib/vagrant-proxmox/action/select_node.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) ⇒ SelectNode
constructor
A new instance of SelectNode.
Constructor Details
#initialize(app, env) ⇒ SelectNode
Returns a new instance of SelectNode.
9 10 11 12 |
# File 'lib/vagrant-proxmox/action/select_node.rb', line 9 def initialize app, env @app = app @logger = Log4r::Logger.new 'vagrant_proxmox::action::select_node' end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/vagrant-proxmox/action/select_node.rb', line 14 def call env if env[:machine].provider_config.selected_node != Config::UNSET_VALUE if env[:proxmox_nodes].include?(env[:machine].provider_config.selected_node) env[:proxmox_selected_node] = env[:machine].provider_config.selected_node else raise Errors::InvalidNodeError, node: env[:machine].provider_config.selected_node end else env[:proxmox_selected_node] = env[:proxmox_nodes].sample end next_action env end |