Skip to content

Instantly share code, notes, and snippets.

@lamont-granquist
Forked from thommay/aliases.erb
Last active October 10, 2016 18:41
Show Gist options
  • Save lamont-granquist/5a05c1bb19855de9b716bb9496cf2bc8 to your computer and use it in GitHub Desktop.
Save lamont-granquist/5a05c1bb19855de9b716bb9496cf2bc8 to your computer and use it in GitHub Desktop.
provides :email_alias
resource_name :email_alias
property :address, String, name: true, identity: true
property :recipients, Array
default_action :create
action :create do
with_run_context :root do
nr = new_resource # break out of the closure over the first call
edit_resource(:template, "/tmp/aliases") do
source 'aliases.erb'
variables[:aliases] ||= {}
variables[:aliases][nr.address] ||= []
variables[:aliases][nr.address] += nr.recipients
action :nothing
end
end
log "force delayed notification" do
notifies :create, "template[/tmp/aliases]", :delayed
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment