Method: Inspec::ProfileContext#initialize
- Defined in:
- lib/inspec/profile_context.rb
#initialize(profile_id, backend, conf) ⇒ ProfileContext
Returns a new instance of ProfileContext.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/inspec/profile_context.rb', line 18 def initialize(profile_id, backend, conf) if backend.nil? raise "ProfileContext is initiated with a backend == nil. " \ "This is a backend error which must be fixed upstream." end @profile_id = profile_id @backend = backend @conf = conf.dup @profile_name = @conf.key?("profile") ? @conf["profile"].profile_name : @profile_id @skip_only_if_eval = @conf["check_mode"] @rules = {} @control_subcontexts = [] @lib_subcontexts = [] @require_loader = ::Inspec::RequireLoader.new Inspec::InputRegistry.register_profile_alias(@profile_id, @profile_name) if @profile_id != @profile_name # TODO: consider polling input source plugins; this is a bulk fetch opportunity # A local resource registry that only contains resources defined # in the transitive dependency tree of the loaded profile. @resource_registry = Inspec::Resource.new_registry @library_eval_context = Inspec::LibraryEvalContext.create(@resource_registry, @require_loader) @current_load = nil end |