vagrant-parallels 2.4.1 → 2.4.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5316a81fe9c64de94bb88a2db7b9efcc015325d4b95bd4ec6302f7441334e0c3
4
- data.tar.gz: d493a896f4b9776f2755038d333046c6fa920f7e1fdd45de96dee0ae4cf33ef4
3
+ metadata.gz: 2b5666de284879e9b3ea20a38dc3a132ad280a89dd6ec516ce21bbf8ff839a5c
4
+ data.tar.gz: d1828f81d1ebcb19c8d0054372db475082a83b25ad23c7c0dba1fb07e74aa019
5
5
  SHA512:
6
- metadata.gz: 874be6069e0cf9ec4ee115d75b7979bd68a1c007d04f0552dae2a808d7025c8659926a906ce37814ee19c7c2e04ef7b753d2c5b1d2121f8670092a40b77b5248
7
- data.tar.gz: 53435b75213e446b68d679f2600d47e70cc4d5fec8141d9be6e9eba270030cfa9f3d48cf398d5ce07311503de8a053802fb1629408bd49e5f49d25cbf40d0562
6
+ metadata.gz: 3d1f742e64b4fe8283cf110b4b9636291db21fca1686d92c38cc2376fe6b03cfa7a2e5c54a87ac16dab48052cf66e96f602dd920d860eb2886b83f21d52ff367
7
+ data.tar.gz: 7b2c507dfc64f46a168b7ee32c26e9db23e74306be8f5ec733166c669a363a45dd2119fca1c953a2f7e938fbeef303e1cc0bb691c51d0043a0344fa6f8a3662e
data/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
- ## 2.4.0 (May 22, 2023)
1
+ ## 2.4.2 (Feb 5, 2024)
2
+
3
+ BUG FIXES:
4
+ - Revert "use clonefile copy for macvm boxes"
5
+ [[GH-464](https://github.com/Parallels/vagrant-parallels/pull/464)]
6
+ ## 2.4.1 (Oct 16, 2023)
2
7
  IMPROVEMENTS:
3
8
  - use clonefile copy for macvm boxes
4
9
  [[GH-459](https://github.com/Parallels/vagrant-parallels/pull/459)]
@@ -78,26 +78,7 @@ module VagrantPlugins
78
78
  # @return [String] UUID of the new VM.
79
79
  def clone_vm(src_name, options = {})
80
80
  dst_name = "vagrant_temp_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
81
- src_vm = json { execute_prlctl('list', '--json', '-i', src_name) }.first
82
81
 
83
- if options[:linked] || !Util::Common.is_apfs?(src_vm.fetch('Home'))
84
- # If linked clone is an option, or path to src is not on APFS, then do the normal clone.
85
- prlctl_clone_vm(src_name, dst_name, options)
86
- else
87
- # We can use clonefile on APFS to do a fast CoW clone of the VM source and then register
88
- copy_clone_vm(src_name, dst_name, options)
89
- end
90
- read_vms[dst_name]
91
- end
92
-
93
- # Uses prlctl to clone an existing registered VM
94
- #
95
- # @param [String] src_name Name or UUID of the source VM or template.
96
- # @param [String] dst_name Name of the destination VM.
97
- # @param [<String => String>] options Options to clone virtual machine.
98
- def prlctl_clone_vm(src_name, dst_name, options = {})
99
- list_args = ['list', '--json', '-i', src_name]
100
- src_vm = json { execute_prlctl(*list_args) }.first
101
82
  args = ['clone', src_name, '--name', dst_name]
102
83
  args.concat(['--dst', options[:dst]]) if options[:dst]
103
84
 
@@ -116,41 +97,7 @@ module VagrantPlugins
116
97
  yield $1.to_i if block_given?
117
98
  end
118
99
  end
119
- end
120
-
121
- # Uses cp with clonefile flag to clone an existing registered VM
122
- #
123
- # @param [String] src_name Name or UUID of the source VM or template.
124
- # @param [String] dst_name Name of the destination VM.
125
- # @param [<String => String>] options Options to clone virtual machine.
126
- def copy_clone_vm(src_name, dst_name, options = {})
127
- list_args = ['list', '--json', '-i', src_name]
128
- src_vm = json { execute_prlctl(*list_args) }.first
129
- basepath = File.dirname(src_vm.fetch('Home')).delete_suffix('/')
130
- extension = File.basename(src_vm.fetch('Home')).delete_suffix('/').split('.').last
131
- clonepath = File.join(ENV['HOME'], "Parallels", "#{dst_name}.#{extension}")
132
- execute('cp', '-c', '-R', '-p', src_vm.fetch('Home'), clonepath)
133
-
134
- # Update config.pvs with dst_name as this is what Parallels uses when registering
135
- update_vm_name(File.join(clonepath, 'config.pvs'), dst_name)
136
-
137
- # Register the cloned path as a new VM
138
- args = ['register', clonepath]
139
- # Regenerate SourceVmUuid of the cloned VM
140
- args << '--regenerate-src-uuid' if options[:regenerate_src_uuid]
141
-
142
- # Regenerate SourceVmUuid of the cloned VM
143
- execute_prlctl(*args)
144
-
145
- # Don't need the box hanging around in Parallels
146
- execute_prlctl('unregister', src_name)
147
- end
148
-
149
- def update_vm_name(config_pvs_path, name)
150
- xml = Nokogiri::XML(File.read(config_pvs_path))
151
- elem = xml.at_xpath('//ParallelsVirtualMachine/Identification/VmName')
152
- elem.content = name
153
- File.write(config_pvs_path, xml.to_xml)
100
+ read_vms[dst_name]
154
101
  end
155
102
 
156
103
  # Compacts the specified virtual disk image
@@ -1,5 +1,3 @@
1
- require 'shellwords'
2
-
3
1
  module VagrantPlugins
4
2
  module Parallels
5
3
  module Util
@@ -11,23 +9,6 @@ module VagrantPlugins
11
9
  return !machine.box.nil? && !!Dir.glob(machine.box.directory.join('*.macvm')).first
12
10
  end
13
11
 
14
- # Determines if the box directory is on an APFS filesystem
15
- def self.is_apfs?(path, &block)
16
- output = {stdout: '', stderr: ''}
17
- df_command = %w[df -T apfs]
18
- df_command << Shellwords.escape(path)
19
- execute(*df_command, &block).exit_code == 0
20
- end
21
-
22
- private
23
-
24
- def self.execute(*command, &block)
25
- command << { notify: [:stdout, :stderr] }
26
-
27
- Vagrant::Util::Busy.busy(lambda {}) do
28
- Vagrant::Util::Subprocess.execute(*command, &block)
29
- end
30
- end
31
12
  end
32
13
  end
33
14
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Parallels
3
- VERSION = '2.4.1'
3
+ VERSION = '2.4.2'
4
4
  end
5
5
  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: 2.4.1
4
+ version: 2.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: 2023-10-16 00:00:00.000000000 Z
12
+ date: 2024-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri