Skip to content

Commit

Permalink
Fixes crayfishx#21: Restore GNUPGHOME environment variable after read…
Browse files Browse the repository at this point in the history
…ing.
  • Loading branch information
glennpratt committed Feb 6, 2013
1 parent bf659b1 commit b921127
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/hiera/backend/gpg_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def lookup(key, scope, order_override, resolution_type)

def decrypt(file, gnupghome)

ENV["GNUPGHOME"]=gnupghome
gnupghome_backup = ENV["GNUPGHOME"]
ENV["GNUPGHOME"] = gnupghome
debug("GNUPGHOME is #{ENV['GNUPGHOME']}")

ctx = GPGME::Ctx.new
Expand All @@ -95,6 +96,8 @@ def decrypt(file, gnupghome)
warn("Warning: GPG Decryption failed, check your GPG settings")
rescue
warn("Warning: General exception decrypting GPG file")
ensure
ENV["GNUPGHOME"] = gnupghome_backup
end

txt.seek 0
Expand Down

0 comments on commit b921127

Please sign in to comment.