mirror of
https://github.com/inspec/inspec
synced 2025-02-16 22:18:38 +00:00
Change two more mentions of DEFAULT_ATTRIBUTE
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
24e8c0a6dd
commit
c9e8716310
2 changed files with 5 additions and 5 deletions
|
@ -1,15 +1,15 @@
|
|||
module PkeyReader
|
||||
def read_pkey(filecontent, passphrase)
|
||||
raise_if_default(passphrase)
|
||||
raise_if_unset(passphrase)
|
||||
|
||||
OpenSSL::PKey.read(filecontent, passphrase)
|
||||
rescue OpenSSL::PKey::PKeyError
|
||||
raise Inspec::Exceptions::ResourceFailed, 'passphrase error'
|
||||
end
|
||||
|
||||
def raise_if_default(passphrase)
|
||||
if passphrase.is_a? Inspec::Attribute::DEFAULT_ATTRIBUTE
|
||||
raise Inspec::Exceptions::ResourceFailed, 'Please provide default value for attribute'
|
||||
def raise_if_unset(passphrase)
|
||||
if passphrase.is_a? Inspec::Input::NO_VALUE_SET
|
||||
raise Inspec::Exceptions::ResourceFailed, 'Please provide a value for input for openssl key passphrase'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ describe Inspec::InputRegistry do
|
|||
it 'creates an input without options' do
|
||||
registry.register_input('test_input', 'dummy_profile')
|
||||
# confirm we get the dummy default
|
||||
registry.find_input('test_input', 'dummy_profile').value.class.must_equal Inspec::Attribute::DEFAULT_ATTRIBUTE
|
||||
registry.find_input('test_input', 'dummy_profile').value.class.must_equal Inspec::Input::NO_VALUE_SET
|
||||
end
|
||||
|
||||
it 'creates an input with a default value' do
|
||||
|
|
Loading…
Add table
Reference in a new issue