summaryrefslogtreecommitdiff
path: root/lib/chef/encrypted_data_bag_item
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-03-14 11:05:44 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-03-14 11:05:44 -0700
commitd4579addae1dafa6b9e39b286995b97dac450aa2 (patch)
tree31aa3b95b252acc947df1e3307ab1b987a696ebe /lib/chef/encrypted_data_bag_item
parent6705acbd7f301d1b04388043a3dfa0308655f120 (diff)
downloadchef-d4579addae1dafa6b9e39b286995b97dac450aa2.tar.gz
This commit is why AndOr needs to be banned
I can barely understand what these intend. I'm pretty certain that the logic in the encrypted data bag item code was wrong (fixed now to match the comment) and I'm believe I converted the yum code to preserve the logic. But holy fuck its hard to read the yum code that I'm replacing.
Diffstat (limited to 'lib/chef/encrypted_data_bag_item')
-rw-r--r--lib/chef/encrypted_data_bag_item/decryptor.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/encrypted_data_bag_item/decryptor.rb b/lib/chef/encrypted_data_bag_item/decryptor.rb
index a002a98a79..773ff4e154 100644
--- a/lib/chef/encrypted_data_bag_item/decryptor.rb
+++ b/lib/chef/encrypted_data_bag_item/decryptor.rb
@@ -92,8 +92,8 @@ class Chef::EncryptedDataBagItem
plaintext = openssl_decryptor.update(encrypted_bytes)
plaintext << openssl_decryptor.final
rescue OpenSSL::Cipher::CipherError => e
- # if the key length is less than 150 characters, and it contains slashes, we think it may be a path.
- raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{ @key.length < 255 and @key.include?('/') ? 'You may need to use --secret-file rather than --secret.' : '' }"
+ # if the key length is less than 255 characters, and it contains slashes, we think it may be a path.
+ raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{ (@key.length < 255 && @key.include?('/')) ? 'You may need to use --secret-file rather than --secret.' : '' }"
end
end
@@ -143,8 +143,8 @@ class Chef::EncryptedDataBagItem
plaintext = openssl_decryptor.update(encrypted_bytes)
plaintext << openssl_decryptor.final
rescue OpenSSL::Cipher::CipherError => e
- # if the key length is less than 150 characters, and it contains slashes, we think it may be a path.
- raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{ @key.length < 255 and @key.include?('/') ? 'You may need to use --secret-file rather than --secret.' : '' }"
+ # if the key length is less than 255 characters, and it contains slashes, we think it may be a path.
+ raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{ ( @key.length < 255 && @key.include?('/')) ? 'You may need to use --secret-file rather than --secret.' : '' }"
end
end