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)
|
error_key(:triggers_guest_not_running)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class TriggersNoBlockGiven < VagrantError
|
||||||
|
error_key(:triggers_no_block_given)
|
||||||
|
end
|
||||||
|
|
||||||
class TriggersNoStageGiven < VagrantError
|
class TriggersNoStageGiven < VagrantError
|
||||||
error_key(:triggers_no_stage_given)
|
error_key(:triggers_no_stage_given)
|
||||||
end
|
end
|
||||||
|
|
|
@ -49,6 +49,9 @@ module VagrantPlugins
|
||||||
# so the last element should be the "config block"
|
# so the last element should be the "config block"
|
||||||
# and the rest are commands for the trigger
|
# and the rest are commands for the trigger
|
||||||
blk = command.pop
|
blk = command.pop
|
||||||
|
elsif !block_given?
|
||||||
|
raise Vagrant::Errors::TriggersNoBlockGiven,
|
||||||
|
command: command
|
||||||
end
|
end
|
||||||
|
|
||||||
command.each do |cmd|
|
command.each do |cmd|
|
||||||
|
@ -71,6 +74,9 @@ module VagrantPlugins
|
||||||
# so the last element should be the "config block"
|
# so the last element should be the "config block"
|
||||||
# and the rest are commands for the trigger
|
# and the rest are commands for the trigger
|
||||||
blk = command.pop
|
blk = command.pop
|
||||||
|
elsif !block_given?
|
||||||
|
raise Vagrant::Errors::TriggersNoBlockGiven,
|
||||||
|
command: command
|
||||||
end
|
end
|
||||||
|
|
||||||
command.each do |cmd|
|
command.each do |cmd|
|
||||||
|
|
|
@ -1414,6 +1414,9 @@ en:
|
||||||
Trigger run failed
|
Trigger run failed
|
||||||
triggers_guest_not_running: |-
|
triggers_guest_not_running: |-
|
||||||
Could not run remote script on %{machine_name} because its state is %{state}
|
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: |-
|
triggers_no_stage_given: |-
|
||||||
The incorrect stage was given to the trigger plugin:
|
The incorrect stage was given to the trigger plugin:
|
||||||
Guest: %{guest_name}
|
Guest: %{guest_name}
|
||||||
|
|
Loading…
Reference in New Issue