Class: VagrantPlugins::Proxmox::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Proxmox::Config
- Defined in:
- lib/vagrant-proxmox/config.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ String
The Proxmox REST API endpoint.
-
#os_template ⇒ String
The openvz os template to use for the virtual machines.
-
#password ⇒ String
The Proxmox password.
-
#task_status_check_interval ⇒ Integer, Proc
The interval between two proxmox task status retrievals (in seconds).
-
#task_timeout ⇒ Integer
The maximum timeout for a proxmox server task (in seconds).
-
#user_name ⇒ String
The Proxmox user name.
-
#vm_id_range ⇒ Range
The id range to use for the virtual machines.
-
#vm_memory ⇒ Integer
Amount of RAM for the virtual machine in MB.
-
#vm_name_prefix ⇒ String
The prefix for the virtual machine name.
Instance Method Summary collapse
-
#finalize! ⇒ Object
This is the hook that is called to finalize the object before it is put into use.
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
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
#endpoint ⇒ String
The Proxmox REST API endpoint
8 9 10 |
# File 'lib/vagrant-proxmox/config.rb', line 8 def endpoint @endpoint end |
#os_template ⇒ String
The openvz os template to use for the virtual machines
23 24 25 |
# File 'lib/vagrant-proxmox/config.rb', line 23 def os_template @os_template end |
#password ⇒ String
The Proxmox password
18 19 20 |
# File 'lib/vagrant-proxmox/config.rb', line 18 def password @password end |
#task_status_check_interval ⇒ Integer, Proc
The interval between two proxmox task status retrievals (in seconds)
48 49 50 |
# File 'lib/vagrant-proxmox/config.rb', line 48 def task_status_check_interval @task_status_check_interval end |
#task_timeout ⇒ Integer
The maximum timeout for a proxmox server task (in seconds)
43 44 45 |
# File 'lib/vagrant-proxmox/config.rb', line 43 def task_timeout @task_timeout end |
#user_name ⇒ String
The Proxmox user name
13 14 15 |
# File 'lib/vagrant-proxmox/config.rb', line 13 def user_name @user_name end |
#vm_id_range ⇒ Range
The id range to use for the virtual machines
28 29 30 |
# File 'lib/vagrant-proxmox/config.rb', line 28 def vm_id_range @vm_id_range end |
#vm_memory ⇒ Integer
Amount of RAM for the virtual machine in MB
38 39 40 |
# File 'lib/vagrant-proxmox/config.rb', line 38 def vm_memory @vm_memory end |
#vm_name_prefix ⇒ String
The prefix for the virtual machine name
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 |