mirror of
https://github.com/inspec/inspec
synced 2024-11-10 23:24:18 +00:00
Simple refactoring + assign __resource_registry to the current if needed.
Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
parent
81dfe21a98
commit
f0a5ddd4df
1 changed files with 8 additions and 3 deletions
|
@ -170,13 +170,18 @@ module Inspec
|
|||
|
||||
# rubocop:enable Lint/NestedMethodDefinition
|
||||
|
||||
reg = __resource_registry rescue nil
|
||||
reg = self.__resource_registry = Inspec::Resource.registry unless reg
|
||||
|
||||
# Warn if a resource pack is overwriting a core resource.
|
||||
# Suppress warning if the resource is an AWS resource, see #3822
|
||||
if __resource_registry.key?(name) && !name.start_with?("aws_")
|
||||
|
||||
if reg.key?(name) && !name.start_with?("aws_")
|
||||
Inspec::Log.warn("Overwriting resource #{name}. To reference a specific version of #{name} use the resource() method")
|
||||
end
|
||||
__resource_registry[name] = cl
|
||||
end
|
||||
|
||||
reg[name] = cl
|
||||
end # __register
|
||||
end
|
||||
|
||||
module Plugins
|
||||
|
|
Loading…
Reference in a new issue