Skip to content

Commit

Permalink
Add support for array lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienthebo committed Dec 6, 2012
1 parent faff0a7 commit 567a035
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/hiera/backend/file_backend.rb
Expand Up @@ -23,13 +23,21 @@ def lookup(key, scope, order_override, resolution_type)
unless abs_path.index(abs_datadir) == 0
raise Exception, "Hiera File backend: key lookup outside of datadir '#{key}'"
end

next unless File.exist?(abs_path)
data = File.read(abs_path)
next unless data
answer = data
break

case resolution_type
when :array
answer ||= []
answer << Backend.parse_answer(data, scope)
else
answer = Backend.parse_answer(data, scope)
break
end
end
return answer

answer
end
end
end
Expand Down

0 comments on commit 567a035

Please sign in to comment.