Raise error if incomplete trigger block is defined
This commit is contained in:
parent
6bf01965de
commit
0054c5aae6
|
@ -780,6 +780,10 @@ module Vagrant
|
|||
error_key(:triggers_guest_not_running)
|
||||
end
|
||||
|
||||
class TriggersNoBlockGiven < VagrantError
|
||||
error_key(:triggers_no_block_given)
|
||||
end
|
||||
|
||||
class TriggersNoStageGiven < VagrantError
|
||||
error_key(:triggers_no_stage_given)
|
||||
end
|
||||
|
|
|
@ -49,6 +49,9 @@ module VagrantPlugins
|
|||
# so the last element should be the "config block"
|
||||
# and the rest are commands for the trigger
|
||||
blk = command.pop
|
||||
elsif !block_given?
|
||||
raise Vagrant::Errors::TriggersNoBlockGiven,
|
||||
command: command
|
||||
end
|
||||
|
||||
command.each do |cmd|
|
||||
|
@ -71,6 +74,9 @@ module VagrantPlugins
|
|||
# so the last element should be the "config block"
|
||||
# and the rest are commands for the trigger
|
||||
blk = command.pop
|
||||
elsif !block_given?
|
||||
raise Vagrant::Errors::TriggersNoBlockGiven,
|
||||
command: command
|
||||
end
|
||||
|
||||
command.each do |cmd|
|
||||
|
|
|
@ -1414,6 +1414,9 @@ en:
|
|||
Trigger run failed
|
||||
triggers_guest_not_running: |-
|
||||
Could not run remote script on %{machine_name} because its state is %{state}
|
||||
triggers_no_block_given: |-
|
||||
There was an error parsing the Vagrantfile:
|
||||
No config was given for the trigger(s) %{command}.
|
||||
triggers_no_stage_given: |-
|
||||
The incorrect stage was given to the trigger plugin:
|
||||
Guest: %{guest_name}
|
||||
|
|
Loading…
Reference in New Issue