From 14fc7d79191c95538bfc2208ceaea028e7348397 Mon Sep 17 00:00:00 2001 From: Mick Brooks Date: Wed, 19 Feb 2014 01:06:56 -0500 Subject: [PATCH] [COOK-4322]: Fix the default path for the sasl_passwd file Signed-off-by: Sean OMeara --- attributes/default.rb | 3 ++- files/default/tests/minitest/sasl_auth_test.rb | 4 ++++ recipes/sasl_auth.rb | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 1473d75..75430c5 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -79,7 +79,8 @@ if node['postfix']['main']['smtp_use_tls'] == 'yes' end if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes' - default['postfix']['main']['smtp_sasl_password_maps'] = "hash:#{node['postfix']['conf_dir']}/postfix/sasl_passwd" + default['postfix']['sasl_password_file'] = "#{node['postfix']['conf_dir']}/sasl_passwd" + default['postfix']['main']['smtp_sasl_password_maps'] = "hash:#{node['postfix']['sasl_password_file']}" default['postfix']['main']['smtp_sasl_security_options'] = 'noanonymous' default['postfix']['sasl']['smtp_sasl_user_name'] = '' default['postfix']['sasl']['smtp_sasl_passwd'] = '' diff --git a/files/default/tests/minitest/sasl_auth_test.rb b/files/default/tests/minitest/sasl_auth_test.rb index 2563bcc..676befd 100644 --- a/files/default/tests/minitest/sasl_auth_test.rb +++ b/files/default/tests/minitest/sasl_auth_test.rb @@ -22,4 +22,8 @@ describe 'postfix::sasl_auth' do file('/etc/postfix/sasl_passwd').must_match(/^# This file is generated by Chef for/) end + it 'configures postfix to use /etc/postfix/sasl_passwd' do + file('/etc/postfix/main.cf').must_match(/^\s*smtp_sasl_password_maps\s*=.*\/etc\/postfix\/sasl_passwd\s*$/) + end + end diff --git a/recipes/sasl_auth.rb b/recipes/sasl_auth.rb index aca5c26..d84124a 100644 --- a/recipes/sasl_auth.rb +++ b/recipes/sasl_auth.rb @@ -43,11 +43,11 @@ sasl_pkgs.each do |pkg| end execute 'postmap-sasl_passwd' do - command 'postmap /etc/postfix/sasl_passwd' + command "postmap #{node['postfix']['sasl_password_file']}" action :nothing end -template '/etc/postfix/sasl_passwd' do +template node['postfix']['sasl_password_file'] do source 'sasl_passwd.erb' owner 'root' group 'root'