summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-05-01 12:51:22 -0700
committerGitHub <noreply@github.com>2020-05-01 12:51:22 -0700
commit44a1bd0c70aa244216611d169f320166750ae21a (patch)
tree4169e021af0af84cb94d9913041d4f789d3893a6
parentae45562cd91d01831eabf07b551bb1406f08cb9c (diff)
parentf1cd6966b2afdc12a5eb9204c26c4ccc5fcd3097 (diff)
downloadchef-44a1bd0c70aa244216611d169f320166750ae21a.tar.gz
Merge pull request #9769 from chef/fix-yaml-tool
Fix symbols and arrays in yaml conversion tool
-rw-r--r--lib/chef/knife/yaml_convert.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/knife/yaml_convert.rb b/lib/chef/knife/yaml_convert.rb
index 92b14da29a..6a6e11aeec 100644
--- a/lib/chef/knife/yaml_convert.rb
+++ b/lib/chef/knife/yaml_convert.rb
@@ -56,7 +56,7 @@ class Chef::Knife::YamlConvert < Chef::Knife
end
# Unfortunately, per the YAML spec, comments are stripped when we load, so we lose them on conversion
- yaml_hash = ::YAML.safe_load(yaml_contents)
+ yaml_hash = ::YAML.safe_load(yaml_contents, permitted_classes: [Symbol])
unless yaml_hash.is_a?(Hash) && yaml_hash.key?("resources")
ui.fatal!("YAML recipe '#{source_file}' must contain a top-level 'resources' hash (YAML sequence), i.e. 'resources:'")
end
@@ -81,7 +81,7 @@ class Chef::Knife::YamlConvert < Chef::Knife
ruby_contents << "#{type} \"#{name}\" do"
r.each do |k, v|
- ruby_contents << " #{k} \"#{v}\""
+ ruby_contents << " #{k} #{v.inspect}"
end
ruby_contents << "end\n"
end