Class: VagrantPlugins::Proxmox::Action::GetNodeList

Inherits:
ProxmoxAction
  • Object
show all
Defined in:
lib/vagrant-proxmox/action/get_node_list.rb

Overview

This action gets a list of all the nodes of a Proxmox server cluster and stores it under env

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ GetNodeList

Returns a new instance of GetNodeList.



9
10
11
# File 'lib/vagrant-proxmox/action/get_node_list.rb', line 9

def initialize app, env
	@app = app
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
# File 'lib/vagrant-proxmox/action/get_node_list.rb', line 13

def call env
	endpoint = env[:machine].provider_config.endpoint
	response = RestClient.get "#{endpoint}/nodes", {cookies: {PVEAuthCookie: env[:proxmox_ticket]}}
	env[:proxmox_nodes] = JSON.parse(response.to_s, symbolize_names: true)[:data]
	next_action env
end