vagrant-parallels 1.4.2 → 1.4.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/README.md +7 -8
- data/Rakefile +2 -2
- data/lib/vagrant-parallels.rb +7 -44
- data/lib/vagrant-parallels/action.rb +45 -45
- data/lib/vagrant-parallels/action/boot.rb +1 -2
- data/lib/vagrant-parallels/action/clear_network_interfaces.rb +1 -1
- data/lib/vagrant-parallels/action/customize.rb +1 -1
- data/lib/vagrant-parallels/action/destroy.rb +1 -1
- data/lib/vagrant-parallels/action/destroy_unused_network_interfaces.rb +2 -2
- data/lib/vagrant-parallels/action/forced_halt.rb +1 -1
- data/lib/vagrant-parallels/action/forward_ports.rb +2 -2
- data/lib/vagrant-parallels/action/handle_guest_tools.rb +9 -10
- data/lib/vagrant-parallels/action/import.rb +36 -24
- data/lib/vagrant-parallels/action/network.rb +37 -37
- data/lib/vagrant-parallels/action/package.rb +3 -3
- data/lib/vagrant-parallels/action/package_config_files.rb +3 -2
- data/lib/vagrant-parallels/action/prepare_nfs_settings.rb +2 -2
- data/lib/vagrant-parallels/action/resume.rb +1 -1
- data/lib/vagrant-parallels/action/sane_defaults.rb +0 -1
- data/lib/vagrant-parallels/action/set_name.rb +7 -7
- data/lib/vagrant-parallels/action/setup_package_files.rb +6 -6
- data/lib/vagrant-parallels/action/suspend.rb +1 -1
- data/lib/vagrant-parallels/config.rb +9 -11
- data/lib/vagrant-parallels/driver/meta.rb +1 -1
- data/lib/vagrant-parallels/driver/pd_10.rb +1 -1
- data/lib/vagrant-parallels/driver/pd_11.rb +1 -1
- data/lib/vagrant-parallels/driver/pd_8.rb +19 -19
- data/lib/vagrant-parallels/driver/pd_9.rb +1 -1
- data/lib/vagrant-parallels/errors.rb +2 -2
- data/lib/vagrant-parallels/guest_cap/linux/install_parallels_tools.rb +5 -5
- data/lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb +3 -3
- data/lib/vagrant-parallels/model/forwarded_port.rb +1 -1
- data/lib/vagrant-parallels/plugin.rb +65 -30
- data/lib/vagrant-parallels/provider.rb +8 -8
- data/lib/vagrant-parallels/synced_folder.rb +6 -6
- data/lib/vagrant-parallels/util/compile_forwarded_ports.rb +1 -1
- data/lib/vagrant-parallels/version.rb +1 -1
- data/tasks/acceptance.rake +4 -4
- data/tasks/test.rake +1 -1
- data/test/acceptance/base.rb +2 -2
- data/test/acceptance/provider/linked_clone_spec.rb +2 -2
- data/test/acceptance/shared/context_parallels.rb +1 -1
- data/test/acceptance/skeletons/linked_clone/Vagrantfile +3 -3
- data/test/unit/base.rb +6 -6
- data/test/unit/config_test.rb +22 -22
- data/test/unit/driver/pd_10_test.rb +7 -7
- data/test/unit/driver/pd_8_test.rb +4 -4
- data/test/unit/driver/pd_9_test.rb +6 -6
- data/test/unit/support/shared/pd_driver_examples.rb +97 -97
- data/test/unit/synced_folder_test.rb +11 -11
- data/vagrant-parallels.gemspec +17 -19
- metadata +2 -32
- data/config/i18n-tasks.yml.erb +0 -18
- data/test/unit/locales/locales_test.rb +0 -14
@@ -38,8 +38,8 @@ module VagrantPlugins
|
|
38
38
|
unregister_template(tpl_name)
|
39
39
|
|
40
40
|
if @machine.state.id != :not_created
|
41
|
-
return if env[
|
42
|
-
return if env[
|
41
|
+
return if env['vagrant.error'].is_a?(Vagrant::Errors::VagrantError)
|
42
|
+
return if env['vagrant_parallels.error'].is_a?(Errors::VagrantParallelsError)
|
43
43
|
|
44
44
|
# If we're not supposed to destroy on error then just return
|
45
45
|
return if !env[:destroy_on_error]
|
@@ -79,24 +79,48 @@ module VagrantPlugins
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def import(env, tpl_name)
|
82
|
-
# Generate virtual machine name
|
83
|
-
vm_name = "#{tpl_name}_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
|
84
|
-
opts = {}
|
85
|
-
|
86
82
|
# Linked clones are supported only for PD 11 and higher
|
87
|
-
if @machine.provider_config.use_linked_clone
|
88
|
-
@machine.provider.pd_version_satisfies?('>= 11')
|
83
|
+
if @machine.provider_config.use_linked_clone \
|
84
|
+
&& @machine.provider.pd_version_satisfies?('>= 11')
|
89
85
|
|
90
86
|
env[:ui].info I18n.t('vagrant_parallels.actions.vm.import.importing_linked',
|
91
87
|
:name => @machine.box.name)
|
92
|
-
opts
|
93
|
-
|
88
|
+
opts = {
|
89
|
+
snapshot_id: snapshot_id(tpl_name),
|
90
|
+
linked: true
|
91
|
+
}
|
92
|
+
# Linked clone creation should not be concurrent [GH-206]
|
93
|
+
begin
|
94
|
+
@machine.env.lock("parallels_linked_clone") do
|
95
|
+
clone(env, tpl_name, opts)
|
96
|
+
end
|
97
|
+
rescue Vagrant::Errors::EnvironmentLockedError
|
98
|
+
sleep 1
|
99
|
+
retry
|
100
|
+
end
|
94
101
|
else
|
95
|
-
env[:ui].info I18n.t(
|
102
|
+
env[:ui].info I18n.t('vagrant.actions.vm.import.importing',
|
96
103
|
:name => @machine.box.name)
|
104
|
+
clone(env, tpl_name)
|
105
|
+
end
|
106
|
+
|
107
|
+
if @machine.provider_config.regen_src_uuid
|
108
|
+
@logger.info('Regenerate SourceVmUuid')
|
109
|
+
@machine.provider.driver.regenerate_src_uuid
|
97
110
|
end
|
98
111
|
|
99
|
-
#
|
112
|
+
# Remove 'Icon\r' file from VM home (bug in PD 11.0.0)
|
113
|
+
if @machine.provider.pd_version_satisfies?('= 11.0.0')
|
114
|
+
vm_home = @machine.provider.driver.read_settings.fetch('Home')
|
115
|
+
broken_icns = Dir[File.join(vm_home, 'Icon*')]
|
116
|
+
FileUtils.rm(broken_icns, :force => true)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def clone(env, tpl_name, opts={})
|
121
|
+
# Generate virtual machine name
|
122
|
+
vm_name = "#{tpl_name}_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
|
123
|
+
|
100
124
|
@machine.id = @machine.provider.driver.clone_vm(tpl_name, vm_name, opts) do |progress|
|
101
125
|
env[:ui].clear_line
|
102
126
|
env[:ui].report_progress(progress, 100, false)
|
@@ -109,18 +133,6 @@ module VagrantPlugins
|
|
109
133
|
# Clear the line one last time since the progress meter doesn't disappear
|
110
134
|
# immediately.
|
111
135
|
env[:ui].clear_line
|
112
|
-
|
113
|
-
if @machine.provider_config.regen_src_uuid
|
114
|
-
@logger.info("Regenerate SourceVmUuid")
|
115
|
-
@machine.provider.driver.regenerate_src_uuid
|
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
|
124
136
|
end
|
125
137
|
|
126
138
|
def snapshot_id(tpl_name)
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require 'set'
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'log4r'
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require 'vagrant/util/network_ip'
|
6
|
+
require 'vagrant/util/scoped_hash_override'
|
7
7
|
|
8
8
|
module VagrantPlugins
|
9
9
|
module Parallels
|
@@ -36,7 +36,7 @@ module VagrantPlugins
|
|
36
36
|
end
|
37
37
|
|
38
38
|
@logger.debug("Available slots for high-level adapters: #{available_slots.inspect}")
|
39
|
-
@logger.info(
|
39
|
+
@logger.info('Determining network adapters required for high-level configuration...')
|
40
40
|
available_slots = available_slots.to_a.sort
|
41
41
|
env[:machine].config.vm.networks.each do |type, options|
|
42
42
|
# We only handle private and public networks
|
@@ -69,7 +69,7 @@ module VagrantPlugins
|
|
69
69
|
network_adapters_config[slot] = data
|
70
70
|
end
|
71
71
|
|
72
|
-
@logger.info(
|
72
|
+
@logger.info('Determining adapters and compiling network configuration...')
|
73
73
|
adapters = []
|
74
74
|
networks = []
|
75
75
|
network_adapters_config.each do |slot, data|
|
@@ -107,14 +107,14 @@ module VagrantPlugins
|
|
107
107
|
|
108
108
|
if !adapters.empty?
|
109
109
|
# Enable the adapters
|
110
|
-
@logger.info(
|
111
|
-
env[:ui].output(I18n.t(
|
110
|
+
@logger.info('Enabling adapters...')
|
111
|
+
env[:ui].output(I18n.t('vagrant.actions.vm.network.preparing'))
|
112
112
|
adapters.each do |adapter|
|
113
113
|
env[:ui].detail(I18n.t(
|
114
|
-
|
114
|
+
'vagrant_parallels.parallels.network_adapter',
|
115
115
|
adapter: adapter[:adapter].to_s,
|
116
116
|
type: adapter[:type].to_s,
|
117
|
-
extra:
|
117
|
+
extra: '',
|
118
118
|
))
|
119
119
|
end
|
120
120
|
|
@@ -132,14 +132,14 @@ module VagrantPlugins
|
|
132
132
|
# Only configure the networks the user requested us to configure
|
133
133
|
networks_to_configure = networks.select { |n| n[:auto_config] }
|
134
134
|
if !networks_to_configure.empty?
|
135
|
-
env[:ui].info I18n.t(
|
135
|
+
env[:ui].info I18n.t('vagrant.actions.vm.network.configuring')
|
136
136
|
env[:machine].guest.capability(:configure_networks, networks_to_configure)
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
141
|
def bridged_config(options)
|
142
|
-
|
142
|
+
{
|
143
143
|
auto_config: true,
|
144
144
|
bridge: nil,
|
145
145
|
mac: nil,
|
@@ -151,7 +151,7 @@ module VagrantPlugins
|
|
151
151
|
def bridged_adapter(config)
|
152
152
|
# Find the bridged interfaces that are available
|
153
153
|
bridgedifs = @env[:machine].provider.driver.read_bridged_interfaces
|
154
|
-
bridgedifs.delete_if { |interface| interface[:status] ==
|
154
|
+
bridgedifs.delete_if { |interface| interface[:status] == 'Down' }
|
155
155
|
|
156
156
|
# The name of the chosen bridge interface will be assigned to this
|
157
157
|
# variable.
|
@@ -163,7 +163,7 @@ module VagrantPlugins
|
|
163
163
|
# Search for a matching bridged interface
|
164
164
|
bridgedifs.each do |interface|
|
165
165
|
if interface[:name].downcase == config[:bridge].downcase
|
166
|
-
@logger.debug(
|
166
|
+
@logger.debug('Specific bridge found as configured in the Vagrantfile. Using it.')
|
167
167
|
chosen_bridge = interface[:name]
|
168
168
|
break
|
169
169
|
end
|
@@ -171,7 +171,7 @@ module VagrantPlugins
|
|
171
171
|
|
172
172
|
# If one wasn't found, then we notify the user here.
|
173
173
|
if !chosen_bridge
|
174
|
-
@env[:ui].info I18n.t(
|
174
|
+
@env[:ui].info I18n.t('vagrant.actions.vm.bridged_networking.specific_not_found',
|
175
175
|
:bridge => config[:bridge])
|
176
176
|
end
|
177
177
|
end
|
@@ -184,18 +184,18 @@ module VagrantPlugins
|
|
184
184
|
if bridgedifs.length == 1
|
185
185
|
# One bridgable interface? Just use it.
|
186
186
|
chosen_bridge = bridgedifs[0][:name]
|
187
|
-
@logger.debug(
|
187
|
+
@logger.debug('Only one bridged interface available. Using it by default.')
|
188
188
|
else
|
189
189
|
# More than one bridgable interface requires a user decision, so
|
190
190
|
# show options to choose from.
|
191
|
-
@env[:ui].info I18n.t(
|
191
|
+
@env[:ui].info I18n.t('vagrant.actions.vm.bridged_networking.available',
|
192
192
|
:prefix => false)
|
193
193
|
bridgedifs.each_index do |index|
|
194
194
|
interface = bridgedifs[index]
|
195
195
|
@env[:ui].info("#{index + 1}) #{interface[:name]}", :prefix => false)
|
196
196
|
end
|
197
197
|
@env[:ui].info(I18n.t(
|
198
|
-
|
198
|
+
'vagrant.actions.vm.bridged_networking.choice_help')+"\n")
|
199
199
|
|
200
200
|
# The range of valid choices
|
201
201
|
valid = Range.new(1, bridgedifs.length)
|
@@ -215,7 +215,7 @@ module VagrantPlugins
|
|
215
215
|
@logger.info("Bridging adapter #{config[:adapter]} to #{chosen_bridge}")
|
216
216
|
|
217
217
|
# Given the choice we can now define the adapter we're using
|
218
|
-
|
218
|
+
{
|
219
219
|
adapter: config[:adapter],
|
220
220
|
type: :bridged,
|
221
221
|
bridge: chosen_bridge,
|
@@ -229,14 +229,14 @@ module VagrantPlugins
|
|
229
229
|
options = {
|
230
230
|
auto_config: true,
|
231
231
|
mac: nil,
|
232
|
-
netmask:
|
232
|
+
netmask: '255.255.255.0',
|
233
233
|
type: :static
|
234
234
|
}.merge(config)
|
235
235
|
options[:type] = options[:type].to_sym
|
236
236
|
return options
|
237
237
|
end
|
238
238
|
|
239
|
-
|
239
|
+
{
|
240
240
|
type: :dhcp,
|
241
241
|
use_dhcp_assigned_default_route: config[:use_dhcp_assigned_default_route]
|
242
242
|
}
|
@@ -248,7 +248,7 @@ module VagrantPlugins
|
|
248
248
|
mac: nil,
|
249
249
|
name: nil,
|
250
250
|
nic_type: nil,
|
251
|
-
netmask:
|
251
|
+
netmask: '255.255.255.0',
|
252
252
|
type: :static
|
253
253
|
}.merge(options)
|
254
254
|
|
@@ -256,7 +256,7 @@ module VagrantPlugins
|
|
256
256
|
options[:type] = options[:type].to_sym
|
257
257
|
|
258
258
|
# Default IP is in the 20-bit private network block for DHCP based networks
|
259
|
-
options[:ip] =
|
259
|
+
options[:ip] = '10.37.129.1' if options[:type] == :dhcp && !options[:ip]
|
260
260
|
|
261
261
|
# Calculate our network address for the given IP/netmask
|
262
262
|
netaddr = network_address(options[:ip], options[:netmask])
|
@@ -271,17 +271,17 @@ module VagrantPlugins
|
|
271
271
|
@env[:machine].provider.driver.read_bridged_interfaces.each do |interface|
|
272
272
|
that_netaddr = network_address(interface[:ip], interface[:netmask])
|
273
273
|
raise Vagrant::Errors::NetworkCollision if \
|
274
|
-
netaddr == that_netaddr && interface[:status] !=
|
274
|
+
netaddr == that_netaddr && interface[:status] != 'Down'
|
275
275
|
end
|
276
276
|
|
277
277
|
# Split the IP address into its components
|
278
|
-
ip_parts = netaddr.split(
|
278
|
+
ip_parts = netaddr.split('.').map { |i| i.to_i }
|
279
279
|
|
280
280
|
# Calculate the adapter IP, which we assume is the IP ".1" at
|
281
281
|
# the end usually.
|
282
282
|
adapter_ip = ip_parts.dup
|
283
283
|
adapter_ip[3] += 1
|
284
|
-
options[:adapter_ip] ||= adapter_ip.join(
|
284
|
+
options[:adapter_ip] ||= adapter_ip.join('.')
|
285
285
|
|
286
286
|
dhcp_options = {}
|
287
287
|
if options[:type] == :dhcp
|
@@ -289,19 +289,19 @@ module VagrantPlugins
|
|
289
289
|
# with the final octet + 1. So "172.28.0.0" turns into "172.28.0.1"
|
290
290
|
dhcp_ip = ip_parts.dup
|
291
291
|
dhcp_ip[3] += 1
|
292
|
-
dhcp_options[:dhcp_ip] = options[:dhcp_ip] || dhcp_ip.join(
|
292
|
+
dhcp_options[:dhcp_ip] = options[:dhcp_ip] || dhcp_ip.join('.')
|
293
293
|
|
294
294
|
# Calculate the lower and upper bound for the DHCP server
|
295
295
|
dhcp_lower = ip_parts.dup
|
296
296
|
dhcp_lower[3] += 2
|
297
|
-
dhcp_options[:dhcp_lower] = options[:dhcp_lower] || dhcp_lower.join(
|
297
|
+
dhcp_options[:dhcp_lower] = options[:dhcp_lower] || dhcp_lower.join('.')
|
298
298
|
|
299
299
|
dhcp_upper = ip_parts.dup
|
300
300
|
dhcp_upper[3] = 254
|
301
|
-
dhcp_options[:dhcp_upper] = options[:dhcp_upper] || dhcp_upper.join(
|
301
|
+
dhcp_options[:dhcp_upper] = options[:dhcp_upper] || dhcp_upper.join('.')
|
302
302
|
end
|
303
303
|
|
304
|
-
|
304
|
+
{
|
305
305
|
adapter_ip: options[:adapter_ip],
|
306
306
|
auto_config: options[:auto_config],
|
307
307
|
ip: options[:ip],
|
@@ -318,14 +318,14 @@ module VagrantPlugins
|
|
318
318
|
interface = hostonly_find_matching_network(config)
|
319
319
|
|
320
320
|
if !interface
|
321
|
-
@logger.info(
|
321
|
+
@logger.info('Network not found. Creating if we can.')
|
322
322
|
|
323
323
|
# Create a new network
|
324
324
|
interface = hostonly_create_network(config)
|
325
325
|
@logger.info("Created network: #{interface[:name]}")
|
326
326
|
end
|
327
327
|
|
328
|
-
|
328
|
+
{
|
329
329
|
adapter: config[:adapter],
|
330
330
|
hostonly: interface[:name],
|
331
331
|
mac_address: config[:mac],
|
@@ -335,7 +335,7 @@ module VagrantPlugins
|
|
335
335
|
end
|
336
336
|
|
337
337
|
def hostonly_network_config(config)
|
338
|
-
|
338
|
+
{
|
339
339
|
type: config[:type],
|
340
340
|
adapter_ip: config[:adapter_ip],
|
341
341
|
ip: config[:ip],
|
@@ -345,20 +345,20 @@ module VagrantPlugins
|
|
345
345
|
|
346
346
|
|
347
347
|
def shared_config(options)
|
348
|
-
|
348
|
+
{
|
349
349
|
auto_config: false
|
350
350
|
}
|
351
351
|
end
|
352
352
|
|
353
353
|
def shared_adapter(config)
|
354
|
-
|
354
|
+
{
|
355
355
|
adapter: config[:adapter],
|
356
356
|
type: :shared
|
357
357
|
}
|
358
358
|
end
|
359
359
|
|
360
360
|
def shared_network_config(config)
|
361
|
-
|
361
|
+
{}
|
362
362
|
end
|
363
363
|
|
364
364
|
#-----------------------------------------------------------------
|
@@ -408,7 +408,7 @@ module VagrantPlugins
|
|
408
408
|
end
|
409
409
|
|
410
410
|
if net_nums.empty?
|
411
|
-
|
411
|
+
'vagrant-vnet0'
|
412
412
|
else
|
413
413
|
net_nums.sort! if net_nums
|
414
414
|
free_names = Array(0..net_nums.last.next) - net_nums
|
@@ -12,13 +12,13 @@ module VagrantPlugins
|
|
12
12
|
def call(env)
|
13
13
|
# Setup the temporary directory
|
14
14
|
@temp_dir = env[:tmp_path].join(Time.now.to_i.to_s)
|
15
|
-
env[
|
16
|
-
FileUtils.mkpath(env[
|
15
|
+
env['export.temp_dir'] = @temp_dir
|
16
|
+
FileUtils.mkpath(env['export.temp_dir'])
|
17
17
|
|
18
18
|
# Just match up a couple environmental variables so that
|
19
19
|
# the superclass will do the right thing. Then, call the
|
20
20
|
# superclass
|
21
|
-
env[
|
21
|
+
env['package.directory'] = env['export.temp_dir']
|
22
22
|
|
23
23
|
general_call(env)
|
24
24
|
|
@@ -18,12 +18,13 @@ module VagrantPlugins
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def create_metadata
|
21
|
-
File.open(File.join(@env[
|
21
|
+
File.open(File.join(@env['export.temp_dir'], 'metadata.json'), 'w') do |f|
|
22
22
|
f.write(template_metadatafile)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
private
|
27
|
+
|
27
28
|
def template_metadatafile
|
28
29
|
%Q({"provider": "parallels"}\n)
|
29
30
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'ipaddr'
|
2
|
-
require
|
2
|
+
require 'vagrant/action/builtin/mixin_synced_folders'
|
3
3
|
|
4
4
|
module VagrantPlugins
|
5
5
|
module Parallels
|
@@ -25,7 +25,7 @@ module VagrantPlugins
|
|
25
25
|
folders = synced_folders(env[:machine], **opts)
|
26
26
|
|
27
27
|
if folders.has_key?(:nfs)
|
28
|
-
@logger.info(
|
28
|
+
@logger.info('Using NFS, preparing NFS settings by reading host IP and machine IP')
|
29
29
|
add_ips_to_env!(env)
|
30
30
|
end
|
31
31
|
end
|
@@ -10,7 +10,7 @@ module VagrantPlugins
|
|
10
10
|
current_state = env[:machine].state.id
|
11
11
|
|
12
12
|
if current_state == :suspended
|
13
|
-
env[:ui].info I18n.t(
|
13
|
+
env[:ui].info I18n.t('vagrant.actions.vm.resume.resuming')
|
14
14
|
env[:machine].provider.driver.resume
|
15
15
|
end
|
16
16
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'log4r'
|
2
2
|
|
3
3
|
module VagrantPlugins
|
4
4
|
module Parallels
|
@@ -13,16 +13,16 @@ module VagrantPlugins
|
|
13
13
|
name = env[:machine].provider_config.name
|
14
14
|
|
15
15
|
# If we already set the name before, then don't do anything
|
16
|
-
sentinel = env[:machine].data_dir.join(
|
16
|
+
sentinel = env[:machine].data_dir.join('action_set_name')
|
17
17
|
if !name && sentinel.file?
|
18
|
-
@logger.info(
|
18
|
+
@logger.info('Default name was already set before, not doing it again.')
|
19
19
|
return @app.call(env)
|
20
20
|
end
|
21
21
|
|
22
22
|
# If no name was manually set, then use a default
|
23
23
|
if !name
|
24
24
|
prefix = "#{env[:root_path].basename.to_s}_#{env[:machine].name}"
|
25
|
-
prefix.gsub!(/[^-a-z0-9_]/i,
|
25
|
+
prefix.gsub!(/[^-a-z0-9_]/i, '')
|
26
26
|
# milliseconds + random number suffix to allow for simultaneous `vagrant up` of the same box in different dirs
|
27
27
|
name = prefix + "_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
|
28
28
|
end
|
@@ -33,15 +33,15 @@ module VagrantPlugins
|
|
33
33
|
vms_names.has_key?(name) && vms_names[name] != env[:machine].id
|
34
34
|
|
35
35
|
if vms_names.has_key?(name)
|
36
|
-
@logger.info(
|
36
|
+
@logger.info('Not setting the name because our name is already set.')
|
37
37
|
else
|
38
38
|
env[:ui].info(I18n.t(
|
39
|
-
|
39
|
+
'vagrant.actions.vm.set_name.setting_name', name: name))
|
40
40
|
env[:machine].provider.driver.set_name(name)
|
41
41
|
end
|
42
42
|
|
43
43
|
# Create the sentinel
|
44
|
-
sentinel.open(
|
44
|
+
sentinel.open('w') do |f|
|
45
45
|
f.write(Time.now.to_i.to_s)
|
46
46
|
end
|
47
47
|
|