provisioners/shell: error if invalid encoding [GH-3000]
This commit is contained in:
parent
095f6d63c5
commit
a667893cbf
|
@ -112,6 +112,7 @@ BUG FIXES:
|
|||
[GH-2766]
|
||||
- provisioners/salt: Fix case when salt would say "options only allowed
|
||||
before install arguments" [GH-3005]
|
||||
- provisioners/shell: Error if script is encoded incorrectly. [GH-3000]
|
||||
- synced\_folders/nfs: NFS entries are pruned on every `vagrant up`,
|
||||
if there are any to prune. [GH-2738]
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# This file is load before RubyGems are loaded, and allow us to actually
|
||||
# resolve plugin dependencies and load the proper versions of everything.
|
||||
|
||||
require "vagrant/shared_helpers"
|
||||
|
||||
if Vagrant.plugins_enabled? && !defined?(Bundler)
|
||||
|
|
|
@ -51,6 +51,15 @@ module VagrantPlugins
|
|||
if !expanded_path.file?
|
||||
errors << I18n.t("vagrant.provisioners.shell.path_invalid",
|
||||
:path => expanded_path)
|
||||
else
|
||||
data = expanded_path.read(16)
|
||||
if !data.valid_encoding?
|
||||
errors << I18n.t(
|
||||
"vagrant.provisioners.shell.invalid_encoding",
|
||||
actual: data.encoding.to_s,
|
||||
default: Encoding.default_external.to_s,
|
||||
path: expanded_path.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1523,6 +1523,9 @@ en:
|
|||
|
||||
shell:
|
||||
args_bad_type: "Shell provisioner `args` must be a string or array."
|
||||
invalid_encoding: |-
|
||||
Invalid encoding '%{actual}' for script at '%{path}'.
|
||||
Must be '%{default}' or UTF-8.
|
||||
no_path_or_inline: "One of `path` or `inline` must be set."
|
||||
path_and_inline_set: "Only one of `path` or `inline` may be set."
|
||||
path_invalid: "`path` for shell provisioner does not exist on the host system: %{path}"
|
||||
|
|
Loading…
Reference in New Issue