lib/puppet-check/data_parser.rb in puppet-check-1.5.1 vs lib/puppet-check/data_parser.rb in puppet-check-1.6.0

- old
+ new

@@ -14,11 +14,11 @@ PuppetCheck.settings[:error_files].push("#{file}:\n#{err.to_s.gsub("(#{file}): ", '')}") else warnings = [] # perform some rudimentary hiera checks if data exists and is hieradata - warnings = hiera(parsed, file) unless parsed.nil? || (File.basename(file) == 'hiera.yaml') + warnings = hiera(parsed, file) if parsed && (File.basename(file) != 'hiera.yaml') next PuppetCheck.settings[:warning_files].push("#{file}:\n#{warnings.join("\n")}") unless warnings.empty? PuppetCheck.settings[:clean_files].push(file.to_s) end end @@ -52,18 +52,18 @@ # insert decrypted portions back into eyaml (pass into loader below) # check yaml syntax begin - parsed = YAML.safe_load(decrypted) + parsed = YAML.load_file(decrypted) rescue StandardError => err PuppetCheck.settings[:error_files].push("#{file}:\n#{err.to_s.gsub("(#{file}): ", '')}") else warnings = [] # perform some rudimentary hiera checks if data exists and is hieradata - warnings = hiera(parsed, file) unless parsed.nil? || (File.basename(file) == 'hiera.yaml') + warnings = hiera(parsed, file) if parsed next PuppetCheck.settings[:warning_files].push("#{file}:\n#{warnings.join("\n")}") unless warnings.empty? PuppetCheck.settings[:clean_files].push(file.to_s) end end @@ -163,12 +163,12 @@ # check for spdx license (rubygems/util/licenses for rubygems >= 2.5 in the far future) if parsed.key?('license') && !SpdxLicenses.exist?(parsed['license']) && parsed['license'] !~ /[pP]roprietary/ warnings.push("License identifier '#{parsed['license']}' is not in the SPDX list: http://spdx.org/licenses/") end # assume this is hieradata - else + elsif parsed # perform some rudimentary hiera checks if data exists - warnings = hiera(parsed, file) unless parsed.nil? + warnings = hiera(parsed, file) end next PuppetCheck.settings[:warning_files].push("#{file}:\n#{warnings.join("\n")}") unless warnings.empty? PuppetCheck.settings[:clean_files].push(file.to_s) end end