lib/hiera/backend/mysql_json_backend.rb in hiera-mysql-json-backend-1.1.1 vs lib/hiera/backend/mysql_json_backend.rb in hiera-mysql-json-backend-1.1.2

- old
+ new

@@ -88,11 +88,11 @@ # TODO: make sure we fail if we have more than 1 result, skip if less than 1. next if sql_results.length != 1 begin new_answer = JSON.parse(sql_results[0]['value']) rescue - raise Exception, "JSON parse error for key '#{key}'." unless Config[:mysql_json][:ignore_json_parse_errors] + raise Exception, "JSON parse error for key '#{key}'. Offending data: #{sql_results[0]['value']}." unless Config[:mysql_json][:ignore_json_parse_errors] Hiera.debug("Miserable failure while looking for #{key}.") next end case resolution_type.is_a?(Hash) ? :hash : resolution_type @@ -137,19 +137,14 @@ numcols = md.getColumnCount Hiera.debug("Mysql Query returned #{numcols} rows") while res.next - if numcols < 2 - Hiera.debug("Mysql value : #{res.getString(1)}") - data << res.getString(1) - else - row = {} - (1..numcols).each do |c| - row[md.getColumnName(c)] = res.getString(c) - end - data << row + row = {} + (1..numcols).each do |c| + row[md.getColumnName(c)] = res.getString(c) end + data << row end else client = Mysql2::Client.new(connection_hash) begin