Fixes for Travis CI

This commit is contained in:
Stanislav Voroniy 2015-09-11 14:37:33 +02:00
parent 1f7c62f8dc
commit c9613ac670
12 changed files with 33 additions and 47 deletions

View File

@ -5,6 +5,6 @@ metadata
group :integration do
cookbook 'apt'
cookbook 'yum'
cookbook 'fake', :path => 'test/fixtures/cookbooks/fake'
cookbook 'wrapper', :path => 'test/fixtures/cookbooks/wrapper'
cookbook 'fake', path: 'test/fixtures/cookbooks/fake'
cookbook 'wrapper', path: 'test/fixtures/cookbooks/wrapper'
end

View File

@ -36,4 +36,4 @@ group :development do
gem 'rake'
gem 'fauxhai'
gem 'pry-nav'
end
end

View File

@ -16,7 +16,7 @@
# limitations under the License.
# Generic cookbook attributes
default['postfix']['mail_type'] = 'client'
default['postfix']['mail_type'] = 'client'
default['postfix']['relayhost_role'] = 'relayhost'
default['postfix']['multi_environment_relay'] = false
default['postfix']['use_procmail'] = false
@ -145,4 +145,3 @@ end
if node['postfix']['use_relay_restirictions_maps']
default['postfix']['main']['smtpd_relay_restrictions'] = "hash:#{node['postfix']['relay_restrictions_db']}, reject"
end

View File

@ -57,7 +57,7 @@ when 'omnios'
# we don't guard this because if the user creation was successful (or happened out of band), then this won't get executed when the action is :nothing.
execute '/opt/omni/sbin/postfix set-permissions'
template manifest_path do
template manifest_path do
source 'manifest-postfix.xml.erb'
owner 'root'
group node['root_group']
@ -100,7 +100,7 @@ unless node['postfix']['smtp_generic_map_entries'].empty?
template "#{node['postfix']['conf_dir']}/smtp_generic" do
owner 'root'
group node['root_group']
mode '0644'
mode '0644'
notifies :run, 'execute[update-postfix-smtp_generic]'
notifies :reload, 'service[postfix]'
end

View File

@ -20,7 +20,7 @@ execute 'update-postfix-aliases' do
command 'newaliases'
environment PATH: "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
# On FreeBSD, /usr/sbin/newaliases is the sendmail command, and it's in the path before postfix's /usr/local/bin/newaliases
environment ({ 'PATH' => "/usr/local/bin:#{ENV['PATH']}" }) if platform_family?('freebsd')
environment('PATH' => "/usr/local/bin:#{ENV['PATH']}") if platform_family?('freebsd')
action :nothing
end

View File

@ -20,31 +20,16 @@
include_recipe 'postfix::_common'
if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes'
include_recipe 'postfix::sasl_auth'
end
include_recipe 'postfix::sasl_auth' if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes'
if node['postfix']['use_alias_maps']
include_recipe 'postfix::aliases'
end
include_recipe 'postfix::aliases' if node['postfix']['use_alias_maps']
if node['postfix']['use_transport_maps']
include_recipe 'postfix::transports'
end
include_recipe 'postfix::transports' if node['postfix']['use_transport_maps']
if node['postfix']['use_access_maps']
include_recipe 'postfix::access'
end
include_recipe 'postfix::access' if node['postfix']['use_access_maps']
if node['postfix']['use_virtual_aliases']
include_recipe 'postfix::virtual_aliases'
end
include_recipe 'postfix::virtual_aliases' if node['postfix']['use_virtual_aliases']
if node['postfix']['use_virtual_aliases_domains']
include_recipe 'postfix::virtual_aliases_domains'
end
if node['postfix']['use_relay_restrictions_maps']
include_recipe 'postfix::relay_restrictions'
end
include_recipe 'postfix::virtual_aliases_domains' if node['postfix']['use_virtual_aliases_domains']
include_recipe 'postfix::relay_restrictions' if node['postfix']['use_relay_restrictions_maps']

View File

@ -26,4 +26,3 @@ template node['postfix']['relay_restrictions_db'] do
source 'relay_restrictions.erb'
notifies :run, 'execute[update-postfix-relay-restrictions]'
end

View File

@ -15,6 +15,7 @@ describe 'wrapper::default' do
expect(chef_run.node['postfix']['main']['relayhost']).to eq('please')
expect(chef_run.node['postfix']['main']['smtp_sasl_security_options']).to eq('keep')
expect(chef_run.node['postfix']['sasl']['smtp_sasl_user_name']).to eq('us')
expect(chef_run.node['postfix']['sasl']['smtp_sasl_passwd']).to eq('happy')
end
end
end

View File

@ -1,6 +1,8 @@
default['postfix']['main']['smtp_sasl_auth_enable'] = 'yes'
default['postfix']['main']['relayhost'] = 'please'
default['postfix']['sasl']['smtp_sasl_user_name'] = 'keep'
default['postfix']['sasl']['smtp_sasl_passwd'] = 'us'
default['postfix']['main']['smtp_sasl_auth_enable'] = 'yes'
default['postfix']['main']['relayhost'] = 'please'
default['postfix']['main']['smtp_sasl_security_options'] = 'keep'
default['postfix']['sasl']['smtp_sasl_user_name'] = 'us'
default['postfix']['sasl']['smtp_sasl_passwd'] = 'happy'
default['postfix']['sender_canonical_map_entries'] = {}

View File

@ -1,3 +1,4 @@
name 'wrapper'
version '0.0.1'
description 'Wrapper cookbook, used for testing only.'
depends 'postfix'

View File

@ -1,2 +1,2 @@
include 'postfix'
include_recipe 'postfix'

View File

@ -3,25 +3,24 @@ require 'serverspec'
set :backend, :exec
set :path, '/sbin:/usr/local/sbin:$PATH'
def get_family
def which_family
fam = 'solaris2'
return fam unless File.exist? '/etc/release'
File.open("/etc/release") do |file|
while line = file.gets
case line
when /^\s*(OmniOS)/
fam = 'omnios'
end
File.open('/etc/release') do |file|
while (line = file.gets)
case line
when /^\s*(OmniOS)/
fam = 'omnios'
end
end
end
fam
end
def postfix_conf_path
if os[:family] == 'solaris' && get_family == 'omnios'
if os[:family] == 'solaris' && which_family == 'omnios'
'/opt/omni/etc/postfix/'
else
'/etc/postfix'
end
end