diff --git a/plugins/kernel_v2/config/vm_trigger.rb b/plugins/kernel_v2/config/vm_trigger.rb index 9c45fbf8a..2e95c496a 100644 --- a/plugins/kernel_v2/config/vm_trigger.rb +++ b/plugins/kernel_v2/config/vm_trigger.rb @@ -111,14 +111,14 @@ module VagrantPlugins end # Convert @run and @run_remote to be a "Shell provisioner" config - if @run + if @run && @run.is_a?(Hash) new_run = VagrantPlugins::Shell::Config.new() new_run.set_options(@run) new_run.finalize! @run = new_run end - if @run_remote + if @run_remote && @run_remote.is_a?(Hash) new_run = VagrantPlugins::Shell::Config.new() new_run.set_options(@run_remote) new_run.finalize! @@ -135,6 +135,18 @@ module VagrantPlugins commands.push(key) end + # TODO: Does it make sense to strip out the "shell provisioner" error key here? + # We could add more context around triggers? + if @run + errorz = @run.validate(machine) + errors.concat errorz["shell provisioner"] if !errorz.empty? + end + + if @run_remote + errorz = @run_remote.validate(machine) + errors.concat errorz["shell provisioner"] if !errorz.empty? + end + if !commands.include?(@command) machine.ui.warn(I18n.t("vagrant.config.triggers.bad_command_warning", cmd: @command))