Class: VagrantPlugins::ProviderVeertu::Driver::Meta
- Extended by:
- Forwardable
- Includes:
- Vagrant::Util::Retryable
- Defined in:
- lib/vagrant-veertu/driver/meta.rb
Defined Under Namespace
Classes: VMNotFound
Constant Summary collapse
- @@version =
We cache the read Veertu version here once we have one, since during the execution of Vagrant, it likely doesn’t change.
nil
- @@version_lock =
Mutex.new
Instance Attribute Summary collapse
-
#uuid ⇒ Object
readonly
The UUID of the virtual machine we represent.
-
#version ⇒ Object
readonly
The version of veertu that is running.
Instance Method Summary collapse
-
#initialize(uuid = nil) ⇒ Meta
constructor
A new instance of Meta.
Methods inherited from Base
#clear_forwarded_ports, #delete, #execute, #execute_command, #export, #forward_ports, #halt, #import, #max_network_adapters, #raw, #read_forwarded_ports, #read_state, #read_used_ports, #read_vms, #share_folders, #ssh_port, #start, #suspend, #verify!, #vm_exists?
Constructor Details
#initialize(uuid = nil) ⇒ Meta
Returns a new instance of Meta.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/vagrant-veertu/driver/meta.rb', line 34 def initialize(uuid=nil) # Setup the base super() @logger = Log4r::Logger.new("vagrant::provider::veertu::meta") @uuid = uuid @@version_lock.synchronize do if !@@version # Read and assign the version of Veertu we know which # specific driver to instantiate. begin @@version = read_version rescue Vagrant::Errors::CommandUnavailable, Vagrant::Errors::CommandUnavailableWindows # This means that Veertu was not found, so we raise this # error here. raise Vagrant::Errors::VeertuNotDetected end end end # Instantiate the proper version driver for Veertu @logger.debug("Finding driver for Veertu version: #{@@version}") driver_map = { "5.0" => Version_5_0, } driver_klass = nil driver_map.each do |key, klass| if @@version.start_with?(key) driver_klass = klass break end end if !driver_klass supported_versions = driver_map.keys.sort.join(", ") raise Vagrant::Errors::VeertuInvalidVersion, supported_versions: supported_versions end @logger.info("Using Veertu driver: #{driver_klass}") @driver = driver_klass.new(@uuid) @version = @@version if @uuid # Verify the VM exists, and if it doesn't, then don't worry # about it (mark the UUID as nil) raise VMNotFound if !@driver.vm_exists?(@uuid) end end |
Instance Attribute Details
#uuid ⇒ Object (readonly)
The UUID of the virtual machine we represent
27 28 29 |
# File 'lib/vagrant-veertu/driver/meta.rb', line 27 def uuid @uuid end |
#version ⇒ Object (readonly)
The version of veertu that is running.
30 31 32 |
# File 'lib/vagrant-veertu/driver/meta.rb', line 30 def version @version end |