Class: VagrantPlugins::Proxmox::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-proxmox/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/vagrant-proxmox/config.rb', line 50

def initialize
	@endpoint = UNSET_VALUE
	@user_name = UNSET_VALUE
	@password = UNSET_VALUE
	@os_template = UNSET_VALUE
	@vm_id_range = 900..999
	@vm_name_prefix = 'vagrant_'
	@vm_memory = 512
	@task_timeout = 60
	@task_status_check_interval = 2
end

Instance Attribute Details

#endpointString

The Proxmox REST API endpoint

Returns:

  • (String)


8
9
10
# File 'lib/vagrant-proxmox/config.rb', line 8

def endpoint
  @endpoint
end

#os_templateString

The openvz os template to use for the virtual machines

Returns:

  • (String)


23
24
25
# File 'lib/vagrant-proxmox/config.rb', line 23

def os_template
  @os_template
end

#passwordString

The Proxmox password

Returns:

  • (String)


18
19
20
# File 'lib/vagrant-proxmox/config.rb', line 18

def password
  @password
end

#task_status_check_intervalInteger, Proc

The interval between two proxmox task status retrievals (in seconds)

Returns:

  • (Integer, Proc)


48
49
50
# File 'lib/vagrant-proxmox/config.rb', line 48

def task_status_check_interval
  @task_status_check_interval
end

#task_timeoutInteger

The maximum timeout for a proxmox server task (in seconds)

Returns:

  • (Integer)


43
44
45
# File 'lib/vagrant-proxmox/config.rb', line 43

def task_timeout
  @task_timeout
end

#user_nameString

The Proxmox user name

Returns:

  • (String)


13
14
15
# File 'lib/vagrant-proxmox/config.rb', line 13

def user_name
  @user_name
end

#vm_id_rangeRange

The id range to use for the virtual machines

Returns:

  • (Range)


28
29
30
# File 'lib/vagrant-proxmox/config.rb', line 28

def vm_id_range
  @vm_id_range
end

#vm_memoryInteger

Amount of RAM for the virtual machine in MB

Returns:

  • (Integer)


38
39
40
# File 'lib/vagrant-proxmox/config.rb', line 38

def vm_memory
  @vm_memory
end

#vm_name_prefixString

The prefix for the virtual machine name

Returns:

  • (String)


33
34
35
# File 'lib/vagrant-proxmox/config.rb', line 33

def vm_name_prefix
  @vm_name_prefix
end

Instance Method Details

#finalize!Object

This is the hook that is called to finalize the object before it is put into use.



63
64
65
66
67
68
# File 'lib/vagrant-proxmox/config.rb', line 63

def finalize!
	@endpoint = nil if @endpoint == UNSET_VALUE
	@user_name = nil if @user_name == UNSET_VALUE
	@password = nil if @password == UNSET_VALUE
	@os_template = nil if @os_template == UNSET_VALUE
end

#validate(machine) ⇒ Object



70
71
72
73
74
75
76
77
# File 'lib/vagrant-proxmox/config.rb', line 70

def validate machine
	errors = []
	errors << I18n.t('vagrant_proxmox.errors.no_endpoint_specified') unless @endpoint
	errors << I18n.t('vagrant_proxmox.errors.no_user_name_specified') unless @user_name
	errors << I18n.t('vagrant_proxmox.errors.no_password_specified') unless @password
	errors << I18n.t('vagrant_proxmox.errors.no_os_template_specified') unless @os_template
	{'Proxmox Provider' => errors}
end