Class: VagrantPlugins::Parallels::Driver::Meta
- Extended by:
- Forwardable
- Defined in:
- lib/vagrant-parallels/driver/meta.rb
Defined Under Namespace
Classes: VMNotFound
Constant Summary collapse
- @@version =
We cache the Parallels Desktop 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 Parallels Desktop that is running.
Instance Method Summary collapse
-
#initialize(uuid = nil) ⇒ Meta
constructor
A new instance of Meta.
Methods inherited from Base
#clear_forwarded_ports, #clear_shared_folders, #clone_vm, #compact_hdd, #connect_network_interface, #create_host_only_network, #create_snapshot, #delete, #delete_disabled_adapters, #delete_snapshot, #delete_unused_host_only_networks, #disable_password_restrictions, #enable_adapters, #execute_prlctl, #forward_ports, #halt, #list_snapshots, #read_bridged_interfaces, #read_forwarded_ports, #read_guest_ip_dhcp, #read_guest_ip_prlctl, #read_guest_tools_iso_path, #read_guest_tools_state, #read_host_info, #read_host_only_interfaces, #read_mac_address, #read_mac_addresses, #read_network_interfaces, #read_settings, #read_shared_folders, #read_shared_interface, #read_shared_network_id, #read_state, #read_used_ports, #read_virtual_networks, #read_vm_option, #read_vms, #read_vms_info, #register, #restore_snapshot, #resume, #set_name, #set_power_consumption_mode, #share_folders, #ssh_ip, #ssh_port, #start, #suspend, #unregister, #unshare_folders, #vm_exists?
Constructor Details
#initialize(uuid = nil) ⇒ Meta
Returns a new instance of Meta.
28 29 30 31 32 33 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 |
# File 'lib/vagrant-parallels/driver/meta.rb', line 28 def initialize(uuid=nil) # Setup the base super(uuid) @logger = Log4r::Logger.new('vagrant_parallels::driver::meta') @uuid = uuid # Read and assign the version of Parallels Desktop we know which # specific driver to instantiate. @@version_lock.synchronize do @@version = read_version end # Instantiate the proper version driver for Parallels Desktop @logger.debug("Finding driver for Parallels Desktop version: #{@@version}") major_ver = @@version.split('.').first.to_i driver_klass = case major_ver when 1..10 then raise Errors::ParallelsUnsupportedVersion when 11 then PD_11 else PD_12 end # Starting since PD 11 only Pro and Business editions have CLI # functionality and can be used with Vagrant. edition = read_edition if !edition || !%w(any pro business enterprise).include?(edition) raise Errors::ParallelsUnsupportedEdition end @logger.info("Using Parallels 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
23 24 25 |
# File 'lib/vagrant-parallels/driver/meta.rb', line 23 def uuid @uuid end |
#version ⇒ Object (readonly)
The version of Parallels Desktop that is running.
26 27 28 |
# File 'lib/vagrant-parallels/driver/meta.rb', line 26 def version @version end |