diff options
| author | Luke Kanies <luke@madstop.com> | 2009-05-24 14:20:49 -0500 |
|---|---|---|
| committer | James Turnbull <james@ubuntu904.lovedthanlost.net> | 2009-05-26 13:43:39 +1000 |
| commit | a72875799ecfa78ed91ff31047971441f0f169c3 (patch) | |
| tree | 391cfa144b09fca1ba39cdc0ebcc9533bb443b00 /lib | |
| parent | 6e824d8ca58c5d6f27a4cfcf44fad579a24133d4 (diff) | |
| download | puppet-a72875799ecfa78ed91ff31047971441f0f169c3.tar.gz puppet-a72875799ecfa78ed91ff31047971441f0f169c3.tar.xz puppet-a72875799ecfa78ed91ff31047971441f0f169c3.zip | |
Refactoring resource generation slightly
I found some cases where duplicate resources
weren't correctly skipped, but I couldn't get
the test to really demonstrate them.
The code at least is demonstrated to work,
anyway.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/transaction.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 80e0d49c5..1f4cb3edc 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -349,19 +349,18 @@ class Transaction end return [] unless made made = [made] unless made.is_a?(Array) - made.uniq! - made.each do |res| + made.uniq.find_all do |res| begin @catalog.add_resource(res) do |r| r.finish make_parent_child_relationship(resource, [r]) end + true rescue Puppet::Resource::Catalog::DuplicateResourceError - made.delete(res) - next + res.info "Duplicate generated resource; skipping" + false end end - made end # Collect any dynamically generated resources. This method is called |
