vagrant-parallels 2.1.0 → 2.2.3
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 +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +1 -4
- data/lib/vagrant-parallels/action/forward_ports.rb +19 -17
- data/lib/vagrant-parallels/action/network.rb +72 -75
- data/lib/vagrant-parallels/cap/mount_options.rb +50 -0
- data/lib/vagrant-parallels/driver/base.rb +76 -96
- data/lib/vagrant-parallels/errors.rb +4 -4
- data/lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb +31 -64
- data/lib/vagrant-parallels/model/forwarded_port.rb +14 -2
- data/lib/vagrant-parallels/plugin.rb +15 -0
- data/lib/vagrant-parallels/synced_folder.rb +13 -21
- data/lib/vagrant-parallels/util/compile_forwarded_ports.rb +19 -17
- data/lib/vagrant-parallels/util/unix_mount_helpers.rb +121 -0
- data/lib/vagrant-parallels/version.rb +1 -1
- data/locales/en.yml +13 -8
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4af52807cb579f4b1f18957178a8230186a4c0305bef6777879a05f48a4e26b
|
4
|
+
data.tar.gz: 130d7a27229008dbb74188269acb846199fe8001f0cb6e7694a954dc10316ddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61c6ff36e06913bdca908f225357c3f250b8f27c06659145c6f8285d4a836e673d2f4b8ebc9aed62929ca34de1564a73992e1e6b5e3b9754c4f8c42cfabf8649
|
7
|
+
data.tar.gz: 619bbae811769347eef8580f2ef1781e708eeb5a5c59a429d0a509ba09aa37ab1bc584837ca97e7ddad8550ec35c766a1a242a7187ecdf89b5b2990f799821a8
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
## 2.2.3 (July 14, 2021)
|
2
|
+
BUG FIXES:
|
3
|
+
- Fixed the compatibility with Vagrant 2.2.17
|
4
|
+
[[GH-399](https://github.com/Parallels/vagrant-parallels/pull/399)]
|
5
|
+
|
6
|
+
## 2.2.2 (June 23, 2021)
|
7
|
+
BUG FIXES:
|
8
|
+
- Fixed shared folder mount on the VM reboot
|
9
|
+
[[GH-391](https://github.com/Parallels/vagrant-parallels/pull/391)]
|
10
|
+
|
11
|
+
## 2.2.1 (April 14, 2021)
|
12
|
+
BUG FIXES:
|
13
|
+
- Fixed the compatibility with Vagrant 2.2.15
|
14
|
+
[[GH-386](https://github.com/Parallels/vagrant-parallels/pull/386)]
|
15
|
+
|
16
|
+
## 2.2.0 (March 3, 2021)
|
17
|
+
IMPROVEMENTS:
|
18
|
+
- Mount shared folders after manual VM reboot
|
19
|
+
[[GH-377](https://github.com/Parallels/vagrant-parallels/pull/377)]
|
20
|
+
|
21
|
+
BUG FIXES:
|
22
|
+
- Fixed mount of shared folders with non-ASCII symbols in the name
|
23
|
+
[[GH-290](https://github.com/Parallels/vagrant-parallels/issues/290)]
|
24
|
+
|
1
25
|
## 2.1.0 (November 25, 2020)
|
2
26
|
BUG FIXES:
|
3
27
|
- Fixed the private network adapter workflow on macOS 11.0 Big Sur
|
data/README.md
CHANGED
@@ -8,10 +8,7 @@ allowing to manage [Parallels Desktop](https://www.parallels.com/products/deskto
|
|
8
8
|
virtual machines on macOS hosts.
|
9
9
|
|
10
10
|
### Requirements
|
11
|
-
- [Vagrant v1.
|
12
|
-
(_there are known issues with Vagrant v1.9.5
|
13
|
-
[[GH-297](https://github.com/Parallels/vagrant-parallels/issues/297#issuecomment-304458691)]
|
14
|
-
and v1.9.6 [[GH-301]](https://github.com/Parallels/vagrant-parallels/issues/301)_)
|
11
|
+
- [Vagrant v1.9.7](https://www.vagrantup.com) or higher
|
15
12
|
- [Parallels Desktop 11 for Mac](https://www.parallels.com/products/desktop/) or higher
|
16
13
|
|
17
14
|
*Note:* Only **Pro** and **Business** editions of **Parallels Desktop for Mac**
|
@@ -5,7 +5,7 @@ module VagrantPlugins
|
|
5
5
|
include VagrantPlugins::Parallels::Util::CompileForwardedPorts
|
6
6
|
@@lock = Mutex.new
|
7
7
|
|
8
|
-
def initialize(app,
|
8
|
+
def initialize(app, _env)
|
9
9
|
@app = app
|
10
10
|
end
|
11
11
|
|
@@ -22,17 +22,15 @@ module VagrantPlugins
|
|
22
22
|
return @app.call(env) if env[:forwarded_ports].empty?
|
23
23
|
|
24
24
|
# Acquire both of class- and process-level locks so that we don't
|
25
|
-
# forward ports
|
25
|
+
# forward ports simultaneously with someone else.
|
26
26
|
@@lock.synchronize do
|
27
|
-
|
28
|
-
env[:
|
29
|
-
|
30
|
-
forward_ports
|
31
|
-
end
|
32
|
-
rescue Errors::EnvironmentLockedError
|
33
|
-
sleep 1
|
34
|
-
retry
|
27
|
+
env[:machine].env.lock('forward_ports') do
|
28
|
+
env[:ui].output(I18n.t('vagrant.actions.vm.forward_ports.forwarding'))
|
29
|
+
forward_ports
|
35
30
|
end
|
31
|
+
rescue Vagrant::Errors::EnvironmentLockedError
|
32
|
+
sleep 1
|
33
|
+
retry
|
36
34
|
end
|
37
35
|
|
38
36
|
@app.call(env)
|
@@ -46,7 +44,9 @@ module VagrantPlugins
|
|
46
44
|
@env[:forwarded_ports].each do |fp|
|
47
45
|
message_attributes = {
|
48
46
|
guest_port: fp.guest_port,
|
49
|
-
|
47
|
+
guest_ip: fp.guest_ip,
|
48
|
+
host_port: fp.host_port,
|
49
|
+
host_ip: fp.host_ip
|
50
50
|
}
|
51
51
|
|
52
52
|
# Assuming the only reason to establish port forwarding is
|
@@ -54,7 +54,7 @@ module VagrantPlugins
|
|
54
54
|
# bridged networking don't require port-forwarding and establishing
|
55
55
|
# forwarded ports on these attachment types has uncertain behaviour.
|
56
56
|
@env[:ui].detail(I18n.t('vagrant_parallels.actions.vm.forward_ports.forwarding_entry',
|
57
|
-
message_attributes))
|
57
|
+
**message_attributes))
|
58
58
|
|
59
59
|
# In Parallels Desktop the scope port forwarding rules is global,
|
60
60
|
# so we have to keep their names unique.
|
@@ -69,14 +69,16 @@ module VagrantPlugins
|
|
69
69
|
|
70
70
|
# Add the options to the ports array to send to the driver later
|
71
71
|
ports << {
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
guest_port: fp.guest_port,
|
73
|
+
guest_ip: fp.guest_ip,
|
74
|
+
host_port: fp.host_port,
|
75
|
+
host_ip: fp.host_ip,
|
76
|
+
name: unique_id,
|
77
|
+
protocol: fp.protocol
|
76
78
|
}
|
77
79
|
end
|
78
80
|
|
79
|
-
|
81
|
+
unless ports.empty?
|
80
82
|
# We only need to forward ports if there are any to forward
|
81
83
|
@env[:machine].provider.driver.forward_ports(ports)
|
82
84
|
end
|
@@ -16,7 +16,7 @@ module VagrantPlugins
|
|
16
16
|
include Vagrant::Util::ScopedHashOverride
|
17
17
|
@@lock = Mutex.new
|
18
18
|
|
19
|
-
def initialize(app,
|
19
|
+
def initialize(app, _env)
|
20
20
|
@app = app
|
21
21
|
@logger = Log4r::Logger.new('vagrant_parallels::action::network')
|
22
22
|
end
|
@@ -44,20 +44,20 @@ module VagrantPlugins
|
|
44
44
|
|
45
45
|
# Figure out the slot that this adapter will go into
|
46
46
|
slot = options[:adapter]
|
47
|
-
|
48
|
-
if available_slots.empty?
|
49
|
-
raise VagrantPlugins::Parallels::Errors::ParallelsNoRoomForHighLevelNetwork
|
50
|
-
end
|
47
|
+
unless slot
|
48
|
+
raise VagrantPlugins::Parallels::Errors::ParallelsNoRoomForHighLevelNetwork if available_slots.empty?
|
51
49
|
|
52
50
|
slot = available_slots.shift
|
53
51
|
end
|
54
52
|
|
55
53
|
# Configure it
|
56
54
|
data = nil
|
57
|
-
|
55
|
+
#noinspection RubyCaseWithoutElseBlockInspection
|
56
|
+
case type
|
57
|
+
when :private_network
|
58
58
|
# private_network = hostonly
|
59
59
|
data = [:hostonly, options]
|
60
|
-
|
60
|
+
when :public_network
|
61
61
|
# public_network = bridged
|
62
62
|
data = [:bridged, options]
|
63
63
|
end
|
@@ -103,16 +103,15 @@ module VagrantPlugins
|
|
103
103
|
networks << network
|
104
104
|
end
|
105
105
|
|
106
|
-
|
106
|
+
unless adapters.empty?
|
107
107
|
# Enable the adapters
|
108
108
|
@logger.info('Enabling adapters...')
|
109
109
|
env[:ui].output(I18n.t('vagrant.actions.vm.network.preparing'))
|
110
110
|
adapters.each do |adapter|
|
111
|
-
env[:ui].detail(I18n.t(
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
extra: '',
|
111
|
+
env[:ui].detail(I18n.t('vagrant_parallels.parallels.network_adapter',
|
112
|
+
adapter: adapter[:adapter].to_s,
|
113
|
+
type: adapter[:type].to_s,
|
114
|
+
extra: '',
|
116
115
|
))
|
117
116
|
end
|
118
117
|
|
@@ -124,12 +123,12 @@ module VagrantPlugins
|
|
124
123
|
|
125
124
|
# If we have networks to configure, then we configure it now, since
|
126
125
|
# that requires the machine to be up and running.
|
127
|
-
|
126
|
+
unless adapters.empty? && networks.empty?
|
128
127
|
assign_interface_numbers(networks, adapters)
|
129
128
|
|
130
129
|
# Only configure the networks the user requested us to configure
|
131
130
|
networks_to_configure = networks.select { |n| n[:auto_config] }
|
132
|
-
|
131
|
+
unless networks_to_configure.empty?
|
133
132
|
env[:ui].info I18n.t('vagrant.actions.vm.network.configuring')
|
134
133
|
env[:machine].guest.capability(:configure_networks, networks_to_configure)
|
135
134
|
end
|
@@ -138,10 +137,10 @@ module VagrantPlugins
|
|
138
137
|
|
139
138
|
def bridged_config(options)
|
140
139
|
{
|
141
|
-
auto_config:
|
142
|
-
bridge:
|
143
|
-
mac:
|
144
|
-
nic_type:
|
140
|
+
auto_config: true,
|
141
|
+
bridge: nil,
|
142
|
+
mac: nil,
|
143
|
+
nic_type: nil,
|
145
144
|
use_dhcp_assigned_default_route: false
|
146
145
|
}.merge(options || {})
|
147
146
|
end
|
@@ -162,17 +161,17 @@ module VagrantPlugins
|
|
162
161
|
Array(config[:bridge]).each do |bridge|
|
163
162
|
bridge = bridge.downcase if bridge.respond_to?(:downcase)
|
164
163
|
bridgedifs.each do |interface|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
164
|
+
next unless bridge === interface[:name].downcase
|
165
|
+
|
166
|
+
@logger.debug('Specific bridge found as configured in the Vagrantfile. Using it.')
|
167
|
+
chosen_bridge = interface[:name]
|
168
|
+
break
|
170
169
|
end
|
171
170
|
break if chosen_bridge
|
172
171
|
end
|
173
172
|
|
174
173
|
# If one wasn't found, then we notify the user here.
|
175
|
-
|
174
|
+
unless chosen_bridge
|
176
175
|
@env[:ui].info I18n.t(
|
177
176
|
'vagrant.actions.vm.bridged_networking.specific_not_found',
|
178
177
|
bridge: config[:bridge])
|
@@ -183,7 +182,7 @@ module VagrantPlugins
|
|
183
182
|
# specified in the Vagrantfile, or the bridge specified in the Vagrantfile
|
184
183
|
# wasn't found), then we fall back to the normal means of searching for a
|
185
184
|
# bridged network.
|
186
|
-
|
185
|
+
unless chosen_bridge
|
187
186
|
if bridgedifs.length == 1
|
188
187
|
# One bridgable interface? Just use it.
|
189
188
|
chosen_bridge = bridgedifs[0][:name]
|
@@ -197,15 +196,14 @@ module VagrantPlugins
|
|
197
196
|
interface = bridgedifs[index]
|
198
197
|
@env[:ui].info("#{index + 1}) #{interface[:name]}", prefix: false)
|
199
198
|
end
|
200
|
-
@env[:ui].info(I18n.t(
|
201
|
-
'vagrant.actions.vm.bridged_networking.choice_help')+"\n")
|
199
|
+
@env[:ui].info("#{I18n.t('vagrant.actions.vm.bridged_networking.choice_help')}\n")
|
202
200
|
|
203
201
|
# The range of valid choices
|
204
202
|
valid = Range.new(1, bridgedifs.length)
|
205
203
|
|
206
204
|
# The choice that the user has chosen as the bridging interface
|
207
205
|
choice = nil
|
208
|
-
|
206
|
+
until valid.include?(choice)
|
209
207
|
choice = @env[:ui].ask(
|
210
208
|
'Which interface should the network bridge to? Enter a number: ')
|
211
209
|
choice = choice.to_i
|
@@ -219,11 +217,11 @@ module VagrantPlugins
|
|
219
217
|
|
220
218
|
# Given the choice we can now define the adapter we're using
|
221
219
|
{
|
222
|
-
adapter:
|
223
|
-
type:
|
224
|
-
bridge:
|
220
|
+
adapter: config[:adapter],
|
221
|
+
type: :bridged,
|
222
|
+
bridge: chosen_bridge,
|
225
223
|
mac_address: config[:mac],
|
226
|
-
nic_type:
|
224
|
+
nic_type: config[:nic_type]
|
227
225
|
}
|
228
226
|
end
|
229
227
|
|
@@ -231,16 +229,16 @@ module VagrantPlugins
|
|
231
229
|
if config[:ip]
|
232
230
|
options = {
|
233
231
|
auto_config: true,
|
234
|
-
mac:
|
235
|
-
netmask:
|
236
|
-
type:
|
232
|
+
mac: nil,
|
233
|
+
netmask: '255.255.255.0',
|
234
|
+
type: :static
|
237
235
|
}.merge(config)
|
238
236
|
options[:type] = options[:type].to_sym
|
239
237
|
return options
|
240
238
|
end
|
241
239
|
|
242
240
|
{
|
243
|
-
type:
|
241
|
+
type: :dhcp,
|
244
242
|
use_dhcp_assigned_default_route: config[:use_dhcp_assigned_default_route]
|
245
243
|
}
|
246
244
|
end
|
@@ -248,10 +246,10 @@ module VagrantPlugins
|
|
248
246
|
def hostonly_config(options)
|
249
247
|
options = {
|
250
248
|
auto_config: true,
|
251
|
-
mac:
|
252
|
-
name:
|
253
|
-
nic_type:
|
254
|
-
type:
|
249
|
+
mac: nil,
|
250
|
+
name: nil,
|
251
|
+
nic_type: nil,
|
252
|
+
type: :static
|
255
253
|
}.merge(options)
|
256
254
|
|
257
255
|
# Make sure the type is a symbol
|
@@ -290,13 +288,14 @@ module VagrantPlugins
|
|
290
288
|
# network interface.
|
291
289
|
@env[:machine].provider.driver.read_bridged_interfaces.each do |interface|
|
292
290
|
next if interface[:status] == 'Down'
|
291
|
+
|
293
292
|
that_netaddr = IPAddr.new("#{interface[:ip]}/#{interface[:netmask]}")
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
293
|
+
next unless netaddr.include? that_netaddr
|
294
|
+
|
295
|
+
raise VagrantPlugins::Parallels::Errors::NetworkCollision,
|
296
|
+
hostonly_netaddr: netaddr,
|
297
|
+
bridge_netaddr: that_netaddr,
|
298
|
+
bridge_interface: interface[:name]
|
300
299
|
end
|
301
300
|
end
|
302
301
|
|
@@ -319,14 +318,14 @@ module VagrantPlugins
|
|
319
318
|
end
|
320
319
|
|
321
320
|
{
|
322
|
-
adapter_ip:
|
321
|
+
adapter_ip: options[:adapter_ip],
|
323
322
|
auto_config: options[:auto_config],
|
324
|
-
ip:
|
325
|
-
mac:
|
326
|
-
name:
|
327
|
-
netmask:
|
328
|
-
nic_type:
|
329
|
-
type:
|
323
|
+
ip: options[:ip],
|
324
|
+
mac: options[:mac],
|
325
|
+
name: options[:name],
|
326
|
+
netmask: options[:netmask],
|
327
|
+
nic_type: options[:nic_type],
|
328
|
+
type: options[:type]
|
330
329
|
}.merge(dhcp_options)
|
331
330
|
end
|
332
331
|
|
@@ -334,7 +333,7 @@ module VagrantPlugins
|
|
334
333
|
@logger.info("Searching for matching hostonly network: #{config[:ip]}")
|
335
334
|
interface = hostonly_find_matching_network(config)
|
336
335
|
|
337
|
-
|
336
|
+
unless interface
|
338
337
|
@logger.info('Network not found. Creating if we can.')
|
339
338
|
|
340
339
|
# Create a new network
|
@@ -343,25 +342,25 @@ module VagrantPlugins
|
|
343
342
|
end
|
344
343
|
|
345
344
|
{
|
346
|
-
adapter:
|
347
|
-
hostonly:
|
345
|
+
adapter: config[:adapter],
|
346
|
+
hostonly: interface[:name],
|
348
347
|
mac_address: config[:mac],
|
349
|
-
nic_type:
|
350
|
-
type:
|
348
|
+
nic_type: config[:nic_type],
|
349
|
+
type: :hostonly
|
351
350
|
}
|
352
351
|
end
|
353
352
|
|
354
353
|
def hostonly_network_config(config)
|
355
354
|
{
|
356
|
-
type:
|
355
|
+
type: config[:type],
|
357
356
|
adapter_ip: config[:adapter_ip],
|
358
|
-
ip:
|
359
|
-
netmask:
|
357
|
+
ip: config[:ip],
|
358
|
+
netmask: config[:netmask]
|
360
359
|
}
|
361
360
|
end
|
362
361
|
|
363
362
|
|
364
|
-
def shared_config(
|
363
|
+
def shared_config(_options)
|
365
364
|
{
|
366
365
|
auto_config: false
|
367
366
|
}
|
@@ -370,11 +369,11 @@ module VagrantPlugins
|
|
370
369
|
def shared_adapter(config)
|
371
370
|
{
|
372
371
|
adapter: config[:adapter],
|
373
|
-
type:
|
372
|
+
type: :shared
|
374
373
|
}
|
375
374
|
end
|
376
375
|
|
377
|
-
def shared_network_config(
|
376
|
+
def shared_network_config(_config)
|
378
377
|
{}
|
379
378
|
end
|
380
379
|
|
@@ -396,11 +395,11 @@ module VagrantPlugins
|
|
396
395
|
# Make a first pass to assign interface numbers by adapter location
|
397
396
|
vm_adapters = @env[:machine].provider.driver.read_network_interfaces
|
398
397
|
vm_adapters.sort.each do |number, adapter|
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
398
|
+
next unless adapter[:type] != :none
|
399
|
+
|
400
|
+
# Not used, so assign the interface number and increment
|
401
|
+
adapter_to_interface[number] = current
|
402
|
+
current += 1
|
404
403
|
end
|
405
404
|
|
406
405
|
# Make a pass through the adapters to assign the :interface
|
@@ -419,9 +418,7 @@ module VagrantPlugins
|
|
419
418
|
# Get the list of numbers
|
420
419
|
net_nums = []
|
421
420
|
@env[:machine].provider.driver.read_virtual_networks.each do |net|
|
422
|
-
if net['Network ID'] =~ /^vagrant-vnet(\d+)$/
|
423
|
-
net_nums << $1.to_i
|
424
|
-
end
|
421
|
+
net_nums << $1.to_i if net['Network ID'] =~ /^vagrant-vnet(\d+)$/
|
425
422
|
end
|
426
423
|
|
427
424
|
if net_nums.empty?
|
@@ -440,12 +437,12 @@ module VagrantPlugins
|
|
440
437
|
options = {
|
441
438
|
network_id: config[:name] || next_network_id,
|
442
439
|
adapter_ip: config[:adapter_ip],
|
443
|
-
netmask:
|
440
|
+
netmask: config[:netmask],
|
444
441
|
}
|
445
442
|
|
446
443
|
if config[:type] == :dhcp
|
447
444
|
options[:dhcp] = {
|
448
|
-
ip:
|
445
|
+
ip: config[:dhcp_ip],
|
449
446
|
lower: config[:dhcp_lower],
|
450
447
|
upper: config[:dhcp_upper]
|
451
448
|
}
|