Skip to content

Instantly share code, notes, and snippets.

@thommay
Forked from anonymous/gist:382024
Created April 28, 2010 11:34
Show Gist options
  • Save thommay/382030 to your computer and use it in GitHub Desktop.
Save thommay/382030 to your computer and use it in GitHub Desktop.
define :email_alias, :recipients => [] do
execute "newaliases" do
action :nothing
end
t = nil
begin
t = resources(:template => "/etc/aliases")
rescue ArgumentError
t = template "/etc/aliases" do
source "aliases.erb"
cookbook "aliases"
variables({:aliases => {} })
notifies :run, resources(:execute => "newaliases")
end
end
if not t.variables[:aliases].has_key?(params[:name])
t.variables[:aliases][params[:name]] = []
end
t.variables[:aliases][params[:name]] << [ params[:recipients] ]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment