From 3485a81fab0c4d725cbb04f15fe691ba096961c4 Mon Sep 17 00:00:00 2001 From: elliotkendallUCSF Date: Wed, 9 Oct 2013 17:27:56 -0400 Subject: [PATCH] [COOK-2551] Support creating the `sender_canonical` map file Signed-off-by: Seth Vargo --- attributes/default.rb | 1 + recipes/default.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/attributes/default.rb b/attributes/default.rb index 039423f..7851fe5 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -23,6 +23,7 @@ default['postfix']['use_procmail'] = false default['postfix']['aliases'] = {} default['postfix']['main_template_source'] = "postfix" default['postfix']['master_template_source'] = "postfix" +default['postfix']['sender_canonical_map_entries'] = {} case node['platform'] when 'smartos' diff --git a/recipes/default.rb b/recipes/default.rb index cbdcc7c..4a2497d 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -38,6 +38,19 @@ when "rhel", "fedora" end end +if !node['postfix']['sender_canonical_map_entries'].empty? + template "#{node['postfix']['conf_dir']}/sender_canonical" do + owner "root" + group 0 + mode '0644' + notifies :restart, "service[postfix]" + end + + if !node['postfix']['main'].has_key?('sender_canonical_maps') + node.set['postfix']['main']['sender_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/sender_canonical" + end +end + %w{main master}.each do |cfg| template "#{node['postfix']['conf_dir']}/#{cfg}.cf" do source "#{cfg}.cf.erb"