vagrant-parallels 1.0.9.rc1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vagrant-parallels/action.rb +121 -122
  3. data/lib/vagrant-parallels/action/customize.rb +2 -3
  4. data/lib/vagrant-parallels/action/handle_guest_tools.rb +51 -0
  5. data/lib/vagrant-parallels/action/import.rb +1 -1
  6. data/lib/vagrant-parallels/action/is_driver_version.rb +28 -0
  7. data/lib/vagrant-parallels/action/set_power_consumption.rb +2 -6
  8. data/lib/vagrant-parallels/config.rb +6 -0
  9. data/lib/vagrant-parallels/driver/base.rb +42 -57
  10. data/lib/vagrant-parallels/driver/meta.rb +4 -5
  11. data/lib/vagrant-parallels/driver/pd_8.rb +80 -50
  12. data/lib/vagrant-parallels/driver/pd_9.rb +7 -7
  13. data/lib/vagrant-parallels/errors.rb +8 -4
  14. data/lib/vagrant-parallels/guest_cap/linux/install_parallels_tools.rb +53 -0
  15. data/lib/vagrant-parallels/plugin.rb +7 -2
  16. data/lib/vagrant-parallels/version.rb +1 -1
  17. data/locales/en.yml +34 -29
  18. data/test/unit/driver/pd_8_test.rb +3 -0
  19. data/test/unit/driver/pd_9_test.rb +3 -0
  20. data/test/unit/support/shared/pd_driver_examples.rb +33 -9
  21. metadata +5 -14
  22. data/lib/vagrant-parallels/action/check_accessible.rb +0 -23
  23. data/lib/vagrant-parallels/action/check_created.rb +0 -21
  24. data/lib/vagrant-parallels/action/check_guest_tools.rb +0 -37
  25. data/lib/vagrant-parallels/action/check_parallels.rb +0 -22
  26. data/lib/vagrant-parallels/action/check_running.rb +0 -21
  27. data/lib/vagrant-parallels/action/created.rb +0 -20
  28. data/lib/vagrant-parallels/action/is_running.rb +0 -20
  29. data/lib/vagrant-parallels/action/is_suspended.rb +0 -21
  30. data/lib/vagrant-parallels/action/message_already_running.rb +0 -16
  31. data/lib/vagrant-parallels/action/message_not_created.rb +0 -16
  32. data/lib/vagrant-parallels/action/message_not_running.rb +0 -16
  33. data/lib/vagrant-parallels/action/message_will_not_destroy.rb +0 -17
@@ -15,7 +15,7 @@ module VagrantPlugins
15
15
  unregister_template
16
16
 
17
17
  # Flag as erroneous and return if import failed
18
- raise Vagrant::Errors::VMImportFailure if !env[:machine].id
18
+ raise VagrantPlugins::Parallels::Errors::VMImportFailure if !env[:machine].id
19
19
 
20
20
  # Import completed successfully. Continue the chain
21
21
  @app.call(env)
@@ -0,0 +1,28 @@
1
+ module VagrantPlugins
2
+ module Parallels
3
+ module Action
4
+ # This middleware is meant to be used with Call and can check if
5
+ # a version of Parallels Desktop satisfies the given constraint.
6
+ class IsDriverVersion
7
+ # @param [String] requirement Can be a full requirement specification,
8
+ # like ">= 9.0.24229", or a list of them, like [">= 9","< 10.0.2"].
9
+ def initialize(app, env, requirement, **opts)
10
+ @app = app
11
+ @logger = Log4r::Logger.new("vagrant::plugins::parallels::is_driver_version")
12
+ @requirement = Gem::Requirement.new(requirement)
13
+ @invert = !!opts[:invert]
14
+ end
15
+
16
+ def call(env)
17
+ @logger.debug("Checking if 'prlctl' driver version satisfies '#{@requirement}'")
18
+ driver_version = Gem::Version.new(env[:machine].provider.driver.version)
19
+ @logger.debug("-- 'prlctl' driver version: #{driver_version}")
20
+
21
+ env[:result] = @requirement.satisfied_by?(driver_version)
22
+ env[:result] = !env[:result] if @invert
23
+ @app.call(env)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,6 +1,8 @@
1
1
  module VagrantPlugins
2
2
  module Parallels
3
3
  module Action
4
+ # Important: It works only with Parallels Desktop >= 9 !
5
+ # Use "IsDriverVersion" middleware to wrap it.
4
6
  class SetPowerConsumption
5
7
  def initialize(app, env)
6
8
  @logger = Log4r::Logger.new("vagrant::plugins::parallels::power_consumption")
@@ -8,12 +10,6 @@ module VagrantPlugins
8
10
  end
9
11
 
10
12
  def call(env)
11
- pd_version = env[:machine].provider.driver.version
12
- if Gem::Version.new(pd_version) < Gem::Version.new("9")
13
- @logger.info("Power consumption management is available only for Parallels Desktop >= 9")
14
- return @app.call(env)
15
- end
16
-
17
13
  # Optimization of power consumption is defined by "Longer Battery Life" state.
18
14
  vm_settings = env[:machine].provider.driver.read_settings
19
15
 
@@ -8,6 +8,7 @@ module VagrantPlugins
8
8
  attr_accessor :optimize_power_consumption
9
9
  attr_accessor :name
10
10
  attr_reader :network_adapters
11
+ attr_accessor :update_guest_tools
11
12
 
12
13
 
13
14
  # Compatibility with virtualbox provider's syntax
@@ -21,6 +22,7 @@ module VagrantPlugins
21
22
  @network_adapters = {}
22
23
  @name = UNSET_VALUE
23
24
  @optimize_power_consumption = UNSET_VALUE
25
+ @update_guest_tools = UNSET_VALUE
24
26
 
25
27
  network_adapter(0, :shared)
26
28
  end
@@ -70,6 +72,10 @@ module VagrantPlugins
70
72
  end
71
73
 
72
74
  @name = nil if @name == UNSET_VALUE
75
+
76
+ if @update_guest_tools == UNSET_VALUE
77
+ @update_guest_tools = false
78
+ end
73
79
  end
74
80
 
75
81
  def validate(machine)
@@ -3,7 +3,6 @@ require 'log4r'
3
3
  require 'vagrant/util/busy'
4
4
  require 'vagrant/util/network_ip'
5
5
  require 'vagrant/util/platform'
6
- require 'vagrant/util/retryable'
7
6
  require 'vagrant/util/subprocess'
8
7
 
9
8
  module VagrantPlugins
@@ -24,17 +23,11 @@ module VagrantPlugins
24
23
  # This flag is used to keep track of interrupted state (SIGINT)
25
24
  @interrupted = false
26
25
 
27
- # Set the list of required CLI utils
28
- @cli_paths = {
29
- :prlctl => "prlctl",
30
- :prlsrvctl => "prlsrvctl",
31
- :prl_disk_tool => "prl_disk_tool",
32
- :ifconfig => "ifconfig"
33
- }
26
+ @prlctl_path = "prlctl"
27
+ @prlsrvctl_path = "prlsrvctl"
34
28
 
35
- @cli_paths.each do |name, path|
36
- @logger.info("CLI utility '#{name}' path: #{path}")
37
- end
29
+ @logger.info("prlctl path: #{@prlctl_path}")
30
+ @logger.info("prlsrvctl path: #{@prlsrvctl_path}")
38
31
  end
39
32
 
40
33
  # Clears the shared folders that have been set on the virtual machine.
@@ -93,7 +86,7 @@ module VagrantPlugins
93
86
  # Raises a prlctl error if it fails.
94
87
  #
95
88
  # @param [Array] command Command to execute.
96
- def execute_command(command)
89
+ def execute_prlctl(command)
97
90
  end
98
91
 
99
92
  # Exports the virtual machine to the given path.
@@ -131,10 +124,22 @@ module VagrantPlugins
131
124
  def read_bridged_interfaces
132
125
  end
133
126
 
134
- # Returns the guest tools version that is installed on this VM.
127
+ # Returns the state of guest tools that is installed on this VM.
128
+ # Can be any of:
129
+ # * "installed"
130
+ # * "not_installed"
131
+ # * "possibly_installed"
132
+ # * "outdated"
135
133
  #
136
134
  # @return [String]
137
- def read_guest_tools_version
135
+ def read_guest_tools_state
136
+ end
137
+
138
+ # Returns path to the Parallels Tools ISO file.
139
+ #
140
+ # @param [String] guest_os Guest os type: "linux", "darwin" or "windows"
141
+ # @return [String] Path to the ISO.
142
+ def read_guest_tools_iso_path(guest_os)
138
143
  end
139
144
 
140
145
  # Returns a list of available host only interfaces.
@@ -244,50 +249,35 @@ module VagrantPlugins
244
249
  def unshare_folders(names)
245
250
  end
246
251
 
247
- # Verifies that the driver is ready to accept work.
248
- #
249
- # This should raise a VagrantError if things are not ready.
250
- def verify!
251
- end
252
-
253
252
  # Checks if a VM with the given UUID exists.
254
253
  #
255
254
  # @return [Boolean]
256
255
  def vm_exists?(uuid)
257
256
  end
258
257
 
259
- # Execute the given subcommand for PrlCtl and return the output.
260
- def execute(*command, &block)
261
- # Get the options hash if it exists
262
- opts = {}
263
- opts = command.pop if command.last.is_a?(Hash)
264
-
265
- tries = opts[:retryable] ? 3 : 0
266
-
267
- # Variable to store our execution result
268
- r = nil
269
-
270
- retryable(:on => VagrantPlugins::Parallels::Errors::PrlCtlError, :tries => tries, :sleep => 1) do
271
- # If there is an error with PrlCtl, this gets set to true
272
- errored = false
273
-
274
- # Execute the command
275
- r = raw(*command, &block)
276
-
277
- # If the command was a failure, then raise an exception that is
278
- # nicely handled by Vagrant.
279
- if r.exit_code != 0
280
- if @interrupted
281
- @logger.info("Exit code != 0, but interrupted. Ignoring.")
282
- else
283
- errored = true
284
- end
285
- end
258
+ # Wraps 'execute' and returns the output of given 'prlctl' subcommand.
259
+ def execute_prlctl(*command, &block)
260
+ execute(@prlctl_path, *command, &block)
261
+ end
286
262
 
287
- # If there was an error running prlctl, show the error and the
288
- # output.
289
- if errored
290
- raise VagrantPlugins::Parallels::Errors::PrlCtlError,
263
+ #Wraps 'execute' and returns the output of given 'prlsrvctl' subcommand.
264
+ def execute_prlsrvctl(*command, &block)
265
+ execute(@prlsrvctl_path, *command, &block)
266
+ end
267
+
268
+ # Execute the given command and return the output.
269
+ def execute(*command, &block)
270
+ r = raw(*command, &block)
271
+
272
+ # If the command was a failure, then raise an exception that is
273
+ # nicely handled by Vagrant.
274
+ if r.exit_code != 0
275
+ if @interrupted
276
+ @logger.info("Exit code != 0, but interrupted. Ignoring.")
277
+ else
278
+ # If there was an error running command, show the error and the
279
+ # output.
280
+ raise VagrantPlugins::Parallels::Errors::ExecutionError,
291
281
  :command => command.inspect,
292
282
  :stderr => r.stderr
293
283
  end
@@ -308,13 +298,8 @@ module VagrantPlugins
308
298
  # Append in the options for subprocess
309
299
  command << { :notify => [:stdout, :stderr] }
310
300
 
311
- # Get the utility from the first argument:
312
- # 'prlctl' by default
313
- util = @cli_paths.has_key?(command.first) ? command.delete_at(0) : :prlctl
314
- cli = @cli_paths[util]
315
-
316
301
  Vagrant::Util::Busy.busy(int_callback) do
317
- Vagrant::Util::Subprocess.execute(cli, *command, &block)
302
+ Vagrant::Util::Subprocess.execute(*command, &block)
318
303
  end
319
304
  end
320
305
  end
@@ -84,14 +84,14 @@ module VagrantPlugins
84
84
  :delete_disabled_adapters,
85
85
  :delete_unused_host_only_networks,
86
86
  :enable_adapters,
87
- :execute_command,
87
+ :execute_prlctl,
88
88
  :export,
89
89
  :halt,
90
90
  :import,
91
91
  :read_bridged_interfaces,
92
- :read_guest_tools_version,
92
+ :read_guest_tools_state,
93
+ :read_guest_tools_iso_path,
93
94
  :read_guest_ip,
94
- :read_guest_property,
95
95
  :read_host_only_interfaces,
96
96
  :read_mac_address,
97
97
  :read_mac_addresses,
@@ -116,7 +116,6 @@ module VagrantPlugins
116
116
  :start,
117
117
  :suspend,
118
118
  :unregister,
119
- :verify!,
120
119
  :vm_exists?
121
120
 
122
121
  protected
@@ -133,7 +132,7 @@ module VagrantPlugins
133
132
  #
134
133
  # But we need exactly the first 3 numbers: "x.x.x"
135
134
 
136
- if execute('--version', retryable: true) =~ /prlctl version (\d+\.\d+.\d+)/
135
+ if execute('prlctl', '--version') =~ /prlctl version (\d+\.\d+.\d+)/
137
136
  return $1
138
137
  else
139
138
  return nil
@@ -18,9 +18,11 @@ module VagrantPlugins
18
18
 
19
19
 
20
20
  def compact(uuid)
21
- used_drives = read_settings.fetch('Hardware', {}).select { |name, _| name.start_with? 'hdd' }
21
+ used_drives = read_settings.fetch('Hardware', {}).select do |name, _|
22
+ name.start_with? 'hdd'
23
+ end
22
24
  used_drives.each_value do |drive_params|
23
- execute(:prl_disk_tool, 'compact', '--hdd', drive_params["image"]) do |type, data|
25
+ execute('prl_disk_tool', 'compact', '--hdd', drive_params['image']) do |type, data|
24
26
  lines = data.split("\r")
25
27
  # The progress of the compact will be in the last line. Do a greedy
26
28
  # regular expression to find what we're looking for.
@@ -34,13 +36,13 @@ module VagrantPlugins
34
36
  def clear_shared_folders
35
37
  share_ids = read_shared_folders.keys
36
38
  share_ids.each do |id|
37
- execute("set", @uuid, "--shf-host-del", id)
39
+ execute_prlctl('set', @uuid, '--shf-host-del', id)
38
40
  end
39
41
  end
40
42
 
41
43
  def create_host_only_network(options)
42
44
  # Create the interface
43
- execute(:prlsrvctl, "net", "add", options[:network_id], "--type", "host-only")
45
+ execute_prlsrvctl('net', 'add', options[:network_id], '--type', 'host-only')
44
46
 
45
47
  # Configure it
46
48
  args = ["--ip", "#{options[:adapter_ip]}/#{options[:netmask]}"]
@@ -50,10 +52,10 @@ module VagrantPlugins
50
52
  "--ip-scope-end", options[:dhcp][:upper]])
51
53
  end
52
54
 
53
- execute(:prlsrvctl, "net", "set", options[:network_id], *args)
55
+ execute_prlsrvctl('net', 'set', options[:network_id], *args)
54
56
 
55
57
  # Determine interface to which it has been bound
56
- net_info = json { execute(:prlsrvctl, 'net', 'info', options[:network_id], '--json', retryable: true) }
58
+ net_info = json { execute_prlsrvctl('net', 'info', options[:network_id], '--json') }
57
59
  iface_name = net_info['Bound To']
58
60
 
59
61
  # Return the details
@@ -66,13 +68,13 @@ module VagrantPlugins
66
68
  end
67
69
 
68
70
  def delete
69
- execute('delete', @uuid)
71
+ execute_prlctl('delete', @uuid)
70
72
  end
71
73
 
72
74
  def delete_disabled_adapters
73
75
  read_settings.fetch('Hardware', {}).each do |adapter, params|
74
- if adapter.start_with?('net') and !params.fetch("enabled", true)
75
- execute('set', @uuid, '--device-del', adapter)
76
+ if adapter.start_with?('net') and !params.fetch('enabled', true)
77
+ execute_prlctl('set', @uuid, '--device-del', adapter)
76
78
  end
77
79
  end
78
80
  end
@@ -97,19 +99,21 @@ module VagrantPlugins
97
99
 
98
100
  networks.each do |net|
99
101
  # Delete the actual host only network interface.
100
- execute(:prlsrvctl, "net", "del", net["Network ID"])
102
+ execute_prlsrvctl('net', 'del', net['Network ID'])
101
103
  end
102
104
  end
103
105
 
104
106
  def enable_adapters(adapters)
105
107
  # Get adapters which have already configured for this VM
106
108
  # Such adapters will be just overridden
107
- existing_adapters = read_settings.fetch('Hardware', {}).keys.select { |name| name.start_with? 'net' }
109
+ existing_adapters = read_settings.fetch('Hardware', {}).keys.select do |name|
110
+ name.start_with? 'net'
111
+ end
108
112
 
109
113
  # Disable all previously existing adapters (except shared 'vnet0')
110
114
  existing_adapters.each do |adapter|
111
115
  if adapter != 'vnet0'
112
- execute('set', @uuid, '--device-set', adapter, '--disable')
116
+ execute_prlctl('set', @uuid, '--device-set', adapter, '--disable')
113
117
  end
114
118
  end
115
119
 
@@ -141,16 +145,15 @@ module VagrantPlugins
141
145
  args.concat(["--adapter-type", adapter[:nic_type].to_s])
142
146
  end
143
147
 
144
- execute("set", @uuid, *args)
148
+ execute_prlctl("set", @uuid, *args)
145
149
  end
146
150
  end
147
151
 
148
- def execute_command(command)
149
- execute(*command)
150
- end
151
-
152
152
  def export(path, tpl_name)
153
- execute("clone", @uuid, "--name", tpl_name, "--template", "--dst", path.to_s) do |type, data|
153
+ execute_prlctl('clone', @uuid,
154
+ '--name', tpl_name,
155
+ '--template',
156
+ '--dst', path.to_s) do |type, data|
154
157
  lines = data.split("\r")
155
158
  # The progress of the export will be in the last line. Do a greedy
156
159
  # regular expression to find what we're looking for.
@@ -162,7 +165,7 @@ module VagrantPlugins
162
165
  end
163
166
 
164
167
  def halt(force=false)
165
- args = ['stop', @uuid]
168
+ args = ['prlctl', 'stop', @uuid]
166
169
  args << '--kill' if force
167
170
  execute(*args)
168
171
  end
@@ -171,7 +174,7 @@ module VagrantPlugins
171
174
  template_name = read_vms.key(template_uuid)
172
175
  vm_name = "#{template_name}_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
173
176
 
174
- execute("clone", template_uuid, '--name', vm_name) do |type, data|
177
+ execute_prlctl('clone', template_uuid, '--name', vm_name) do |type, data|
175
178
  lines = data.split("\r")
176
179
  # The progress of the import will be in the last line. Do a greedy
177
180
  # regular expression to find what we're looking for.
@@ -192,7 +195,7 @@ module VagrantPlugins
192
195
  bridged_ifaces = []
193
196
  net_list.keys.each do |iface|
194
197
  info = {}
195
- ifconfig = execute(:ifconfig, iface)
198
+ ifconfig = execute('ifconfig', iface)
196
199
  # Assign default values
197
200
  info[:name] = iface
198
201
  info[:ip] = "0.0.0.0"
@@ -234,13 +237,35 @@ module VagrantPlugins
234
237
  nil
235
238
  end
236
239
 
237
- def read_guest_tools_version
238
- tools_version = read_settings.fetch('GuestTools', {}).fetch('version', '')
239
- tools_version[/(^\d+\.\d+.\d+)/]
240
+ def read_guest_tools_iso_path(guest_os)
241
+ guest_os = guest_os.to_sym
242
+ iso_name ={
243
+ :linux => "prl-tools-lin.iso",
244
+ :darwin => "prl-tools-mac.iso",
245
+ :windows => "prl-tools-win.iso"
246
+ }
247
+ return nil if !iso_name[guest_os]
248
+
249
+ bundle_id = 'com.parallels.desktop.console'
250
+ bundle_path = execute('mdfind', "kMDItemCFBundleIdentifier == #{bundle_id}")
251
+ iso_path = File.expand_path("./Contents/Resources/Tools/#{iso_name[guest_os]}",
252
+ bundle_path.split("\n")[0])
253
+
254
+ if !File.exist?(iso_path)
255
+ raise Errors::ParallelsToolsIsoNotFound, :iso_path => iso_path
256
+ end
257
+
258
+ iso_path
259
+ end
260
+
261
+ def read_guest_tools_state
262
+ state = read_settings.fetch('GuestTools', {}).fetch('state', nil)
263
+ state = "not_installed" if !state
264
+ state.to_sym
240
265
  end
241
266
 
242
267
  def read_host_info
243
- json { execute('server', 'info', '--json', retryable: true) }
268
+ json { execute_prlctl('server', 'info', '--json') }
244
269
  end
245
270
 
246
271
  def read_host_only_interfaces
@@ -250,7 +275,7 @@ module VagrantPlugins
250
275
  hostonly_ifaces = []
251
276
  net_list.each do |iface|
252
277
  info = {}
253
- net_info = json { execute(:prlsrvctl, 'net', 'info', iface['Network ID'], '--json') }
278
+ net_info = json { execute_prlsrvctl('net', 'info', iface['Network ID'], '--json') }
254
279
  # Really we need to work with bounded virtual interface
255
280
  info[:name] = net_info['Bound To']
256
281
  info[:ip] = net_info['Parallels adapter']['IP address']
@@ -261,7 +286,8 @@ module VagrantPlugins
261
286
  # There may be a fake DHCPv4 parameters
262
287
  # We can trust them only if adapter IP and DHCP IP are in the same subnet
263
288
  dhcp_ip = net_info['DHCPv4 server']['Server address']
264
- if network_address(info[:ip], info[:netmask]) == network_address(dhcp_ip, info[:netmask])
289
+ if network_address(info[:ip], info[:netmask]) ==
290
+ network_address(dhcp_ip, info[:netmask])
265
291
  info[:dhcp] = {
266
292
  :ip => dhcp_ip,
267
293
  :lower => net_info['DHCPv4 server']['IP scope start address'],
@@ -319,7 +345,7 @@ module VagrantPlugins
319
345
  end
320
346
 
321
347
  def read_settings
322
- vm = json { execute('list', @uuid, '--info', '--json', retryable: true).gsub(/^INFO/, '') }
348
+ vm = json { execute_prlctl('list', @uuid, '--info', '--json').gsub(/^INFO/, '') }
323
349
  vm.last
324
350
  end
325
351
 
@@ -328,7 +354,9 @@ module VagrantPlugins
328
354
  shared_net = read_virtual_networks.detect { |net| net['Type'] == 'shared' }
329
355
  return nil if !shared_net
330
356
 
331
- net_info = json { execute(:prlsrvctl, 'net', 'info', shared_net['Network ID'], '--json') }
357
+ net_info = json do
358
+ execute_prlsrvctl('net', 'info', shared_net['Network ID'], '--json')
359
+ end
332
360
  info = {
333
361
  name: net_info['Bound To'],
334
362
  ip: net_info['Parallels adapter']['IP address'],
@@ -358,22 +386,22 @@ module VagrantPlugins
358
386
  end
359
387
 
360
388
  def read_state
361
- vm = json { execute('list', @uuid, '--json', retryable: true).gsub(/^INFO/, '') }
389
+ vm = json { execute_prlctl('list', @uuid, '--json').gsub(/^INFO/, '') }
362
390
  return nil if !vm.last
363
391
  vm.last.fetch('status').to_sym
364
392
  end
365
393
 
366
394
  def read_virtual_networks
367
- json { execute(:prlsrvctl, 'net', 'list', '--json', retryable: true) }
395
+ json { execute_prlsrvctl('net', 'list', '--json') }
368
396
  end
369
397
 
370
398
  def read_vms
371
399
  results = {}
372
400
  vms_arr = json([]) do
373
- execute('list', '--all', '--json', retryable: true).gsub(/^INFO/, '')
401
+ execute_prlctl('list', '--all', '--json').gsub(/^INFO/, '')
374
402
  end
375
403
  templates_arr = json([]) do
376
- execute('list', '--all', '--json', '--template', retryable: true).gsub(/^INFO/, '')
404
+ execute_prlctl('list', '--all', '--json', '--template').gsub(/^INFO/, '')
377
405
  end
378
406
  vms = vms_arr | templates_arr
379
407
  vms.each do |item|
@@ -383,13 +411,14 @@ module VagrantPlugins
383
411
  results
384
412
  end
385
413
 
386
- # Parse the JSON from *all* VMs and templates. Then return an array of objects (without duplicates)
414
+ # Parse the JSON from *all* VMs and templates.
415
+ # Then return an array of objects (without duplicates)
387
416
  def read_vms_info
388
417
  vms_arr = json([]) do
389
- execute('list', '--all','--info', '--json', retryable: true).gsub(/^INFO/, '')
418
+ execute_prlctl('list', '--all','--info', '--json').gsub(/^INFO/, '')
390
419
  end
391
420
  templates_arr = json([]) do
392
- execute('list', '--all','--info', '--json', '--template', retryable: true).gsub(/^INFO/, '')
421
+ execute_prlctl('list', '--all','--info', '--json', '--template').gsub(/^INFO/, '')
393
422
  end
394
423
  vms_arr | templates_arr
395
424
  end
@@ -406,7 +435,7 @@ module VagrantPlugins
406
435
  end
407
436
 
408
437
  def register(pvm_file, regen_src_uuid=false)
409
- args = ['register', pvm_file]
438
+ args = ['prlctl', 'register', pvm_file]
410
439
  args << '--regenerate-src-uuid' if regen_src_uuid
411
440
  execute(*args)
412
441
  end
@@ -416,21 +445,26 @@ module VagrantPlugins
416
445
  end
417
446
 
418
447
  def resume
419
- execute('resume', @uuid)
448
+ execute_prlctl('resume', @uuid)
420
449
  end
421
450
 
422
451
  def set_mac_address(mac)
423
- execute('set', @uuid, '--device-set', 'net0', '--type', 'shared', '--mac', mac)
452
+ execute_prlctl('set', @uuid,
453
+ '--device-set', 'net0',
454
+ '--type', 'shared',
455
+ '--mac', mac)
424
456
  end
425
457
 
426
458
  def set_name(name)
427
- execute('set', @uuid, '--name', name, :retryable => true)
459
+ execute_prlctl('set', @uuid, '--name', name)
428
460
  end
429
461
 
430
462
  def share_folders(folders)
431
463
  folders.each do |folder|
432
464
  # Add the shared folder
433
- execute('set', @uuid, '--shf-host-add', folder[:name], '--path', folder[:hostpath])
465
+ execute_prlctl('set', @uuid,
466
+ '--shf-host-add', folder[:name],
467
+ '--path', folder[:hostpath])
434
468
  end
435
469
  end
436
470
 
@@ -439,29 +473,25 @@ module VagrantPlugins
439
473
  end
440
474
 
441
475
  def start
442
- execute('start', @uuid)
476
+ execute_prlctl('start', @uuid)
443
477
  end
444
478
 
445
479
  def suspend
446
- execute('suspend', @uuid)
480
+ execute_prlctl('suspend', @uuid)
447
481
  end
448
482
 
449
483
  def unregister(uuid)
450
- execute("unregister", uuid)
484
+ execute_prlctl('unregister', uuid)
451
485
  end
452
486
 
453
487
  def unshare_folders(names)
454
488
  names.each do |name|
455
- execute("set", @uuid, "--shf-host-del", name)
489
+ execute_prlctl('set', @uuid, '--shf-host-del', name)
456
490
  end
457
491
  end
458
492
 
459
- def verify!
460
- execute('--version', retryable: true)
461
- end
462
-
463
493
  def vm_exists?(uuid)
464
- raw("list", uuid).exit_code == 0
494
+ raw('prlctl', 'list', uuid).exit_code == 0
465
495
  end
466
496
  end
467
497
  end