-
-
Save lamont-granquist/5a05c1bb19855de9b716bb9496cf2bc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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