Add only_on validation for config
This commit is contained in:
parent
ca672eb8e6
commit
3ad4f576c0
|
@ -170,13 +170,15 @@ module VagrantPlugins
|
|||
|
||||
if @on_error != :halt
|
||||
if @on_error != :continue
|
||||
# must be :halt or :continue
|
||||
errors << I18n.t("vagrant.config.triggers.on_error_bad_type", cmd: @command)
|
||||
end
|
||||
end
|
||||
|
||||
# @ignore validations?
|
||||
# @only_on validations?
|
||||
if !@only_on.nil?
|
||||
if @only_on.all? { |o| !o.is_a?(String) || !o.is_a?(Regexp) }
|
||||
errors << I18n.t("vagrant.config.triggers.only_on_bad_type")
|
||||
end
|
||||
end
|
||||
|
||||
errors
|
||||
end
|
||||
|
|
|
@ -1715,6 +1715,8 @@ en:
|
|||
on_error_bad_type: |-
|
||||
Invalid type set for `on_error` on trigger for command '%{cmd}'. `on_error` can
|
||||
only be `:halt` (default) or `:continue`.
|
||||
only_on_bad_type: |-
|
||||
Invalid type found for `only_on`. All values must be a `String` or `Regexp`.
|
||||
run:
|
||||
bad_type: |-
|
||||
Invalid type set for `run` on trigger for command '%{cmd}'. `run`
|
||||
|
|
Loading…
Reference in New Issue