Skip to content

Instantly share code, notes, and snippets.

@mdkent
Forked from anonymous/gist:272202
Created January 8, 2010 17:29
Show Gist options
  • Save mdkent/272206 to your computer and use it in GitHub Desktop.
Save mdkent/272206 to your computer and use it in GitHub Desktop.
sname = "recipe[#{self.cookbook_name}" + (self.recipe_name == "default" ? "" : self.recipe_name) + "]"
if node.recipes[-1] != sname
node.recipes.remove sname
node.recipes << sname
end
collection.each do |r|
if r.class == Chef::Resource::Package
if r.action.to_s.include?("install") or r.action.to_s.include?("upgrade")
t = resources(:template => "/etc/pkgsync/musthave")
if not t.variables[:packages].include? r.name
t.variables[:packages] << r.name
end
elsif r.action.include?(:remove) or r.action.include?(:purge)
t = resources(:template => "/etc/pkgsync/maynothave")
if not t.variables[:packages].include? r.name
t.variables[:packages] << r.name
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment