Cache the result of build_catalog
This commit is contained in:
parent
eed11c7dc0
commit
4ae3e45af7
|
@ -1,6 +1,10 @@
|
|||
module RSpec::Puppet
|
||||
module Support
|
||||
def build_catalog nodename, facts_val
|
||||
|
||||
@@cache = {}
|
||||
|
||||
protected
|
||||
def build_catalog_without_cache nodename, facts_val
|
||||
node_obj = Puppet::Node.new(nodename)
|
||||
|
||||
node_obj.merge(facts_val)
|
||||
|
@ -13,6 +17,11 @@ module RSpec::Puppet
|
|||
end
|
||||
end
|
||||
|
||||
public
|
||||
def build_catalog *args
|
||||
@@cache[args] ||= self.build_catalog_without_cache(*args)
|
||||
end
|
||||
|
||||
def munge_facts(facts)
|
||||
output = {}
|
||||
facts.keys.each { |key| output[key.to_s] = facts[key] }
|
||||
|
|
Loading…
Reference in New Issue