vagrant-parallels 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bb66fcb45443b929a94a608db1571c128d63391
4
- data.tar.gz: ad196ab64285c216c5e7747cfd33b30475f56366
3
+ metadata.gz: 0edffdd16955b96b56809b61199a6b06ad6aa3e3
4
+ data.tar.gz: 828d632341884533c630af940f403eda2b69236f
5
5
  SHA512:
6
- metadata.gz: f5947a49b2946e6b389daed82507446b90e0b89d71a6008a010a232aa441bbd4eeb0a5dc1fc8eee65c658dab16aa12dd765cf5a465c4accf6e16d3e2a9787af8
7
- data.tar.gz: 47f52fbd7b6014ba913e7a3d6865f49850348d6e5df7b072b12555b49bebcf10ea13870cd23b4adb65f5c15e2484acbb02f2d6eac63569e8877de784d065cd89
6
+ metadata.gz: d520eba339de9118692e15603e4a1b6eb196eeb9aaa48ba440271786eead0f10430d507942461452f97bf54eb526856cc96ada539bd1e0bdbc43f872243e72f1
7
+ data.tar.gz: 1920626602a1094308109eac530c61d24b1f32a4294c619fe01516fa408f4d1eb5d8b580d3c598c62f74ccbe1da1c6126778edce2323d5eabbbd18c97923a87a
data/Gemfile CHANGED
@@ -9,5 +9,5 @@ group :development do
9
9
  # We depend on Vagrant for development, but we don't add it as a
10
10
  # gem dependency because we expect to be installed within the
11
11
  # Vagrant environment itself using `vagrant plugin`.
12
- gem 'vagrant', :git => 'git://github.com/mitchellh/vagrant.git'
12
+ gem 'vagrant', git: 'git://github.com/mitchellh/vagrant.git', tag: 'v1.7.1'
13
13
  end
@@ -17,7 +17,7 @@ module VagrantPlugins
17
17
 
18
18
  env[:ui].output(I18n.t("vagrant_parallels.actions.vm.handle_guest_tools.checking"))
19
19
 
20
- tools_state = @machine.provider.driver.read_guest_tools_state
20
+ tools_state = parallels_tools_state
21
21
 
22
22
  if tools_state == :installed
23
23
  @logger.info("The proper version of Parallels Tools is already installed")
@@ -50,6 +50,24 @@ module VagrantPlugins
50
50
  @app.call(env)
51
51
  end
52
52
 
53
+ private
54
+
55
+ # Determines the state of Parallels Tools
56
+ #
57
+ # @return [Symbol] Parallels Tools state (ex. :installed, :outdated,
58
+ # :not_installed, :possibly_installed)
59
+ def parallels_tools_state
60
+ # Sometimes tools can define their state with a little delay.
61
+ # If it is 'possibly_installed', then just wait a bit and try again.
62
+ 3.times do
63
+ state = @machine.provider.driver.read_guest_tools_state
64
+ return state if state != :possibly_installed
65
+ sleep 2
66
+ end
67
+
68
+ @machine.provider.driver.read_guest_tools_state
69
+ end
70
+
53
71
  end
54
72
  end
55
73
  end
@@ -58,9 +58,7 @@ module VagrantPlugins
58
58
 
59
59
  def register_template(tpl_path_s)
60
60
  @logger.info("Register the box template: '#{tpl_path_s}'")
61
- regen_uuid = @machine.provider_config.regen_box_uuid
62
-
63
- @machine.provider.driver.register(tpl_path_s, regen_uuid)
61
+ @machine.provider.driver.register(tpl_path_s)
64
62
  end
65
63
 
66
64
  def template_path
@@ -96,6 +94,11 @@ module VagrantPlugins
96
94
  # Clear the line one last time since the progress meter doesn't disappear
97
95
  # immediately.
98
96
  env[:ui].clear_line
97
+
98
+ if @machine.provider_config.regen_src_uuid
99
+ @logger.info("Regenerate SourceVmUuid")
100
+ @machine.provider.driver.regenerate_src_uuid
101
+ end
99
102
  end
100
103
 
101
104
  def unregister_template(tpl_name)
@@ -8,12 +8,15 @@ module VagrantPlugins
8
8
  attr_accessor :optimize_power_consumption
9
9
  attr_accessor :name
10
10
  attr_reader :network_adapters
11
- attr_accessor :regen_box_uuid
11
+ attr_accessor :regen_src_uuid
12
12
  attr_accessor :update_guest_tools
13
13
 
14
14
  # Compatibility with virtualbox provider's syntax
15
15
  alias :check_guest_additions= :check_guest_tools=
16
16
 
17
+ # Compatibility with old names
18
+ alias :regen_box_uuid= :regen_src_uuid=
19
+
17
20
  def initialize
18
21
  @check_guest_tools = UNSET_VALUE
19
22
  @customizations = []
@@ -22,7 +25,7 @@ module VagrantPlugins
22
25
  @network_adapters = {}
23
26
  @name = UNSET_VALUE
24
27
  @optimize_power_consumption = UNSET_VALUE
25
- @regen_box_uuid = UNSET_VALUE
28
+ @regen_src_uuid = UNSET_VALUE
26
29
  @update_guest_tools = UNSET_VALUE
27
30
 
28
31
  network_adapter(0, :shared)
@@ -47,6 +50,10 @@ module VagrantPlugins
47
50
  customize("pre-boot", ["set", :id, "--cpus", count.to_i])
48
51
  end
49
52
 
53
+ def regen_box_uuid=(value)
54
+ @regen_src_uuid = value
55
+ end
56
+
50
57
  def merge(other)
51
58
  super.tap do |result|
52
59
  c = customizations.dup
@@ -74,7 +81,7 @@ module VagrantPlugins
74
81
 
75
82
  @name = nil if @name == UNSET_VALUE
76
83
 
77
- @regen_box_uuid = true if @regen_box_uuid == UNSET_VALUE
84
+ @regen_src_uuid = true if @regen_src_uuid == UNSET_VALUE
78
85
 
79
86
  if @update_guest_tools == UNSET_VALUE
80
87
  @update_guest_tools = false
@@ -193,13 +193,15 @@ module VagrantPlugins
193
193
  def read_vms
194
194
  end
195
195
 
196
+ # Regenerates 'SourceVmUuid' to avoid SMBIOS UUID collision [GH-113]
197
+ #
198
+ def regenerate_src_uuid
199
+ end
200
+
196
201
  # Registers the virtual machine
197
202
  #
198
203
  # @param [String] pvm_file Path to the machine image (*.pvm)
199
- # @param [Boolean] regen_src_uuid Regenerate 'SourceVmUuid' to avoid
200
- # SMBIOS UUID collision, or let it unchanged to keep activation status
201
- # for Windows-based guests [GH-113]
202
- def register(pvm_file, regen_src_uuid)
204
+ def register(pvm_file)
203
205
  end
204
206
 
205
207
  # Resumes the virtual machine.
@@ -105,6 +105,7 @@ module VagrantPlugins
105
105
  :read_vms,
106
106
  :read_vms_info,
107
107
  :read_vms_paths,
108
+ :regenerate_src_uuid,
108
109
  :register,
109
110
  :resume,
110
111
  :set_power_consumption_mode,
@@ -1,4 +1,6 @@
1
1
  require 'log4r'
2
+ require 'nokogiri'
3
+ require 'securerandom'
2
4
 
3
5
  require 'vagrant/util/platform'
4
6
 
@@ -430,9 +432,22 @@ module VagrantPlugins
430
432
  list
431
433
  end
432
434
 
433
- def register(pvm_file, regen_src_uuid=false)
435
+ def regenerate_src_uuid
436
+ settings = read_settings
437
+ vm_config = File.join(settings.fetch('Home'), 'config.pvs')
438
+
439
+ # Generate and put new SourceVmUuid
440
+ xml = Nokogiri::XML(File.open(vm_config))
441
+ p = '//ParallelsVirtualMachine/Identification/SourceVmUuid'
442
+ xml.xpath(p).first.content = "{#{SecureRandom.uuid}}"
443
+
444
+ File.open(vm_config, 'w') do |f|
445
+ f.write xml.to_xml
446
+ end
447
+ end
448
+
449
+ def register(pvm_file)
434
450
  args = ['prlctl', 'register', pvm_file]
435
- args << '--regenerate-src-uuid' if regen_src_uuid
436
451
 
437
452
  3.times do
438
453
  result = raw(*args)
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Parallels
3
- VERSION = "1.3.4"
3
+ VERSION = '1.3.5'
4
4
  end
5
5
  end
@@ -249,15 +249,6 @@ shared_examples "parallels desktop driver" do |options|
249
249
 
250
250
  subject.register("/path/to/vm_image.pvm")
251
251
  end
252
-
253
- it "registers specified virtual machine or template and regen src uuid" do
254
- subprocess.should_receive(:execute).
255
- with("prlctl", "register", an_instance_of(String),
256
- "--regenerate-src-uuid", an_instance_of(Hash)).
257
- and_return(subprocess_result(exit_code: 0))
258
-
259
- subject.register("/path/to/vm_image.pvm", regen_src_uuid=true)
260
- end
261
252
  end
262
253
 
263
254
  describe "set_mac_address" do
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.3.4
4
+ version: 1.3.5
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: 2014-10-31 00:00:00.000000000 Z
12
+ date: 2014-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler