diff --git a/plugins/kernel_v2/config/vm_trigger.rb b/plugins/kernel_v2/config/vm_trigger.rb index 2570a4392..cde23e34c 100644 --- a/plugins/kernel_v2/config/vm_trigger.rb +++ b/plugins/kernel_v2/config/vm_trigger.rb @@ -1,5 +1,6 @@ require 'log4r' require 'pry' +require Vagrant.source_root.join('plugins/provisioners/shell/config') module VagrantPlugins module Kernel_V2 @@ -109,9 +110,17 @@ module VagrantPlugins # Convert @run and @run_remote to be a "Shell provisioner" if @run + new_run = VagrantPlugins::Shell::Config.new() + new_run.set_options(@run) + new_run.finalize! + @run = new_run end if @run_remote + new_run = VagrantPlugins::Shell::Config.new() + new_run.set_options(@run_remote) + new_run.finalize! + @run_remote = new_run end end @@ -129,27 +138,6 @@ module VagrantPlugins cmd: @command)) end - if !@run.nil? - if !@run.is_a?(Hash) - # Run must be a hash - errors << I18n.t("vagrant.config.triggers.run.bad_type", cmd: @command) - end - - if !@run.key?(:inline) && !@run.key?(:file) - errors << I18n.t("vagrant.config.triggers.run.missing_context", cmd: @command) - end - end - - if !@run_remote.nil? - if !@run_remote.is_a?(Hash) - errors << I18n.t("vagrant.config.triggers.run_remote.bad_type", cmd: @command) - end - - if !@run_remote.key?(:inline) && !@run_remote.key?(:file) - errors << I18n.t("vagrant.config.triggers.run_remote.missing_context", cmd: @command) - end - end - if !@name.nil? && !@name.is_a?(String) errors << I18n.t("vagrant.config.triggers.name_bad_type", cmd: @command) end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 06a50ef95..8f8706f1f 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -1687,18 +1687,12 @@ en: only be `:halt` (default) or `:continue`. run: bad_type: |- - Invalid type set for `run` on trigger for command '%{cmd}'. `run` must be a - Hash with either key `:inline` or `:file` - missing_context: |- - Missing key for trigger config setting `run` for command '%{cmd}'. `run` is expected - to be given either an `:inline` or `:file` setting. + Invalid type set for `run` on trigger for command '%{cmd}'. `run` + must be a Hash. run_remote: bad_type: |- - Invalid type set for `run_remote` on trigger for command '%{cmd}'. `run` must be a - Hash with either key `:inline` or `:file` - missing_context: |- - Missing key for trigger config setting `run` for command '%{cmd}'. `run_remote` is expected - to be given either an `:inline` or `:file` setting. + Invalid type set for `run` on trigger for command '%{cmd}'. `run` + must be a Hash. vm: bad_version: |-