vagrant-parallels 1.4.3 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/debug.log +1 -5433
- data/lib/vagrant-parallels/action.rb +1 -1
- data/lib/vagrant-parallels/action/destroy.rb +8 -0
- data/lib/vagrant-parallels/action/import.rb +8 -0
- data/lib/vagrant-parallels/action/sane_defaults.rb +40 -22
- data/lib/vagrant-parallels/config.rb +4 -4
- data/lib/vagrant-parallels/driver/base.rb +10 -2
- data/lib/vagrant-parallels/driver/pd_10.rb +2 -2
- data/lib/vagrant-parallels/version.rb +1 -1
- data/locales/en.yml +13 -3
- metadata +2 -2
@@ -24,7 +24,6 @@ module VagrantPlugins
|
|
24
24
|
b.use ClearNetworkInterfaces
|
25
25
|
b.use ForwardPorts
|
26
26
|
b.use SetHostname
|
27
|
-
b.use SaneDefaults
|
28
27
|
b.use Customize, 'pre-boot'
|
29
28
|
b.use Boot
|
30
29
|
b.use Customize, 'post-boot'
|
@@ -278,6 +277,7 @@ module VagrantPlugins
|
|
278
277
|
if env1[:result]
|
279
278
|
b1.use Customize, 'pre-import'
|
280
279
|
b1.use Import
|
280
|
+
b1.use SaneDefaults
|
281
281
|
b1.use Customize, 'post-import'
|
282
282
|
end
|
283
283
|
end
|
@@ -4,9 +4,17 @@ module VagrantPlugins
|
|
4
4
|
class Destroy
|
5
5
|
def initialize(app, env)
|
6
6
|
@app = app
|
7
|
+
@logger = Log4r::Logger.new('vagrant_parallels::action::destroy')
|
7
8
|
end
|
8
9
|
|
9
10
|
def call(env)
|
11
|
+
# Disable requiring password for delete action [GH-67].
|
12
|
+
# It is available only since PD 10.
|
13
|
+
if env[:machine].provider.pd_version_satisfies?('>= 10')
|
14
|
+
@logger.info('Disabling password restrictions: remove-vm')
|
15
|
+
env[:machine].provider.driver.disable_password_restrictions(['remove-vm'])
|
16
|
+
end
|
17
|
+
|
10
18
|
env[:ui].info I18n.t('vagrant.actions.vm.destroy.destroying')
|
11
19
|
env[:machine].provider.driver.delete
|
12
20
|
env[:machine].id = nil
|
@@ -12,6 +12,14 @@ module VagrantPlugins
|
|
12
12
|
def call(env)
|
13
13
|
@machine = env[:machine]
|
14
14
|
|
15
|
+
# Disable requiring password for register and clone actions [GH-67].
|
16
|
+
# It is available only since PD 10.
|
17
|
+
if env[:machine].provider.pd_version_satisfies?('>= 10')
|
18
|
+
acts = ['clone-vm']
|
19
|
+
@logger.info("Disabling password restrictions: #{acts.join(', ')}")
|
20
|
+
env[:machine].provider.driver.disable_password_restrictions(acts)
|
21
|
+
end
|
22
|
+
|
15
23
|
# Register template to be able to clone it further
|
16
24
|
register_template(template_path.to_s)
|
17
25
|
|
@@ -14,17 +14,14 @@ module VagrantPlugins
|
|
14
14
|
# helpers.
|
15
15
|
@env = env
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
@logger.info('Disabling any password restrictions...')
|
22
|
-
env[:machine].provider.driver.disable_password_restrictions
|
23
|
-
end
|
17
|
+
settings = default_settings
|
18
|
+
|
19
|
+
@app.call(env) if settings.empty?
|
20
|
+
@env[:ui].info I18n.t('vagrant_parallels.actions.vm.sane_defaults.setting')
|
24
21
|
|
25
|
-
|
26
|
-
@
|
27
|
-
|
22
|
+
default_settings.each do |setting, value|
|
23
|
+
@env[:machine].provider.driver.execute_prlctl(
|
24
|
+
'set', @env[:machine].id, "--#{setting.to_s.gsub('_','-')}", value)
|
28
25
|
end
|
29
26
|
|
30
27
|
@app.call(env)
|
@@ -32,21 +29,42 @@ module VagrantPlugins
|
|
32
29
|
|
33
30
|
private
|
34
31
|
|
35
|
-
def
|
36
|
-
|
37
|
-
vm_settings = @env[:machine].provider.driver.read_settings
|
32
|
+
def default_settings
|
33
|
+
settings = {}
|
38
34
|
|
39
|
-
|
40
|
-
|
35
|
+
return settings if @env[:machine].provider.pd_version_satisfies?('< 9')
|
36
|
+
settings.merge!(
|
37
|
+
startup_view: 'same',
|
38
|
+
on_shutdown: 'close',
|
39
|
+
on_window_close: 'keep-running',
|
40
|
+
auto_share_camera: 'off',
|
41
|
+
smart_guard: 'off',
|
42
|
+
longer_battery_life: 'on'
|
43
|
+
)
|
41
44
|
|
42
|
-
|
43
|
-
|
44
|
-
|
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)
|
45
|
+
# Check the legacy option
|
46
|
+
if !@env[:machine].provider_config.optimize_power_consumption
|
47
|
+
settings[:longer_battery_life] = 'off'
|
49
48
|
end
|
49
|
+
|
50
|
+
return settings if @env[:machine].provider.pd_version_satisfies?('< 10.1.2')
|
51
|
+
settings.merge!(
|
52
|
+
shared_cloud: 'off',
|
53
|
+
shared_profile: 'off',
|
54
|
+
smart_mount: 'off',
|
55
|
+
sh_app_guest_to_host: 'off',
|
56
|
+
sh_app_host_to_guest: 'off',
|
57
|
+
time_sync: 'off'
|
58
|
+
)
|
59
|
+
|
60
|
+
return settings if @env[:machine].provider.pd_version_satisfies?('< 11')
|
61
|
+
settings.merge!(
|
62
|
+
startup_view: 'headless',
|
63
|
+
time_sync: 'on',
|
64
|
+
disable_timezone_sync: 'on'
|
65
|
+
)
|
66
|
+
|
67
|
+
settings
|
50
68
|
end
|
51
69
|
end
|
52
70
|
end
|
@@ -77,10 +77,6 @@ module VagrantPlugins
|
|
77
77
|
@functional_psf = true
|
78
78
|
end
|
79
79
|
|
80
|
-
if @optimize_power_consumption == UNSET_VALUE
|
81
|
-
@optimize_power_consumption = true
|
82
|
-
end
|
83
|
-
|
84
80
|
@use_linked_clone = false if @use_linked_clone == UNSET_VALUE
|
85
81
|
|
86
82
|
@name = nil if @name == UNSET_VALUE
|
@@ -108,6 +104,10 @@ module VagrantPlugins
|
|
108
104
|
end
|
109
105
|
end
|
110
106
|
|
107
|
+
if @optimize_power_consumption != UNSET_VALUE
|
108
|
+
machine.env.ui.warn I18n.t('vagrant_parallels.config.deprecate_power_consumption')
|
109
|
+
end
|
110
|
+
|
111
111
|
{ 'Parallels Provider' => errors }
|
112
112
|
end
|
113
113
|
end
|
@@ -156,7 +156,9 @@ module VagrantPlugins
|
|
156
156
|
# Disables requiring password on such operations as creating, adding,
|
157
157
|
# removing or cloning the virtual machine.
|
158
158
|
#
|
159
|
-
|
159
|
+
# @param [Array<String>] acts List of actions. Available values:
|
160
|
+
# ['create-vm', 'add-vm', 'remove-vm', 'clone-vm']
|
161
|
+
def disable_password_restrictions(acts)
|
160
162
|
raise NotImplementedError
|
161
163
|
end
|
162
164
|
|
@@ -670,7 +672,13 @@ module VagrantPlugins
|
|
670
672
|
# Parses given block (JSON string) to object
|
671
673
|
def json(default=nil)
|
672
674
|
data = yield
|
673
|
-
|
675
|
+
begin
|
676
|
+
JSON.parse(data)
|
677
|
+
rescue JSON::ParserError
|
678
|
+
# Try to cleanup the data and parse it again [GH-204]
|
679
|
+
data = data[/(\{.*\}|\[.*\])/m]
|
680
|
+
JSON.parse(data) rescue default
|
681
|
+
end
|
674
682
|
end
|
675
683
|
|
676
684
|
# Executes a command and returns the raw result object.
|
@@ -49,10 +49,10 @@ module VagrantPlugins
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
def disable_password_restrictions
|
52
|
+
def disable_password_restrictions(acts)
|
53
53
|
server_info = json { execute_prlsrvctl('info', '--json') }
|
54
54
|
server_info.fetch('Require password to',[]).each do |act|
|
55
|
-
execute_prlsrvctl('set', '--require-pwd', "#{act}:off")
|
55
|
+
execute_prlsrvctl('set', '--require-pwd', "#{act}:off") if acts.include? act
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
data/locales/en.yml
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
en:
|
2
2
|
vagrant_parallels:
|
3
3
|
parallels:
|
4
|
-
power_consumption:
|
5
|
-
set_mode: |-
|
6
|
-
Setting power consumption mode: "%{mode}"
|
7
4
|
network_adapter: |-
|
8
5
|
Adapter %{adapter}: %{type}%{extra}
|
9
6
|
#-------------------------------------------------------------------------------
|
@@ -117,6 +114,17 @@ en:
|
|
117
114
|
invalid_event: |-
|
118
115
|
%{event} is not a valid event for customization. Valid events
|
119
116
|
are: %{valid_events}
|
117
|
+
deprecate_power_consumption: |-
|
118
|
+
Setting "optimize_power_consumption" has been deprecated in the Parallels
|
119
|
+
provider and will be removed in the future releases. Power consumption
|
120
|
+
is enabled by default. If you want to keep it enabled, then just remove
|
121
|
+
this setting from your Vagrantfile. Otherwise, please replace it with
|
122
|
+
this block in order to disable the power consumption:
|
123
|
+
|
124
|
+
config.vm.provider "parallels" do |prl|
|
125
|
+
prl.customize ["set", :id, "--longer-battery-life", "off"]
|
126
|
+
end
|
127
|
+
|
120
128
|
#-------------------------------------------------------------------------------
|
121
129
|
# Translations for commands. e.g. `vagrant x`
|
122
130
|
#-------------------------------------------------------------------------------
|
@@ -186,3 +194,5 @@ en:
|
|
186
194
|
%{guest_port} => %{host_port}
|
187
195
|
import:
|
188
196
|
importing_linked: Importing base box '%{name}' as a linked clone...
|
197
|
+
sane_defaults:
|
198
|
+
setting: Setting the default configuration for VM...
|
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: 1.
|
4
|
+
version: 1.5.0
|
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: 2015-
|
12
|
+
date: 2015-09-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|