lib/hiera/backend/mysql_json_backend.rb in hiera-mysql-json-backend-1.0.0 vs lib/hiera/backend/mysql_json_backend.rb in hiera-mysql-json-backend-1.0.1
- old
+ new
@@ -31,11 +31,11 @@
Hiera.debug("looking up #{key} in MySQL2 Backend")
Hiera.debug("resolution type is #{resolution_type}")
Backend.datasources(scope, order_override) do |source|
Hiera.debug("Looking for data source #{source}")
- sqlfile = Backend.datafile(:mysql2, scope, source, "sql") || next
+ sqlfile = Backend.datafile(:mysql_json, scope, source, "sql") || next
next unless File.exist?(sqlfile)
data = @cache.read(sqlfile, Hash, {}) do |datafile|
YAML.load(datafile)
end
@@ -62,14 +62,14 @@
Hiera.debug("Found #{key} in #{source}")
new_answer = Backend.parse_answer(data[key], scope)
- results = query(connection_hash, new_answer)
+ sql_results = query(connection_hash, new_answer)
- next if results.length != 1
+ next if sql_results.length != 1
begin
- new_answer = JSON.parse(results[0]['value'])
+ new_answer = JSON.parse(sql_results[0]['value'])
rescue
Hiera.debug("Miserable failure while looking for #{key}.")
next
end