vagrant-parallels 1.1.0 → 1.2.0.rc1
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/CONTRIBUTING.md +61 -0
- data/README.md +2 -57
- data/lib/vagrant-parallels/action/clear_forwarded_ports.rb +25 -0
- data/lib/vagrant-parallels/action/customize.rb +2 -2
- data/lib/vagrant-parallels/action/export.rb +1 -1
- data/lib/vagrant-parallels/action/forward_ports.rb +78 -0
- data/lib/vagrant-parallels/action/handle_guest_tools.rb +1 -1
- data/lib/vagrant-parallels/action/import.rb +1 -1
- data/lib/vagrant-parallels/action/network.rb +47 -47
- data/lib/vagrant-parallels/action/prepare_forwarded_port_collision_params.rb +41 -0
- data/lib/vagrant-parallels/action/prepare_nfs_settings.rb +1 -1
- data/lib/vagrant-parallels/action/prepare_nfs_valid_ids.rb +1 -1
- data/lib/vagrant-parallels/action/sane_defaults.rb +55 -0
- data/lib/vagrant-parallels/action/set_name.rb +1 -1
- data/lib/vagrant-parallels/action/setup_package_files.rb +0 -1
- data/lib/vagrant-parallels/action.rb +16 -7
- data/lib/vagrant-parallels/cap/forwarded_ports.rb +22 -0
- data/lib/vagrant-parallels/driver/base.rb +8 -16
- data/lib/vagrant-parallels/driver/meta.rb +7 -7
- data/lib/vagrant-parallels/driver/pd_10.rb +279 -0
- data/lib/vagrant-parallels/driver/pd_8.rb +23 -15
- data/lib/vagrant-parallels/driver/pd_9.rb +1 -1
- data/lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb +78 -22
- data/lib/vagrant-parallels/model/forwarded_port.rb +52 -0
- data/lib/vagrant-parallels/plugin.rb +14 -0
- data/lib/vagrant-parallels/provider.rb +12 -3
- data/lib/vagrant-parallels/synced_folder.rb +6 -1
- data/lib/vagrant-parallels/util/compile_forwarded_ports.rb +35 -0
- data/lib/vagrant-parallels/version.rb +1 -1
- data/locales/en.yml +3 -0
- data/test/unit/driver/pd_10_test.rb +228 -0
- data/test/unit/driver/pd_8_test.rb +27 -7
- data/test/unit/driver/pd_9_test.rb +28 -7
- data/test/unit/support/shared/parallels_context.rb +5 -4
- data/test/unit/support/shared/pd_driver_examples.rb +16 -37
- metadata +35 -27
- data/lib/vagrant-parallels/action/is_driver_version.rb +0 -28
- data/lib/vagrant-parallels/action/set_power_consumption.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fc01455732e664712d913020806753766fa2c11
|
4
|
+
data.tar.gz: 83d9a5723aacfb1c01cbf210bc97aea553c87b44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8565bde8a49ec3bf398be9a0c11a5e22ccb21286780d919fd5cd8cd63bbbf2d21373446a4be3640ecd3d0bea7ff9731114c6f3ef611049db4acd56f81cbd504
|
7
|
+
data.tar.gz: ce70eee926a912ca2460fcbcea90078360385d26730f9c4d57f22f0a6a756b71f653432b921adbbcae403a5a7392f52a1eceb0e7669883ec890d94cd471619e6
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
## How to contribute
|
2
|
+
|
3
|
+
We are glad you want to contribute to the `vagrant-parallels` plugin!
|
4
|
+
First of all, clone this repository:
|
5
|
+
|
6
|
+
```
|
7
|
+
$ git clone https://github.com/Parallels/vagrant-parallels
|
8
|
+
$ cd vagrant-parallels
|
9
|
+
```
|
10
|
+
|
11
|
+
### Dependencies and Unit Tests
|
12
|
+
|
13
|
+
To hack on our plugin, you'll need a [Ruby interpreter](https://www.ruby-lang.org/en/downloads/)
|
14
|
+
(>= 2.0) and [Bundler](http://bundler.io/) which can be installed with a simple
|
15
|
+
`gem install bundler`. Afterwards, do the following:
|
16
|
+
|
17
|
+
```
|
18
|
+
$ bundle install
|
19
|
+
$ rake
|
20
|
+
```
|
21
|
+
|
22
|
+
This will run the unit test suite, which should come back all green!
|
23
|
+
Then you're good to go!
|
24
|
+
|
25
|
+
If you want to run Vagrant without having to install the `vagrant-parallels`
|
26
|
+
gem, you may use `bundle exec`, like so:
|
27
|
+
|
28
|
+
```
|
29
|
+
$ bundle exec vagrant up --provider=parallels
|
30
|
+
```
|
31
|
+
|
32
|
+
### Building Provider from Source
|
33
|
+
To build a `vagrant-parallels` gem just run this command:
|
34
|
+
|
35
|
+
```
|
36
|
+
$ rake build
|
37
|
+
```
|
38
|
+
|
39
|
+
The built "gem" package will appear in the `./pkg` folder.
|
40
|
+
|
41
|
+
Then, if you want to install plugin from your locally built "gem", use the
|
42
|
+
following commands:
|
43
|
+
|
44
|
+
```
|
45
|
+
$ vagrant plugin uninstall vagrant-parallels
|
46
|
+
$ vagrant plugin install pkg/vagrant-parallels-<version>.gem
|
47
|
+
```
|
48
|
+
|
49
|
+
Now that you have your own plugin installed, check it with the command
|
50
|
+
`vagrant plugin list`
|
51
|
+
|
52
|
+
### Sending a Pull Request
|
53
|
+
If you're ready to send your changes, please follow the next steps:
|
54
|
+
|
55
|
+
1. Fork the 'vagrant-parallels' repository and ad it as a new remote (`git add
|
56
|
+
remote my-fork <fork_url>`)
|
57
|
+
2. Create a branch (`git checkout -b my-new-feature`)
|
58
|
+
3. Commit your changes (`git commit -am "Added a sweet feature"`)
|
59
|
+
4. Push the branch to your fork (`git push fork my-new-feature`)
|
60
|
+
5. Create a pull request from your `my-new-feature` branch into `master` of
|
61
|
+
`vagrant-parallels` repo
|
data/README.md
CHANGED
@@ -42,64 +42,9 @@ We recommend you to start from these pages:
|
|
42
42
|
* [Getting Started](http://parallels.github.io/vagrant-parallels/docs/getting-started.html)
|
43
43
|
* [Boxes](http://parallels.github.io/vagrant-parallels/docs/boxes/index.html)
|
44
44
|
|
45
|
-
## Contributing to the Parallels Provider
|
46
|
-
|
47
|
-
To work on the `vagrant-parallels` plugin development, clone this repository:
|
48
|
-
|
49
|
-
```
|
50
|
-
$ git clone https://github.com/Parallels/vagrant-parallels
|
51
|
-
$ cd vagrant-parallels
|
52
|
-
```
|
53
|
-
|
54
|
-
Use [Bundler](http://bundler.io/) to get the dependencies (Ruby 2.0 is needed)
|
55
|
-
and rake to run the unit test suit:
|
56
|
-
|
57
|
-
```
|
58
|
-
$ bundle install
|
59
|
-
$ rake
|
60
|
-
```
|
61
|
-
|
62
|
-
If it passes successfully, you're ready to start developing the plugin. Use
|
63
|
-
bundler to execute Vagrant and test the plugin without installing:
|
64
|
-
|
65
|
-
```
|
66
|
-
$ bundle exec vagrant up --provider=parallels
|
67
|
-
```
|
68
|
-
|
69
|
-
### Building Provider from Source
|
70
|
-
To build a `vagrant-parallels` gem just run this command:
|
71
|
-
|
72
|
-
```
|
73
|
-
$ rake build
|
74
|
-
```
|
75
|
-
|
76
|
-
The built "gem" package will appear in the `./pkg` folder.
|
77
|
-
|
78
|
-
Then, if you want to install plugin from your locally built "gem", use the
|
79
|
-
following commands:
|
80
|
-
|
81
|
-
```
|
82
|
-
$ vagrant plugin uninstall vagrant-parallels
|
83
|
-
$ vagrant plugin install pkg/vagrant-parallels-<version>.gem
|
84
|
-
```
|
85
|
-
|
86
|
-
Now that you have your own plugin installed, check it with the command
|
87
|
-
`vagrant plugin list`
|
88
|
-
|
89
|
-
### Sending a Pull Request
|
90
|
-
If you're ready to send your changes, please follow the next steps:
|
91
|
-
|
92
|
-
1. Fork the 'vagrant-parallels' repository and ad it as a new remote (`git add
|
93
|
-
remote my-fork <fork_url>`)
|
94
|
-
2. Create a branch (`git checkout -b my-new-feature`)
|
95
|
-
3. Commit your changes (`git commit -am "Added a sweet feature"`)
|
96
|
-
4. Push the branch to your fork (`git push fork my-new-feature`)
|
97
|
-
5. Create a pull request from your `my-new-feature` branch into `master` of
|
98
|
-
`vagrant-parallels` repo
|
99
|
-
|
100
45
|
## Getting Help
|
101
|
-
Having problems while using the provider? Ask your question
|
102
|
-
[
|
46
|
+
Having problems while using the provider? Ask your question on the official forum:
|
47
|
+
["Parallels Provider for Vagrant" forum branch](http://forum.parallels.com/forumdisplay.php?737-Parallels-Provider-for-Vagrant)
|
103
48
|
|
104
49
|
If you get an error while using the Parallels provider or discover a bug,
|
105
50
|
please report it on the [IssueTracker](https://github.com/Parallels/vagrant-parallels).
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Parallels
|
3
|
+
module Action
|
4
|
+
class ClearForwardedPorts
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
# Port Forwarding feature is available only with PD >= 10
|
11
|
+
if !env[:machine].provider.pd_version_satisfies?('>= 10')
|
12
|
+
return @app.call(env)
|
13
|
+
end
|
14
|
+
|
15
|
+
if !env[:machine].provider.driver.read_forwarded_ports.empty?
|
16
|
+
env[:ui].info I18n.t('vagrant.actions.vm.clear_forward_ports.deleting')
|
17
|
+
env[:machine].provider.driver.clear_forwarded_ports
|
18
|
+
end
|
19
|
+
|
20
|
+
@app.call(env)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -29,8 +29,8 @@ module VagrantPlugins
|
|
29
29
|
env[:machine].provider.driver.execute_prlctl(*processed_command)
|
30
30
|
rescue VagrantPlugins::Parallels::Errors::ExecutionError => e
|
31
31
|
raise Vagrant::Errors::VMCustomizationFailed, {
|
32
|
-
:
|
33
|
-
:
|
32
|
+
command: command,
|
33
|
+
error: e.inspect
|
34
34
|
}
|
35
35
|
end
|
36
36
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Parallels
|
3
|
+
module Action
|
4
|
+
class ForwardPorts
|
5
|
+
include Util::CompileForwardedPorts
|
6
|
+
|
7
|
+
def initialize(app, env)
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
|
11
|
+
#--------------------------------------------------------------
|
12
|
+
# Execution
|
13
|
+
#--------------------------------------------------------------
|
14
|
+
def call(env)
|
15
|
+
# Port Forwarding feature is available only with PD >= 10
|
16
|
+
if !env[:machine].provider.pd_version_satisfies?('>= 10')
|
17
|
+
return @app.call(env)
|
18
|
+
end
|
19
|
+
|
20
|
+
@env = env
|
21
|
+
|
22
|
+
# Get the ports we're forwarding
|
23
|
+
env[:forwarded_ports] ||= compile_forwarded_ports(env[:machine].config)
|
24
|
+
env[:ui].output(I18n.t('vagrant.actions.vm.forward_ports.forwarding'))
|
25
|
+
forward_ports
|
26
|
+
|
27
|
+
@app.call(env)
|
28
|
+
end
|
29
|
+
|
30
|
+
def forward_ports
|
31
|
+
ports = []
|
32
|
+
|
33
|
+
@env[:forwarded_ports].each do |fp|
|
34
|
+
message_attributes = {
|
35
|
+
guest_port: fp.guest_port,
|
36
|
+
host_port: fp.host_port
|
37
|
+
}
|
38
|
+
|
39
|
+
# Assuming the only reason to establish port forwarding is
|
40
|
+
# because the VM is using Shared networking. Host-only and
|
41
|
+
# bridged networking don't require port-forwarding and establishing
|
42
|
+
# forwarded ports on these attachment types has uncertain behaviour.
|
43
|
+
@env[:ui].detail(I18n.t("vagrant_parallels.actions.vm.forward_ports.forwarding_entry",
|
44
|
+
message_attributes))
|
45
|
+
|
46
|
+
# Add the options to the ports array to send to the driver later
|
47
|
+
ports << {
|
48
|
+
guestport: fp.guest_port,
|
49
|
+
hostport: fp.host_port,
|
50
|
+
name: get_unique_name(fp.id),
|
51
|
+
protocol: fp.protocol
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
if !ports.empty?
|
56
|
+
# We only need to forward ports if there are any to forward
|
57
|
+
@env[:machine].provider.driver.forward_ports(ports)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def get_unique_name(id)
|
64
|
+
all_rules = @env[:machine].provider.driver.read_forwarded_ports(true)
|
65
|
+
names_in_use = all_rules.collect { |r| r[:rule_name] }
|
66
|
+
|
67
|
+
# Append random suffix to get unique rule name
|
68
|
+
while names_in_use.include?(id)
|
69
|
+
suffix = (0...4).map { ('a'..'z').to_a[rand(26)] }.join
|
70
|
+
id = "#{id}_#{suffix}"
|
71
|
+
end
|
72
|
+
|
73
|
+
id
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -4,7 +4,7 @@ module VagrantPlugins
|
|
4
4
|
class HandleGuestTools
|
5
5
|
def initialize(app, env)
|
6
6
|
@app = app
|
7
|
-
@logger = Log4r::Logger.new(
|
7
|
+
@logger = Log4r::Logger.new('vagrant_parallels::action::handle_guest_tools')
|
8
8
|
end
|
9
9
|
|
10
10
|
def call(env)
|
@@ -19,7 +19,7 @@ module VagrantPlugins
|
|
19
19
|
|
20
20
|
def initialize(app, env)
|
21
21
|
@app = app
|
22
|
-
@logger = Log4r::Logger.new(
|
22
|
+
@logger = Log4r::Logger.new('vagrant_parallels::action::network')
|
23
23
|
end
|
24
24
|
|
25
25
|
def call(env)
|
@@ -131,11 +131,11 @@ module VagrantPlugins
|
|
131
131
|
|
132
132
|
def bridged_config(options)
|
133
133
|
return {
|
134
|
-
:
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:
|
138
|
-
:
|
134
|
+
auto_config: true,
|
135
|
+
bridge: nil,
|
136
|
+
mac: nil,
|
137
|
+
nic_type: nil,
|
138
|
+
use_dhcp_assigned_default_route: false
|
139
139
|
}.merge(options || {})
|
140
140
|
end
|
141
141
|
|
@@ -204,39 +204,39 @@ module VagrantPlugins
|
|
204
204
|
|
205
205
|
# Given the choice we can now define the adapter we're using
|
206
206
|
return {
|
207
|
-
:
|
208
|
-
:
|
209
|
-
:
|
210
|
-
:
|
211
|
-
:
|
207
|
+
adapter: config[:adapter],
|
208
|
+
type: :bridged,
|
209
|
+
bridge: chosen_bridge,
|
210
|
+
mac_address: config[:mac],
|
211
|
+
nic_type: config[:nic_type]
|
212
212
|
}
|
213
213
|
end
|
214
214
|
|
215
215
|
def bridged_network_config(config)
|
216
216
|
if config[:ip]
|
217
217
|
options = {
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
218
|
+
auto_config: true,
|
219
|
+
mac: nil,
|
220
|
+
netmask: "255.255.255.0",
|
221
|
+
type: :static
|
222
222
|
}.merge(config)
|
223
223
|
options[:type] = options[:type].to_sym
|
224
224
|
return options
|
225
225
|
end
|
226
226
|
|
227
227
|
return {
|
228
|
-
|
229
|
-
:
|
228
|
+
type: :dhcp,
|
229
|
+
use_dhcp_assigned_default_route: config[:use_dhcp_assigned_default_route]
|
230
230
|
}
|
231
231
|
end
|
232
232
|
|
233
233
|
def hostonly_config(options)
|
234
234
|
options = {
|
235
|
-
:
|
236
|
-
:
|
237
|
-
:
|
238
|
-
:
|
239
|
-
:
|
235
|
+
auto_config: true,
|
236
|
+
mac: nil,
|
237
|
+
nic_type: nil,
|
238
|
+
netmask: "255.255.255.0",
|
239
|
+
type: :static
|
240
240
|
}.merge(options)
|
241
241
|
|
242
242
|
# Make sure the type is a symbol
|
@@ -289,13 +289,13 @@ module VagrantPlugins
|
|
289
289
|
end
|
290
290
|
|
291
291
|
return {
|
292
|
-
:
|
293
|
-
:
|
294
|
-
:
|
295
|
-
:
|
296
|
-
:
|
297
|
-
:
|
298
|
-
:
|
292
|
+
adapter_ip: options[:adapter_ip],
|
293
|
+
auto_config: options[:auto_config],
|
294
|
+
ip: options[:ip],
|
295
|
+
mac: options[:mac],
|
296
|
+
netmask: options[:netmask],
|
297
|
+
nic_type: options[:nic_type],
|
298
|
+
type: options[:type]
|
299
299
|
}.merge(dhcp_options)
|
300
300
|
end
|
301
301
|
|
@@ -318,34 +318,34 @@ module VagrantPlugins
|
|
318
318
|
end
|
319
319
|
|
320
320
|
return {
|
321
|
-
:
|
322
|
-
:
|
323
|
-
:
|
324
|
-
:
|
325
|
-
:
|
321
|
+
adapter: config[:adapter],
|
322
|
+
hostonly: interface[:name],
|
323
|
+
mac_address: config[:mac],
|
324
|
+
nic_type: config[:nic_type],
|
325
|
+
type: :hostonly
|
326
326
|
}
|
327
327
|
end
|
328
328
|
|
329
329
|
def hostonly_network_config(config)
|
330
330
|
return {
|
331
|
-
:
|
332
|
-
:
|
333
|
-
:
|
334
|
-
:
|
331
|
+
type: config[:type],
|
332
|
+
adapter_ip: config[:adapter_ip],
|
333
|
+
ip: config[:ip],
|
334
|
+
netmask: config[:netmask]
|
335
335
|
}
|
336
336
|
end
|
337
337
|
|
338
338
|
|
339
339
|
def shared_config(options)
|
340
340
|
return {
|
341
|
-
:
|
341
|
+
auto_config: false
|
342
342
|
}
|
343
343
|
end
|
344
344
|
|
345
345
|
def shared_adapter(config)
|
346
346
|
return {
|
347
|
-
:
|
348
|
-
:
|
347
|
+
adapter: config[:adapter],
|
348
|
+
type: :shared
|
349
349
|
}
|
350
350
|
end
|
351
351
|
|
@@ -414,16 +414,16 @@ module VagrantPlugins
|
|
414
414
|
# This creates a host only network for the given configuration.
|
415
415
|
def hostonly_create_network(config)
|
416
416
|
options = {
|
417
|
-
|
418
|
-
|
419
|
-
|
417
|
+
network_id: next_network_id,
|
418
|
+
adapter_ip: config[:adapter_ip],
|
419
|
+
netmask: config[:netmask],
|
420
420
|
}
|
421
421
|
|
422
422
|
if config[:type] == :dhcp
|
423
423
|
options[:dhcp] = {
|
424
|
-
|
425
|
-
|
426
|
-
|
424
|
+
ip: config[:dhcp_ip],
|
425
|
+
lower: config[:dhcp_lower],
|
426
|
+
upper: config[:dhcp_upper]
|
427
427
|
}
|
428
428
|
end
|
429
429
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Parallels
|
3
|
+
module Action
|
4
|
+
class PrepareForwardedPortCollisionParams
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
# Port Forwarding feature is available only with PD >= 10
|
11
|
+
if !env[:machine].provider.pd_version_satisfies?('>= 10')
|
12
|
+
return @app.call(env)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get the forwarded ports used by other virtual machines and
|
16
|
+
# consider those in use as well.
|
17
|
+
env[:port_collision_extra_in_use] =
|
18
|
+
env[:machine].provider.driver.read_used_ports
|
19
|
+
|
20
|
+
# Build the remap for any existing collision detections
|
21
|
+
remap = {}
|
22
|
+
env[:port_collision_remap] = remap
|
23
|
+
env[:machine].provider.driver.read_forwarded_ports.each do |r|
|
24
|
+
env[:machine].config.vm.networks.each do |type, options|
|
25
|
+
next if type != :forwarded_port
|
26
|
+
|
27
|
+
# If the ID matches the name of the forwarded port, then
|
28
|
+
# remap.
|
29
|
+
if options[:id] == r[:name]
|
30
|
+
remap[options[:host]] = r[:hostport]
|
31
|
+
break
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
@app.call(env)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'log4r'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module Parallels
|
5
|
+
module Action
|
6
|
+
class SaneDefaults
|
7
|
+
def initialize(app, env)
|
8
|
+
@logger = Log4r::Logger.new('vagrant_parallels::action::sanedefaults')
|
9
|
+
@app = app
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(env)
|
13
|
+
# Set the env on an instance variable so we can access it in
|
14
|
+
# helpers.
|
15
|
+
@env = env
|
16
|
+
|
17
|
+
# Disable requiring password on such operations as creating, adding,
|
18
|
+
# removing or coning the virtual machine. [GH-67]
|
19
|
+
# It is available only since PD 10.
|
20
|
+
if env[:machine].provider.pd_version_satisfies?('>= 10')
|
21
|
+
@logger.info('Disabling any password restrictions...')
|
22
|
+
env[:machine].provider.driver.disable_password_restrictions
|
23
|
+
end
|
24
|
+
|
25
|
+
if env[:machine].provider.pd_version_satisfies?('>= 9')
|
26
|
+
@logger.info('Setting the power consumption mode...')
|
27
|
+
set_power_consumption
|
28
|
+
end
|
29
|
+
|
30
|
+
@app.call(env)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def set_power_consumption
|
36
|
+
# Optimization of power consumption is defined by "Longer Battery Life" state.
|
37
|
+
vm_settings = @env[:machine].provider.driver.read_settings
|
38
|
+
|
39
|
+
old_val = vm_settings.fetch('Longer battery life') == 'on' ? true : false
|
40
|
+
new_val = @env[:machine].provider_config.optimize_power_consumption
|
41
|
+
|
42
|
+
if old_val == new_val
|
43
|
+
@logger.info('Skipping power consumption method because it is already set')
|
44
|
+
else
|
45
|
+
mode = new_val ? 'Longer battery life' : 'Better Performance'
|
46
|
+
@env[:ui].info I18n.t('vagrant_parallels.parallels.power_consumption.set_mode',
|
47
|
+
mode: mode)
|
48
|
+
@env[:machine].provider.driver.set_power_consumption_mode(new_val)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -13,7 +13,6 @@ module VagrantPlugins
|
|
13
13
|
files = {}
|
14
14
|
env["package.include"].each do |file|
|
15
15
|
source = Pathname.new(file)
|
16
|
-
dest = nil
|
17
16
|
|
18
17
|
# If the source is relative then we add the file as-is to the include
|
19
18
|
# directory. Otherwise, we copy only the file into the root of the
|