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 group :integration do
cookbook 'apt' cookbook 'apt'
cookbook 'yum' cookbook 'yum'
cookbook 'fake', :path => 'test/fixtures/cookbooks/fake' cookbook 'fake', path: 'test/fixtures/cookbooks/fake'
cookbook 'wrapper', :path => 'test/fixtures/cookbooks/wrapper' cookbook 'wrapper', path: 'test/fixtures/cookbooks/wrapper'
end end

View File

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

View File

@ -16,7 +16,7 @@
# limitations under the License. # limitations under the License.
# Generic cookbook attributes # Generic cookbook attributes
default['postfix']['mail_type'] = 'client' default['postfix']['mail_type'] = 'client'
default['postfix']['relayhost_role'] = 'relayhost' default['postfix']['relayhost_role'] = 'relayhost'
default['postfix']['multi_environment_relay'] = false default['postfix']['multi_environment_relay'] = false
default['postfix']['use_procmail'] = false default['postfix']['use_procmail'] = false
@ -145,4 +145,3 @@ end
if node['postfix']['use_relay_restirictions_maps'] if node['postfix']['use_relay_restirictions_maps']
default['postfix']['main']['smtpd_relay_restrictions'] = "hash:#{node['postfix']['relay_restrictions_db']}, reject" default['postfix']['main']['smtpd_relay_restrictions'] = "hash:#{node['postfix']['relay_restrictions_db']}, reject"
end 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. # 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' execute '/opt/omni/sbin/postfix set-permissions'
template manifest_path do template manifest_path do
source 'manifest-postfix.xml.erb' source 'manifest-postfix.xml.erb'
owner 'root' owner 'root'
group node['root_group'] group node['root_group']
@ -100,7 +100,7 @@ unless node['postfix']['smtp_generic_map_entries'].empty?
template "#{node['postfix']['conf_dir']}/smtp_generic" do template "#{node['postfix']['conf_dir']}/smtp_generic" do
owner 'root' owner 'root'
group node['root_group'] group node['root_group']
mode '0644' mode '0644'
notifies :run, 'execute[update-postfix-smtp_generic]' notifies :run, 'execute[update-postfix-smtp_generic]'
notifies :reload, 'service[postfix]' notifies :reload, 'service[postfix]'
end end

View File

@ -20,7 +20,7 @@ execute 'update-postfix-aliases' do
command 'newaliases' command 'newaliases'
environment PATH: "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios') 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 # 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 action :nothing
end end

View File

@ -20,31 +20,16 @@
include_recipe 'postfix::_common' include_recipe 'postfix::_common'
if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes' include_recipe 'postfix::sasl_auth' if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes'
include_recipe 'postfix::sasl_auth'
end
if node['postfix']['use_alias_maps'] include_recipe 'postfix::aliases' if node['postfix']['use_alias_maps']
include_recipe 'postfix::aliases'
end
if node['postfix']['use_transport_maps'] include_recipe 'postfix::transports' if node['postfix']['use_transport_maps']
include_recipe 'postfix::transports'
end
if node['postfix']['use_access_maps'] include_recipe 'postfix::access' if node['postfix']['use_access_maps']
include_recipe 'postfix::access'
end
if node['postfix']['use_virtual_aliases'] include_recipe 'postfix::virtual_aliases' if node['postfix']['use_virtual_aliases']
include_recipe 'postfix::virtual_aliases'
end
if node['postfix']['use_virtual_aliases_domains'] include_recipe 'postfix::virtual_aliases_domains' 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::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' source 'relay_restrictions.erb'
notifies :run, 'execute[update-postfix-relay-restrictions]' notifies :run, 'execute[update-postfix-relay-restrictions]'
end 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']['relayhost']).to eq('please')
expect(chef_run.node['postfix']['main']['smtp_sasl_security_options']).to eq('keep') 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_user_name']).to eq('us')
expect(chef_run.node['postfix']['sasl']['smtp_sasl_passwd']).to eq('happy')
end end
end end
end end

View File

@ -1,6 +1,8 @@
default['postfix']['main']['smtp_sasl_auth_enable'] = 'yes' default['postfix']['main']['smtp_sasl_auth_enable'] = 'yes'
default['postfix']['main']['relayhost'] = 'please' default['postfix']['main']['relayhost'] = 'please'
default['postfix']['sasl']['smtp_sasl_user_name'] = 'keep' default['postfix']['main']['smtp_sasl_security_options'] = 'keep'
default['postfix']['sasl']['smtp_sasl_passwd'] = 'us' 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' name 'wrapper'
version '0.0.1' version '0.0.1'
description 'Wrapper cookbook, used for testing only.' 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 :backend, :exec
set :path, '/sbin:/usr/local/sbin:$PATH' set :path, '/sbin:/usr/local/sbin:$PATH'
def get_family def which_family
fam = 'solaris2' fam = 'solaris2'
return fam unless File.exist? '/etc/release' return fam unless File.exist? '/etc/release'
File.open("/etc/release") do |file| File.open('/etc/release') do |file|
while line = file.gets while (line = file.gets)
case line case line
when /^\s*(OmniOS)/ when /^\s*(OmniOS)/
fam = 'omnios' fam = 'omnios'
end
end end
end
end end
fam fam
end end
def postfix_conf_path def postfix_conf_path
if os[:family] == 'solaris' && get_family == 'omnios' if os[:family] == 'solaris' && which_family == 'omnios'
'/opt/omni/etc/postfix/' '/opt/omni/etc/postfix/'
else else
'/etc/postfix' '/etc/postfix'
end end
end end