Skip to content

Commit

Permalink
fix(pkcs7): fix warning of both public_key/public_key_env_var to refl…
Browse files Browse the repository at this point in the history
…ect code

If both public_key and public_key_env_var were set, this message
triggred:
`both public_key and public_key_env_var specified, using public_key`

However, the code actually preferred the `public_key_env_var` path.
Change the warning to reflect that.

Also change a similar line for private_key/private_key_env_var.

Signed-off-by: Robin H. Johnson <[email protected]>
Resolves: #360 (comment)
  • Loading branch information
robbat2 committed Dec 25, 2023
1 parent ccab145 commit a05c839
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/hiera/backend/eyaml/encryptors/pkcs7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def self.encrypt(plaintext)
public_key_env_var = option :public_key_env_var

if public_key and public_key_env_var
warn 'both public_key and public_key_env_var specified, using public_key'
warn 'both public_key and public_key_env_var specified, using public_key_env_var'
end

if public_key_env_var
Expand Down Expand Up @@ -70,10 +70,10 @@ def self.decrypt(ciphertext)
raise StandardError, 'pkcs7_private_key is not defined' unless private_key or private_key_env_var

if public_key and public_key_env_var
warn 'both public_key and public_key_env_var specified, using public_key'
warn 'both public_key and public_key_env_var specified, using public_key_env_var'
end
if private_key and private_key_env_var
warn 'both private_key and private_key_env_var specified, using private_key'
warn 'both private_key and private_key_env_var specified, using private_key_env_var'
end

private_key_pem = if private_key_env_var and ENV[private_key_env_var]
Expand Down

0 comments on commit a05c839

Please sign in to comment.