Add only_on validation for config

This commit is contained in:
Brian Cain 2018-03-30 16:28:37 -07:00
parent ca672eb8e6
commit 3ad4f576c0
No known key found for this signature in database
GPG Key ID: 43D51080D357A001
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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`