diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-06-12 17:30:54 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2020-02-14 10:47:42 -0800 |
commit | 361edd250687dbe93587a659c1fc93baf35be000 (patch) | |
tree | ff66c5ffb842f5d35db5a3edc8973f65425ae6cb | |
parent | 6805006207c78f48961d24336be2054095a8bd68 (diff) | |
download | chef-361edd250687dbe93587a659c1fc93baf35be000.tar.gz |
remove erb parsing
if we do this we open the door to arbitrary ruby which is going to be
context dependent and it will eliminate the possibility of ever
autoconverting from YAML to ruby.
if we build up a YAML structure we can better ensure that there's a
static mapping of the YAML code to ruby for autoconversion.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/mixin/from_file.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/chef/mixin/from_file.rb b/lib/chef/mixin/from_file.rb index ba034d331e..94e3144f9f 100644 --- a/lib/chef/mixin/from_file.rb +++ b/lib/chef/mixin/from_file.rb @@ -17,8 +17,6 @@ # limitations under the License. # -require "erb" - class Chef module Mixin module FromFile @@ -43,9 +41,7 @@ class Chef def from_yaml_file(filename) self.source_file = filename if File.file?(filename) && File.readable?(filename) - tpl = ERB.new(IO.read(filename)) - tpl.filename = filename - res = ::YAML.safe_load(tpl.result) + res = ::YAML.safe_load(IO.read(filename)) if res.is_a?(Hash) from_hash(res) elsif res.is_a?(Array) |