Class: Chef::SecretFetcher::Example

Inherits:
Base
  • Object
show all
Defined in:
lib/chef/secret_fetcher/example.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #run_context

Instance Method Summary collapse

Methods inherited from Base

#fetch, #initialize

Constructor Details

This class inherits a constructor from Chef::SecretFetcher::Base

Instance Method Details

#do_fetch(identifier, version) ⇒ Object



39
40
41
42
43
# File 'lib/chef/secret_fetcher/example.rb', line 39

def do_fetch(identifier, version)
  raise Chef::Exceptions::Secret::FetchFailed.new("Secret #{identifier}) not found.") unless config.key?(identifier)

  config[identifier]
end

#validate!Object



33
34
35
36
37
# File 'lib/chef/secret_fetcher/example.rb', line 33

def validate!
  if config.class != Hash
    raise Chef::Exceptions::Secret::ConfigurationInvalid.new("The Example fetcher requires a hash of secrets")
  end
end