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.
- #read_guest_additions_version ⇒ Object
-
#version ⇒ String
Determinates the host’s version.
Methods included from VagrantVbguest::Helpers::VmCompatible
#communicate, #driver, included
Constructor Details
#initialize(vm, options = nil) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 11 def initialize(vm, =nil) @vm = vm @env = vm.env @options = end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
9 10 11 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 9 def env @env end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 9 def @options end |
#vm ⇒ Object (readonly)
Returns the value of attribute vm.
9 10 11 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 9 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
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 43 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 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
65 66 67 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 65 def cleanup @download.cleanup if @download end |
#read_guest_additions_version ⇒ Object
24 25 26 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 24 def read_guest_additions_version driver.read_guest_additions_version end |
#version ⇒ String
Determinates the host’s version
20 21 22 |
# File 'lib/vagrant-vbguest/hosts/base.rb', line 20 def version @version ||= driver.version end |