vagrant-parallels 1.0.9.rc1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vagrant-parallels/action.rb +121 -122
- data/lib/vagrant-parallels/action/customize.rb +2 -3
- data/lib/vagrant-parallels/action/handle_guest_tools.rb +51 -0
- data/lib/vagrant-parallels/action/import.rb +1 -1
- data/lib/vagrant-parallels/action/is_driver_version.rb +28 -0
- data/lib/vagrant-parallels/action/set_power_consumption.rb +2 -6
- data/lib/vagrant-parallels/config.rb +6 -0
- data/lib/vagrant-parallels/driver/base.rb +42 -57
- data/lib/vagrant-parallels/driver/meta.rb +4 -5
- data/lib/vagrant-parallels/driver/pd_8.rb +80 -50
- data/lib/vagrant-parallels/driver/pd_9.rb +7 -7
- data/lib/vagrant-parallels/errors.rb +8 -4
- data/lib/vagrant-parallels/guest_cap/linux/install_parallels_tools.rb +53 -0
- data/lib/vagrant-parallels/plugin.rb +7 -2
- data/lib/vagrant-parallels/version.rb +1 -1
- data/locales/en.yml +34 -29
- data/test/unit/driver/pd_8_test.rb +3 -0
- data/test/unit/driver/pd_9_test.rb +3 -0
- data/test/unit/support/shared/pd_driver_examples.rb +33 -9
- metadata +5 -14
- data/lib/vagrant-parallels/action/check_accessible.rb +0 -23
- data/lib/vagrant-parallels/action/check_created.rb +0 -21
- data/lib/vagrant-parallels/action/check_guest_tools.rb +0 -37
- data/lib/vagrant-parallels/action/check_parallels.rb +0 -22
- data/lib/vagrant-parallels/action/check_running.rb +0 -21
- data/lib/vagrant-parallels/action/created.rb +0 -20
- data/lib/vagrant-parallels/action/is_running.rb +0 -20
- data/lib/vagrant-parallels/action/is_suspended.rb +0 -21
- data/lib/vagrant-parallels/action/message_already_running.rb +0 -16
- data/lib/vagrant-parallels/action/message_not_created.rb +0 -16
- data/lib/vagrant-parallels/action/message_not_running.rb +0 -16
- data/lib/vagrant-parallels/action/message_will_not_destroy.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cc269a4cbf2360003f371aca48b009baa72df2f
|
4
|
+
data.tar.gz: 7210ed53e9d14ad25802f462c4a64b29496e23a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99a2c50f43cf9a0ff5505a17a928f9090b2f35b612473d69cf24e86322929f65deeda05c74b3b1bdcf2ac8a2173ff34598a077b154d91f6d2cd49bd701fd4f64
|
7
|
+
data.tar.gz: 1960c6a9e1cf96012aefeb3641a725f63cba7374131bfff6ebf405578c7b800809a8841597cece62bd77158741a52e3e5b99df459dfa0d1f42ddbaef15b99743
|
@@ -11,28 +11,25 @@ module VagrantPlugins
|
|
11
11
|
# a bootup (i.e. not saved).
|
12
12
|
def self.action_boot
|
13
13
|
Vagrant::Action::Builder.new.tap do |b|
|
14
|
-
b.use CheckAccessible
|
15
|
-
b.use SetPowerConsumption
|
16
14
|
b.use SetName
|
17
|
-
# b.use ClearForwardedPorts
|
18
15
|
b.use Provision
|
19
|
-
b.use EnvSet, :port_collision_repair => true
|
20
|
-
# b.use PrepareForwardedPortCollisionParams
|
21
|
-
# b.use HandleForwardedPortCollisions
|
22
16
|
b.use PrepareNFSValidIds
|
23
17
|
b.use SyncedFolderCleanup
|
24
18
|
b.use SyncedFolders
|
25
19
|
b.use PrepareNFSSettings
|
26
20
|
b.use Network
|
27
21
|
b.use ClearNetworkInterfaces
|
28
|
-
# b.use ForwardPorts
|
29
22
|
b.use SetHostname
|
30
|
-
|
23
|
+
b.use Call, IsDriverVersion, '>= 9' do |env1, b1|
|
24
|
+
if env1[:result]
|
25
|
+
b1.use SetPowerConsumption
|
26
|
+
end
|
27
|
+
end
|
31
28
|
b.use Customize, "pre-boot"
|
32
29
|
b.use Boot
|
33
30
|
b.use Customize, "post-boot"
|
34
31
|
b.use WaitForCommunicator, [:starting, :running]
|
35
|
-
b.use
|
32
|
+
b.use HandleGuestTools
|
36
33
|
end
|
37
34
|
end
|
38
35
|
|
@@ -40,26 +37,27 @@ module VagrantPlugins
|
|
40
37
|
# freeing the resources of the underlying virtual machine.
|
41
38
|
def self.action_destroy
|
42
39
|
Vagrant::Action::Builder.new.tap do |b|
|
43
|
-
b.use
|
44
|
-
b.use Call,
|
45
|
-
if
|
46
|
-
|
40
|
+
b.use ConfigValidate
|
41
|
+
b.use Call, IsState, :not_created do |env1, b1|
|
42
|
+
if env1[:result]
|
43
|
+
b1.use Message, I18n.t("vagrant.commands.common.vm_not_created")
|
47
44
|
next
|
48
45
|
end
|
49
46
|
|
50
|
-
|
51
|
-
if env2[:result]
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
b3.use Destroy
|
56
|
-
b3.use DestroyUnusedNetworkInterfaces
|
57
|
-
b3.use ProvisionerCleanup
|
58
|
-
b3.use PrepareNFSValidIds
|
59
|
-
b3.use SyncedFolderCleanup
|
60
|
-
else
|
61
|
-
b3.use MessageWillNotDestroy
|
47
|
+
b1.use Call, DestroyConfirm do |env2, b2|
|
48
|
+
if !env2[:result]
|
49
|
+
b2.use Message, I18n.t("vagrant.commands.destroy.will_not_destroy",
|
50
|
+
:name => env2[:machine].name)
|
51
|
+
next
|
62
52
|
end
|
53
|
+
|
54
|
+
b2.use EnvSet, :force_halt => true
|
55
|
+
b2.use action_halt
|
56
|
+
b2.use Destroy
|
57
|
+
b2.use DestroyUnusedNetworkInterfaces
|
58
|
+
b2.use ProvisionerCleanup
|
59
|
+
b2.use PrepareNFSValidIds
|
60
|
+
b2.use SyncedFolderCleanup
|
63
61
|
end
|
64
62
|
end
|
65
63
|
end
|
@@ -69,23 +67,23 @@ module VagrantPlugins
|
|
69
67
|
# the virtual machine, gracefully or by force.
|
70
68
|
def self.action_halt
|
71
69
|
Vagrant::Action::Builder.new.tap do |b|
|
72
|
-
b.use
|
73
|
-
b.use Call,
|
74
|
-
if
|
75
|
-
|
70
|
+
b.use ConfigValidate
|
71
|
+
b.use Call, IsState, :not_created do |env1, b1|
|
72
|
+
if env1[:result]
|
73
|
+
b1.use Message, I18n.t("vagrant.commands.common.vm_not_created")
|
74
|
+
next
|
75
|
+
end
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
b1.use Call, IsState, :suspended do |env2, b2|
|
78
|
+
if env2[:result]
|
79
|
+
b2.use Resume
|
80
80
|
end
|
81
|
+
end
|
81
82
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
end
|
83
|
+
b1.use Call, GracefulHalt, :stopped, :running do |env2, b2|
|
84
|
+
if !env2[:result]
|
85
|
+
b2.use ForcedHalt
|
86
86
|
end
|
87
|
-
else
|
88
|
-
b2.use MessageNotCreated
|
89
87
|
end
|
90
88
|
end
|
91
89
|
end
|
@@ -94,22 +92,20 @@ module VagrantPlugins
|
|
94
92
|
# This action packages the virtual machine into a single box file.
|
95
93
|
def self.action_package
|
96
94
|
Vagrant::Action::Builder.new.tap do |b|
|
97
|
-
b.use
|
98
|
-
b.use Call,
|
99
|
-
if
|
100
|
-
|
95
|
+
b.use ConfigValidate
|
96
|
+
b.use Call, IsState, :not_created do |env1, b1|
|
97
|
+
if env1[:result]
|
98
|
+
b1.use Message, I18n.t("vagrant.commands.common.vm_not_created")
|
101
99
|
next
|
102
100
|
end
|
103
101
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
b2.use Export
|
112
|
-
b2.use PackageConfigFiles
|
102
|
+
b1.use SetupPackageFiles
|
103
|
+
b1.use action_halt
|
104
|
+
b1.use PrepareNFSValidIds
|
105
|
+
b1.use SyncedFolderCleanup
|
106
|
+
b1.use Package
|
107
|
+
b1.use Export
|
108
|
+
b1.use PackageConfigFiles
|
113
109
|
end
|
114
110
|
end
|
115
111
|
end
|
@@ -117,22 +113,20 @@ module VagrantPlugins
|
|
117
113
|
# This action just runs the provisioners on the machine.
|
118
114
|
def self.action_provision
|
119
115
|
Vagrant::Action::Builder.new.tap do |b|
|
120
|
-
b.use CheckParallels
|
121
116
|
b.use ConfigValidate
|
122
|
-
b.use Call,
|
123
|
-
if
|
124
|
-
|
117
|
+
b.use Call, IsState, :not_created do |env1, b1|
|
118
|
+
if env1[:result]
|
119
|
+
b1.use Message, I18n.t("vagrant.commands.common.vm_not_created")
|
125
120
|
next
|
126
121
|
end
|
127
122
|
|
128
|
-
|
123
|
+
b1.use Call, IsState, :running do |env2, b2|
|
129
124
|
if !env2[:result]
|
130
|
-
|
125
|
+
b2.use Message, I18n.t("vagrant.commands.common.vm_not_running")
|
131
126
|
next
|
132
127
|
end
|
133
128
|
|
134
|
-
|
135
|
-
b3.use Provision
|
129
|
+
b2.use Provision
|
136
130
|
end
|
137
131
|
end
|
138
132
|
end
|
@@ -143,16 +137,15 @@ module VagrantPlugins
|
|
143
137
|
# machine back up with the new configuration.
|
144
138
|
def self.action_reload
|
145
139
|
Vagrant::Action::Builder.new.tap do |b|
|
146
|
-
b.use
|
147
|
-
b.use Call,
|
148
|
-
if
|
149
|
-
|
140
|
+
b.use ConfigValidate
|
141
|
+
b.use Call, IsState, :not_created do |env1, b1|
|
142
|
+
if env1[:result]
|
143
|
+
b1.use Message, I18n.t("vagrant.commands.common.vm_not_created")
|
150
144
|
next
|
151
145
|
end
|
152
146
|
|
153
|
-
|
154
|
-
|
155
|
-
b2.use action_start
|
147
|
+
b1.use action_halt
|
148
|
+
b1.use action_start
|
156
149
|
end
|
157
150
|
end
|
158
151
|
end
|
@@ -161,16 +154,15 @@ module VagrantPlugins
|
|
161
154
|
# suspended machines.
|
162
155
|
def self.action_resume
|
163
156
|
Vagrant::Action::Builder.new.tap do |b|
|
164
|
-
b.use
|
165
|
-
b.use Call,
|
166
|
-
if
|
167
|
-
|
168
|
-
|
169
|
-
b2.use Resume
|
170
|
-
b2.use WaitForCommunicator, [:resuming, :running]
|
171
|
-
else
|
172
|
-
b2.use MessageNotCreated
|
157
|
+
b.use ConfigValidate
|
158
|
+
b.use Call, IsState, :not_created do |env1, b1|
|
159
|
+
if env1[:result]
|
160
|
+
b1.use Message, I18n.t("vagrant.commands.common.vm_not_created")
|
161
|
+
next
|
173
162
|
end
|
163
|
+
|
164
|
+
b1.use Resume
|
165
|
+
b1.use WaitForCommunicator, [:resuming, :running]
|
174
166
|
end
|
175
167
|
end
|
176
168
|
end
|
@@ -178,22 +170,44 @@ module VagrantPlugins
|
|
178
170
|
# This is the action that will exec into an SSH shell.
|
179
171
|
def self.action_ssh
|
180
172
|
Vagrant::Action::Builder.new.tap do |b|
|
181
|
-
b.use
|
182
|
-
b.use
|
183
|
-
|
184
|
-
|
185
|
-
|
173
|
+
b.use ConfigValidate
|
174
|
+
b.use Call, IsState, :not_created do |env1, b1|
|
175
|
+
if env1[:result]
|
176
|
+
b1.use Message, I18n.t("vagrant.commands.common.vm_not_created")
|
177
|
+
next
|
178
|
+
end
|
179
|
+
|
180
|
+
b1.use Call, IsState, :running do |env2, b2|
|
181
|
+
if !env2[:result]
|
182
|
+
b2.use Message, I18n.t("vagrant.commands.common.vm_not_running")
|
183
|
+
next
|
184
|
+
end
|
185
|
+
|
186
|
+
b2.use SSHExec
|
187
|
+
end
|
188
|
+
end
|
186
189
|
end
|
187
190
|
end
|
188
191
|
|
189
192
|
# This is the action that will run a single SSH command.
|
190
193
|
def self.action_ssh_run
|
191
194
|
Vagrant::Action::Builder.new.tap do |b|
|
192
|
-
b.use
|
193
|
-
b.use
|
194
|
-
|
195
|
-
|
196
|
-
|
195
|
+
b.use ConfigValidate
|
196
|
+
b.use Call, IsState, :not_created do |env1, b1|
|
197
|
+
if env1[:result]
|
198
|
+
b1.use Message, I18n.t("vagrant.commands.common.vm_not_created")
|
199
|
+
next
|
200
|
+
end
|
201
|
+
|
202
|
+
b1.use Call, IsState, :running do |env2, b2|
|
203
|
+
if !env2[:result]
|
204
|
+
b2.use Message, I18n.t("vagrant.commands.common.vm_not_running")
|
205
|
+
next
|
206
|
+
end
|
207
|
+
|
208
|
+
b2.use SSHRun
|
209
|
+
end
|
210
|
+
end
|
197
211
|
end
|
198
212
|
end
|
199
213
|
|
@@ -201,26 +215,24 @@ module VagrantPlugins
|
|
201
215
|
# A precondition of this action is that the VM exists.
|
202
216
|
def self.action_start
|
203
217
|
Vagrant::Action::Builder.new.tap do |b|
|
204
|
-
b.use CheckParallels
|
205
|
-
b.use ConfigValidate
|
206
218
|
b.use BoxCheckOutdated
|
207
|
-
b.use Call,
|
219
|
+
b.use Call, IsState, :running do |env1, b1|
|
208
220
|
# If the VM is running, then our work here is done, exit
|
209
|
-
if
|
210
|
-
|
221
|
+
if env1[:result]
|
222
|
+
b1.use Message, I18n.t("vagrant_parallels.commands.common.vm_already_running")
|
211
223
|
next
|
212
224
|
end
|
213
225
|
|
214
|
-
|
226
|
+
b1.use Call, IsState, :suspended do |env2, b2|
|
215
227
|
if env2[:result]
|
216
228
|
# The VM is suspended, so just resume it
|
217
|
-
|
229
|
+
b2.use action_resume
|
218
230
|
next
|
219
231
|
end
|
220
232
|
|
221
233
|
# The VM is not saved, so we must have to boot it up
|
222
234
|
# like normal. Boot!
|
223
|
-
|
235
|
+
b2.use action_boot
|
224
236
|
end
|
225
237
|
end
|
226
238
|
end
|
@@ -230,14 +242,14 @@ module VagrantPlugins
|
|
230
242
|
# the virtual machine.
|
231
243
|
def self.action_suspend
|
232
244
|
Vagrant::Action::Builder.new.tap do |b|
|
233
|
-
b.use
|
234
|
-
b.use Call,
|
235
|
-
if
|
236
|
-
|
237
|
-
|
238
|
-
else
|
239
|
-
b2.use MessageNotCreated
|
245
|
+
b.use ConfigValidate
|
246
|
+
b.use Call, IsState, :not_created do |env1, b1|
|
247
|
+
if env1[:result]
|
248
|
+
b1.use Message, I18n.t("vagrant.commands.common.vm_not_created")
|
249
|
+
next
|
240
250
|
end
|
251
|
+
|
252
|
+
b1.use Suspend
|
241
253
|
end
|
242
254
|
end
|
243
255
|
end
|
@@ -246,24 +258,21 @@ module VagrantPlugins
|
|
246
258
|
# the box, configuring metadata, and booting.
|
247
259
|
def self.action_up
|
248
260
|
Vagrant::Action::Builder.new.tap do |b|
|
249
|
-
b.use CheckParallels
|
250
|
-
|
251
261
|
# Handle box_url downloading early so that if the Vagrantfile
|
252
262
|
# references any files in the box or something it all just
|
253
263
|
# works fine.
|
254
|
-
b.use Call,
|
255
|
-
if
|
256
|
-
|
264
|
+
b.use Call, IsState, :not_created do |env1, b1|
|
265
|
+
if env1[:result]
|
266
|
+
b1.use HandleBox
|
257
267
|
end
|
258
268
|
end
|
259
269
|
|
260
270
|
b.use ConfigValidate
|
261
|
-
b.use Call,
|
271
|
+
b.use Call, IsState, :not_created do |env1, b1|
|
262
272
|
# If the VM is NOT created yet, then do the setup steps
|
263
|
-
if
|
264
|
-
|
265
|
-
|
266
|
-
b2.use Import
|
273
|
+
if env1[:result]
|
274
|
+
b1.use Customize, "pre-import"
|
275
|
+
b1.use Import
|
267
276
|
end
|
268
277
|
end
|
269
278
|
b.use action_start
|
@@ -271,25 +280,15 @@ module VagrantPlugins
|
|
271
280
|
end
|
272
281
|
|
273
282
|
autoload :Boot, File.expand_path("../action/boot", __FILE__)
|
274
|
-
autoload :
|
275
|
-
autoload :CheckCreated, File.expand_path("../action/check_created", __FILE__)
|
276
|
-
autoload :CheckGuestTools, File.expand_path("../action/check_guest_tools", __FILE__)
|
277
|
-
autoload :CheckParallels, File.expand_path("../action/check_parallels", __FILE__)
|
278
|
-
autoload :CheckRunning, File.expand_path("../action/check_running", __FILE__)
|
283
|
+
autoload :HandleGuestTools, File.expand_path("../action/handle_guest_tools", __FILE__)
|
279
284
|
autoload :ClearNetworkInterfaces, File.expand_path("../action/clear_network_interfaces", __FILE__)
|
280
|
-
autoload :Created, File.expand_path("../action/created", __FILE__)
|
281
285
|
autoload :Customize, File.expand_path("../action/customize", __FILE__)
|
282
286
|
autoload :Destroy, File.expand_path("../action/destroy", __FILE__)
|
283
287
|
autoload :DestroyUnusedNetworkInterfaces, File.expand_path("../action/destroy_unused_network_interfaces", __FILE__)
|
284
288
|
autoload :Export, File.expand_path("../action/export", __FILE__)
|
285
289
|
autoload :ForcedHalt, File.expand_path("../action/forced_halt", __FILE__)
|
286
290
|
autoload :Import, File.expand_path("../action/import", __FILE__)
|
287
|
-
autoload :
|
288
|
-
autoload :IsRunning, File.expand_path("../action/is_running", __FILE__)
|
289
|
-
autoload :MessageAlreadyRunning, File.expand_path("../action/message_already_running", __FILE__)
|
290
|
-
autoload :MessageNotCreated, File.expand_path("../action/message_not_created", __FILE__)
|
291
|
-
autoload :MessageNotRunning, File.expand_path("../action/message_not_running", __FILE__)
|
292
|
-
autoload :MessageWillNotDestroy, File.expand_path("../action/message_will_not_destroy", __FILE__)
|
291
|
+
autoload :IsDriverVersion, File.expand_path("../action/is_driver_version", __FILE__)
|
293
292
|
autoload :Network, File.expand_path("../action/network", __FILE__)
|
294
293
|
autoload :Package, File.expand_path("../action/package", __FILE__)
|
295
294
|
autoload :PackageConfigFiles, File.expand_path("../action/package_config_files", __FILE__)
|
@@ -26,9 +26,8 @@ module VagrantPlugins
|
|
26
26
|
end
|
27
27
|
|
28
28
|
begin
|
29
|
-
env[:machine].provider.driver.
|
30
|
-
|
31
|
-
rescue VagrantPlugins::Parallels::Errors::PrlCtlError => e
|
29
|
+
env[:machine].provider.driver.execute_prlctl(*processed_command)
|
30
|
+
rescue VagrantPlugins::Parallels::Errors::ExecutionError => e
|
32
31
|
raise Vagrant::Errors::VMCustomizationFailed, {
|
33
32
|
:command => command,
|
34
33
|
:error => e.inspect
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Parallels
|
3
|
+
module Action
|
4
|
+
class HandleGuestTools
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
@logger = Log4r::Logger.new("vagrant::plugins::parallels::handle_guest_tools")
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(env)
|
11
|
+
@machine = env[:machine]
|
12
|
+
|
13
|
+
if !@machine.provider_config.check_guest_tools
|
14
|
+
@logger.info("Not checking Parallels Tools because of configuration")
|
15
|
+
return @app.call(env)
|
16
|
+
end
|
17
|
+
|
18
|
+
env[:ui].output(I18n.t("vagrant_parallels.actions.vm.handle_guest_tools.checking"))
|
19
|
+
|
20
|
+
tools_state = @machine.provider.driver.read_guest_tools_state
|
21
|
+
|
22
|
+
if tools_state == :installed
|
23
|
+
@logger.info("The proper version of Parallels Tools is already installed")
|
24
|
+
return @app.call(env)
|
25
|
+
elsif tools_state == :outdated
|
26
|
+
env[:ui].warn(I18n.t("vagrant_parallels.actions.vm.handle_guest_tools.outdated"))
|
27
|
+
else
|
28
|
+
env[:ui].warn(I18n.t("vagrant_parallels.actions.vm.handle_guest_tools.not_detected"))
|
29
|
+
end
|
30
|
+
|
31
|
+
if !@machine.provider_config.update_guest_tools
|
32
|
+
@logger.info("Not updating Parallels Tools because of configuration")
|
33
|
+
return @app.call(env)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Update/Install Parallels Tools
|
37
|
+
if @machine.guest.capability?(:install_parallels_tools)
|
38
|
+
env[:ui].output(I18n.t("vagrant_parallels.actions.vm.handle_guest_tools.installing"))
|
39
|
+
@machine.guest.capability(:install_parallels_tools)
|
40
|
+
else
|
41
|
+
env[:ui].warn(I18n.t("vagrant_parallels.actions.vm.handle_guest_tools.cant_install"))
|
42
|
+
end
|
43
|
+
|
44
|
+
# Continue
|
45
|
+
@app.call(env)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|