Skip to content

Instantly share code, notes, and snippets.

@binford2k
Created October 28, 2014 21:36
Show Gist options
  • Save binford2k/fb0d7e6e93e336e06f00 to your computer and use it in GitHub Desktop.
Save binford2k/fb0d7e6e93e336e06f00 to your computer and use it in GitHub Desktop.
# Make sure that all channels are subscribed to before any packages are installed.
# This is evil and horrible and not right. But it's really the only way right now.
# TODO: use a whit to coalesce relationships for performance reasons. This won't
# really matter until you have many channels subscribed.
def autorequire(rel_catalog = nil)
rel_catalog ||= catalog
raise(Puppet::DevError, "You cannot add relationship without a catalog") unless rel_catalog
reqs = super
rel_catalog.resources.select{|x| x.is_a? Puppet::Type::Package}.each do |res|
reqs << Puppet::Relationship::new(self, res)
end
reqs
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment