Class: VagrantPlugins::AVF::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::AVF::Config
- Defined in:
- lib/vagrant_provider_avf/config.rb
Instance Attribute Summary collapse
-
#cpus ⇒ Object
Returns the value of attribute cpus.
-
#disk_gb ⇒ Object
Returns the value of attribute disk_gb.
-
#disk_image_path ⇒ Object
Returns the value of attribute disk_image_path.
-
#guest ⇒ Object
Returns the value of attribute guest.
-
#headless ⇒ Object
Returns the value of attribute headless.
-
#initrd_path ⇒ Object
Returns the value of attribute initrd_path.
-
#kernel_path ⇒ Object
Returns the value of attribute kernel_path.
-
#memory_mb ⇒ Object
Returns the value of attribute memory_mb.
Instance Method Summary collapse
- #boot_config ⇒ Object
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #machine_requirements ⇒ Object
- #validate(_machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/vagrant_provider_avf/config.rb', line 6 def initialize @cpus = UNSET_VALUE @memory_mb = UNSET_VALUE @disk_gb = UNSET_VALUE @headless = UNSET_VALUE @guest = UNSET_VALUE @kernel_path = UNSET_VALUE @initrd_path = UNSET_VALUE @disk_image_path = UNSET_VALUE end |
Instance Attribute Details
#cpus ⇒ Object
Returns the value of attribute cpus.
4 5 6 |
# File 'lib/vagrant_provider_avf/config.rb', line 4 def cpus @cpus end |
#disk_gb ⇒ Object
Returns the value of attribute disk_gb.
4 5 6 |
# File 'lib/vagrant_provider_avf/config.rb', line 4 def disk_gb @disk_gb end |
#disk_image_path ⇒ Object
Returns the value of attribute disk_image_path.
4 5 6 |
# File 'lib/vagrant_provider_avf/config.rb', line 4 def disk_image_path @disk_image_path end |
#guest ⇒ Object
Returns the value of attribute guest.
4 5 6 |
# File 'lib/vagrant_provider_avf/config.rb', line 4 def guest @guest end |
#headless ⇒ Object
Returns the value of attribute headless.
4 5 6 |
# File 'lib/vagrant_provider_avf/config.rb', line 4 def headless @headless end |
#initrd_path ⇒ Object
Returns the value of attribute initrd_path.
4 5 6 |
# File 'lib/vagrant_provider_avf/config.rb', line 4 def initrd_path @initrd_path end |
#kernel_path ⇒ Object
Returns the value of attribute kernel_path.
4 5 6 |
# File 'lib/vagrant_provider_avf/config.rb', line 4 def kernel_path @kernel_path end |
#memory_mb ⇒ Object
Returns the value of attribute memory_mb.
4 5 6 |
# File 'lib/vagrant_provider_avf/config.rb', line 4 def memory_mb @memory_mb end |
Instance Method Details
#boot_config ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/vagrant_provider_avf/config.rb', line 45 def boot_config Model::BootConfig.new( guest: @guest, kernel_path: @kernel_path, initrd_path: @initrd_path, disk_image_path: @disk_image_path ) end |
#finalize! ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vagrant_provider_avf/config.rb', line 17 def finalize! @cpus = nil if @cpus == UNSET_VALUE @memory_mb = nil if @memory_mb == UNSET_VALUE @disk_gb = nil if @disk_gb == UNSET_VALUE @headless = true if @headless == UNSET_VALUE @guest = :linux if @guest == UNSET_VALUE @kernel_path = nil if @kernel_path == UNSET_VALUE @initrd_path = nil if @initrd_path == UNSET_VALUE @disk_image_path = nil if @disk_image_path == UNSET_VALUE end |
#machine_requirements ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/vagrant_provider_avf/config.rb', line 36 def machine_requirements Model::MachineRequirements.new( cpus: @cpus, memory_mb: @memory_mb, disk_gb: @disk_gb, headless: @headless ) end |
#validate(_machine) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/vagrant_provider_avf/config.rb', line 28 def validate(_machine) errors = _detected_errors + machine_requirements.errors + boot_config.errors return {} if errors.empty? { "AVF provider" => errors } end |