Make run and run_remote settings shell provisioner configs

This commit is contained in:
Brian Cain 2018-03-15 14:42:59 -07:00
parent f0ec7c750b
commit 1591ae9916
No known key found for this signature in database
GPG Key ID: 43D51080D357A001
2 changed files with 13 additions and 31 deletions

View File

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

View File

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