Class: VagrantVbguest::Hosts::Base
- Inherits:
-
Object
- Object
- VagrantVbguest::Hosts::Base
- Includes:
- VagrantVbguest::Helpers::VmCompatible
- Defined in:
- lib/vagrant-vbguest/hosts/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#vm ⇒ Object
readonly
Returns the value of attribute vm.
Instance Method Summary collapse
-
#additions_file ⇒ String
Additions-file-detection-magig.
-
#cleanup ⇒ Object
If needed, remove downloaded temp file.
-
#initialize(vm, options = nil) ⇒ Base
constructor
A new instance of Base.
-
#version ⇒ String
Determinates the host’s version.
Methods included from VagrantVbguest::Helpers::VmCompatible
Constructor Details
#initialize(vm, options = nil) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 8 def initialize(vm, =nil) @vm = vm @env = vm.env @options = end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
6 7 8 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 6 def env @env end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 6 def @options end |
#vm ⇒ Object (readonly)
Returns the value of attribute vm.
6 7 8 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 6 def vm @vm end |
Instance Method Details
#additions_file ⇒ String
Additions-file-detection-magig.
Detection runs in those stages:
-
Uses the
iso_path
config option, if present and not set to:auto
-
Look out for a local additions file
-
Use the default web URI
If the detected or configured path is not a local file and remote downloads are allowed (the config option :no_remote
is NOT set) it will try to download that file into a temp file using Vagrants Downloaders. If remote downloads are prohibited (the config option :no_remote
IS set) a VagrantVbguest::IsoPathAutodetectionError
will be thrown
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 37 def additions_file return @additions_file if @additions_file path = [:iso_path] if !path || path.empty? || path == :auto path = local_path path = web_path if ![:no_remote] && !path end raise VagrantVbguest::IsoPathAutodetectionError if !path || path.empty? path = versionize(path) if Vagrant::Downloaders::File.match? path @additions_file = path else # :TODO: This will also raise, if the iso_url points to an invalid local path raise VagrantVbguest::DownloadingDisabledError.new(:from => path) if [:no_remote] @additions_file = download path end end |
#cleanup ⇒ Object
If needed, remove downloaded temp file
59 60 61 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 59 def cleanup @download.cleanup if @download end |
#version ⇒ String
Determinates the host’s version
17 18 19 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 17 def version @version ||= driver.version end |