Properly print warnings on config settings that aren't supported
This commit is contained in:
parent
188fd5d6a6
commit
e25cb51f15
|
@ -113,10 +113,19 @@ module VagrantPlugins
|
||||||
|
|
||||||
# Convert @run and @run_remote to be a "Shell provisioner" config
|
# Convert @run and @run_remote to be a "Shell provisioner" config
|
||||||
if @run && @run.is_a?(Hash)
|
if @run && @run.is_a?(Hash)
|
||||||
|
# Powershell args and privileged for run commands is currently not supported
|
||||||
|
# so by default use empty string or false if unset. This helps the validate
|
||||||
|
# function determine if the setting was purposefully set, to print a warning
|
||||||
|
if !@run.key?(:powershell_args)
|
||||||
|
@run[:powershell_args] = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
if !@run.key?(:privileged)
|
||||||
|
@run[:privileged] = false
|
||||||
|
end
|
||||||
|
|
||||||
new_run = VagrantPlugins::Shell::Config.new
|
new_run = VagrantPlugins::Shell::Config.new
|
||||||
new_run.set_options(@run)
|
new_run.set_options(@run)
|
||||||
# don't run local commands as sudo by default
|
|
||||||
new_run.privileged = false
|
|
||||||
new_run.finalize!
|
new_run.finalize!
|
||||||
@run = new_run
|
@run = new_run
|
||||||
end
|
end
|
||||||
|
@ -152,6 +161,10 @@ module VagrantPlugins
|
||||||
machine.ui.warn(I18n.t("vagrant.config.triggers.privileged_ignored",
|
machine.ui.warn(I18n.t("vagrant.config.triggers.privileged_ignored",
|
||||||
command: @command))
|
command: @command))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if @run.powershell_args != ""
|
||||||
|
machine.ui.warn(I18n.t("vagrant.config.triggers.powershell_args_ignored"))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if @run_remote
|
if @run_remote
|
||||||
|
|
|
@ -1723,6 +1723,8 @@ en:
|
||||||
Invalid type found for `only_on`. All values must be a `String` or `Regexp`.
|
Invalid type found for `only_on`. All values must be a `String` or `Regexp`.
|
||||||
privileged_ignored: |-
|
privileged_ignored: |-
|
||||||
The `privileged` setting for option `run` for trigger command '%{command}' will be ignored and set to false.
|
The `privileged` setting for option `run` for trigger command '%{command}' will be ignored and set to false.
|
||||||
|
powershell_args_ignored: |-
|
||||||
|
The setting `powershell_args` is not supported for the trigger option `run` and will be ignored.
|
||||||
run:
|
run:
|
||||||
bad_type: |-
|
bad_type: |-
|
||||||
Invalid type set for `run` on trigger for command '%{cmd}'. `run`
|
Invalid type set for `run` on trigger for command '%{cmd}'. `run`
|
||||||
|
|
|
@ -33,6 +33,5 @@ The trigger class takes various options.
|
||||||
+ `args`
|
+ `args`
|
||||||
+ `inline`
|
+ `inline`
|
||||||
+ `path`
|
+ `path`
|
||||||
+ `powershell_args`
|
|
||||||
|
|
||||||
* `warn` (string) - A warning message that will be printed at the beginning of a trigger.
|
* `warn` (string) - A warning message that will be printed at the beginning of a trigger.
|
||||||
|
|
Loading…
Reference in New Issue