5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/puppet-decrypt/key_loader.rb', line 5
def load_key(secret_key_file)
if Pathname.new(secret_key_file).absolute?
full_path = secret_key_file
else
full_path = File.join(ENV['PUPPET_DECRYPT_KEYDIR'] ||
Puppet::Decrypt::Decryptor::KEY_DIR, secret_key_file)
end
if File.readable? full_path
secret_key_file = full_path
else
raise "Secret key file: #{secret_key_file} is not readable!" unless
File.readable? secret_key_file
end
File.open(secret_key_file, &:readline).chomp
end
|