[COOK-4423] - use platform_family, find cert.pem on rhel

Signed-off-by: Sean OMeara <someara@opscode.com>
This commit is contained in:
Eric G. Wolfe 2014-03-19 10:25:27 -04:00 committed by Sean OMeara
parent b2ee567e51
commit 6eccfa3d55
3 changed files with 40 additions and 1 deletions

View File

@ -55,7 +55,7 @@ default['postfix']['main']['mynetworks'] = '127.0.0.0/8'
default['postfix']['main']['inet_interfaces'] = 'loopback-only'
# Conditional attributes
case node['platform']
case node['platform_family']
when 'smartos'
default['postfix']['main']['smtpd_use_tls'] = 'no'
default['postfix']['main']['smtp_use_tls'] = 'no'

37
spec/default_spec.rb Normal file
View File

@ -0,0 +1,37 @@
require 'spec_helper'
describe 'postfix::default' do
before do
stub_command('/usr/bin/test /etc/alternatives/mta -ef /usr/sbin/sendmail.postfix').and_return(true)
end
context 'on Centos 6.5' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'centos', version: 6.5).converge(described_recipe)
end
it '[COOK-4423] renders file main.cf with /etc/pki/tls/cert.pem' do
expect(chef_run).to render_file('/etc/postfix/main.cf').with_content(%r{smtp_tls_CAfile += +/etc/pki/tls/cert.pem})
end
end
context 'on SmartOS' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'smartos', version: 'joyent_20130111T180733Z').converge(described_recipe)
end
it '[COOK-4423] renders file main.cf without smtp_use_tls' do
expect(chef_run).to render_file('/opt/local/etc/postfix/main.cf').with_content(%r{smtp_use_tls += +no})
end
end
context 'on Ubuntu 13.04' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'ubuntu', version: 13.04).converge(described_recipe)
end
it '[COOK-4423] renders file main.cf with /etc/postfix/cacert.pem' do
expect(chef_run).to render_file('/etc/postfix/main.cf').with_content(%r{smtp_tls_CAfile += +/etc/postfix/cacert.pem})
end
end
end

2
spec/spec_helper.rb Normal file
View File

@ -0,0 +1,2 @@
require 'chefspec'
require 'chefspec/berkshelf'