Skip to content

Commit

Permalink
voxpupuli#146 leave encrypted value if encryptor returns nil
Browse files Browse the repository at this point in the history
Adds the possibility to have an encryptor which can not decrypt  everything because the actual user does not have all private keys.
  • Loading branch information
Harald Svab committed Jul 16, 2015
1 parent 4bead23 commit 1984a3f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/hiera/backend/eyaml/parser/encrypted_tokens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ def to_decrypted(args={})
label_string = label.nil? ? '' : "#{label}: "
format = args[:format].nil? ? @format : args[:format]
index = args[:index].nil? ? '' : "(#{args[:index]})"
if @plain_text.nil? then
if Utils::hiera? then
raise "Encryptor #{@encryptor.tag} could not decrypt #{label_string} and returned nil!"
end
return to_encrypted(args)
end
case format
when :block
chevron = (args[:use_chevron].nil? || args[:use_chevron]) ? ">\n" : ''
Expand Down

0 comments on commit 1984a3f

Please sign in to comment.