vagrant-parallels 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -114,6 +114,13 @@ module VagrantPlugins
114
114
  @logger.info("Regenerate SourceVmUuid")
115
115
  @machine.provider.driver.regenerate_src_uuid
116
116
  end
117
+
118
+ # Remove 'Icon\r' file from VM home (bug in PD 11.0.0)
119
+ if @machine.provider.pd_version_satisfies?('= 11.0.0')
120
+ vm_home = @machine.provider.driver.read_settings.fetch('Home')
121
+ broken_icns = Dir[File.join(vm_home, 'Icon*')]
122
+ FileUtils.rm(broken_icns, :force => true)
123
+ end
117
124
  end
118
125
 
119
126
  def snapshot_id(tpl_name)
@@ -33,26 +33,23 @@ module VagrantPlugins
33
33
 
34
34
  # Instantiate the proper version driver for Parallels Desktop
35
35
  @logger.debug("Finding driver for Parallels Desktop version: #{@version}")
36
- driver_map = {
37
- '8' => PD_8,
38
- '9' => PD_9,
39
- '10' => PD_10,
40
- '11' => PD_11
41
- }
42
-
43
- driver_klass = nil
44
- driver_map.each do |key, klass|
45
- if @version.start_with?(key)
46
- driver_klass = klass
47
- break
48
- end
49
- end
50
36
 
51
- if !driver_klass
52
- supported_versions = driver_map.keys.sort
37
+ driver_klass =
38
+ case @version.split('.').first
39
+ when '8' then PD_8
40
+ when '9' then PD_9
41
+ when '10' then PD_10
42
+ when '11' then PD_11
43
+ else raise Errors::ParallelsUnsupportedVersion
44
+ end
53
45
 
54
- raise VagrantPlugins::Parallels::Errors::ParallelsInvalidVersion,
55
- supported_versions: supported_versions.join(", ")
46
+ # Starting since PD 11 only Pro and Business editions have CLI
47
+ # functionality and can be used with Vagrant.
48
+ if @version.split('.').first.to_i >= 11
49
+ edition = read_edition
50
+ if !edition || !%w(any pro business).include?(edition)
51
+ raise Errors::ParallelsUnsupportedEdition
52
+ end
56
53
  end
57
54
 
58
55
  @logger.info("Using Parallels driver: #{driver_klass}")
@@ -114,6 +111,18 @@ module VagrantPlugins
114
111
 
115
112
  protected
116
113
 
114
+ # Returns the edition of Parallels Desktop that is running. It makes
115
+ # sense only for Parallels Desktop 11 and later. For older versions
116
+ # it returns nil.
117
+ #
118
+ # @return [String]
119
+ def read_edition
120
+ lic_info = json({}) do
121
+ execute(@prlsrvctl_path, 'info', '--license', '--json')
122
+ end
123
+ lic_info['edition']
124
+ end
125
+
117
126
  # This returns the version of Parallels Desktop that is running.
118
127
  #
119
128
  # @return [String]
@@ -125,12 +134,13 @@ module VagrantPlugins
125
134
  # * prlctl version 10.0.0 (12345) rev 123456
126
135
  #
127
136
  # But we need exactly the first 3 numbers: "x.x.x"
137
+ output = execute(@prlctl_path, '--version')
128
138
 
129
- if execute(@prlctl_path, '--version') =~ /prlctl version (\d+\.\d+.\d+)/
130
- return $1
139
+ if output =~ /prlctl version (\d+\.\d+.\d+)/
140
+ Regexp.last_match(1)
141
+ else
142
+ raise Errors::ParallelsInvalidVersion, output: output
131
143
  end
132
-
133
- nil
134
144
  end
135
145
  end
136
146
  end
@@ -55,6 +55,14 @@ module VagrantPlugins
55
55
  error_key(:parallels_vm_option_not_found)
56
56
  end
57
57
 
58
+ class ParallelsUnsupportedEdition < VagrantParallelsError
59
+ error_key(:parallels_unsupported_edition)
60
+ end
61
+
62
+ class ParallelsUnsupportedVersion < VagrantParallelsError
63
+ error_key(:parallels_unsupported_version)
64
+ end
65
+
58
66
  class SharedAdapterNotFound < VagrantParallelsError
59
67
  error_key(:shared_adapter_not_found)
60
68
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Parallels
3
- VERSION = '1.4.1'
3
+ VERSION = '1.4.2'
4
4
  end
5
5
  end
data/locales/en.yml CHANGED
@@ -42,11 +42,10 @@ en:
42
42
  Parallels Desktop is complaining that the installation is incomplete.
43
43
  Try to reinstall Parallels Desktop or contact Parallels support.
44
44
  parallels_invalid_version: |-
45
- Vagrant has detected that you have a version of Parallels Desktop installed
46
- that is not supported. Please install or upgrade to one of the supported
47
- versions listed below to use Vagrant:
45
+ Vagrant could not fetch Parallels Desktop version from output:
46
+ %{output}
48
47
 
49
- %{supported_versions}
48
+ This is an internal error that should be reported as a bug.
50
49
  parallels_no_room_for_high_level_network: |-
51
50
  There is no available slots on the Parallels Desktop VM for the configured
52
51
  high-level network interfaces. "private_network" and "public_network"
@@ -75,6 +74,22 @@ en:
75
74
  Could not find a required option of Parallels Desktop virtual machine:
76
75
  %{vm_option}
77
76
  This is an internal error that should be reported as a bug.
77
+ parallels_unsupported_edition: |-
78
+ Vagrant has detected that you have an edition of Parallels Desktop for Mac
79
+ installed that is not supported. Vagrant Parallels provider is compatible
80
+ only with Pro and Business editions of Parallels Desktop. Other editions
81
+ do not have command line functionality and can not be used with Vagrant.
82
+
83
+ Please upgrade your installation: http://parallels.com/desktop
84
+ parallels_unsupported_version: |-
85
+ Vagrant has detected that you have a version of Parallels Desktop for Mac
86
+ installed that is not supported. Vagrant Parallels provider is compatible
87
+ only with Parallels Desktop 8 or later.
88
+ Please upgrade your installation: http://parallels.com/desktop
89
+
90
+ Note: Starting since Parallels Desktop 11 for Mac, Vagrant Parallels
91
+ provider can be only used with Pro or Business edition of Parallels
92
+ Desktop for Mac. Please, be aware while choosing the edition to upgrade to.
78
93
  snapshot_id_not_detected: |-
79
94
  ID of the newly created shapshod could not be detected. This is an
80
95
  internal error that users should never see. Please report a bug.
@@ -8,6 +8,7 @@ namespace :acceptance do
8
8
  task :run do
9
9
  components = %w(
10
10
  basic
11
+ linked_clone
11
12
  network/forwarded_port
12
13
  network/private_network
13
14
  synced_folder
@@ -323,10 +323,18 @@ shared_examples "parallels desktop driver" do |options|
323
323
  subject.version.should match(/^#{parallels_version}.\d+\.\d+$/)
324
324
  end
325
325
 
326
- it "raises ParallelsInvalidVersion exception for unsupported version" do
326
+ it "raises an exception for unsupported version" do
327
327
  subprocess.should_receive(:execute).
328
328
  with("prlctl", "--version", an_instance_of(Hash)).
329
329
  and_return(subprocess_result(stdout: "prlctl version 7.0.12345"))
330
+ expect { subject.version }.
331
+ to raise_error(VagrantPlugins::Parallels::Errors::ParallelsUnsupportedVersion)
332
+ end
333
+
334
+ it "raises an exception for invalid version output" do
335
+ subprocess.should_receive(:execute).
336
+ with("prlctl", "--version", an_instance_of(Hash)).
337
+ and_return(subprocess_result(stdout: "prlctl version 1.2.foo.bar"))
330
338
  expect { subject.version }.
331
339
  to raise_error(VagrantPlugins::Parallels::Errors::ParallelsInvalidVersion)
332
340
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-parallels
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Zholobov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-27 00:00:00.000000000 Z
12
+ date: 2015-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -112,6 +112,7 @@ files:
112
112
  - Rakefile
113
113
  - Vagrantfile
114
114
  - config/i18n-tasks.yml.erb
115
+ - debug.log
115
116
  - lib/vagrant-parallels.rb
116
117
  - lib/vagrant-parallels/action.rb
117
118
  - lib/vagrant-parallels/action/boot.rb
@@ -165,11 +166,8 @@ files:
165
166
  - tasks/test.rake
166
167
  - test/acceptance/base.rb
167
168
  - test/acceptance/provider/linked_clone_spec.rb
168
- - test/acceptance/provider/synced_folder_spec.rb
169
169
  - test/acceptance/shared/context_parallels.rb
170
170
  - test/acceptance/skeletons/linked_clone/Vagrantfile
171
- - test/acceptance/skeletons/synced_folder/Vagrantfile
172
- - test/acceptance/skeletons/synced_folder/foo
173
171
  - test/unit/base.rb
174
172
  - test/unit/config_test.rb
175
173
  - test/unit/driver/pd_10_test.rb
@@ -1,26 +0,0 @@
1
- # This tests that synced folders work with a given provider.
2
- shared_examples "provider/synced_folder" do |provider, options|
3
- if !options[:box]
4
- raise ArgumentError,
5
- "box option must be specified for provider: #{provider}"
6
- end
7
-
8
- include_context "acceptance"
9
-
10
- before do
11
- environment.skeleton("synced_folder")
12
- assert_execute("vagrant", "box", "add", "basic", options[:box])
13
- assert_execute("vagrant", "up", "--provider=#{provider}")
14
- end
15
-
16
- after do
17
- assert_execute("vagrant", "destroy", "--force")
18
- end
19
-
20
- it "properly configures synced folder types" do
21
- status("Test: mounts the default /vagrant synced folder")
22
- result = execute("vagrant", "ssh", "-c", "cat /vagrant/foo")
23
- expect(result.exit_code).to eql(0)
24
- expect(result.stdout).to match(/hello$/)
25
- end
26
- end
@@ -1,3 +0,0 @@
1
- Vagrant.configure("2") do |config|
2
- config.vm.box = "basic"
3
- end
@@ -1 +0,0 @@
1
- hello