# File lib/puppet/type.rb, line 1685
1685:     def autorequire(rel_catalog = nil)
1686:         rel_catalog ||= catalog
1687:         raise(Puppet::DevError, "You cannot add relationships without a catalog") unless rel_catalog
1688: 
1689:         reqs = []
1690:         self.class.eachautorequire { |type, block|
1691:             # Ignore any types we can't find, although that would be a bit odd.
1692:             next unless typeobj = Puppet::Type.type(type)
1693: 
1694:             # Retrieve the list of names from the block.
1695:             next unless list = self.instance_eval(&block)
1696:             unless list.is_a?(Array)
1697:                 list = [list]
1698:             end
1699: 
1700:             # Collect the current prereqs
1701:             list.each { |dep|
1702:                 obj = nil
1703:                 # Support them passing objects directly, to save some effort.
1704:                 unless dep.is_a? Puppet::Type
1705:                     # Skip autorequires that we aren't managing
1706:                     unless dep = rel_catalog.resource(type, dep)
1707:                         next
1708:                     end
1709:                 end
1710: 
1711:                 reqs << Puppet::Relationship.new(dep, self)
1712:             }
1713:         }
1714: 
1715:         return reqs
1716:     end