[COOK-1792] - add minitest-chef tests
* Create minitest-chef tests * Also use better style (don't specify action if its the default, use 5 digit modes, update notification syntax)
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
#
|
||||
# Copyright:: Copyright (c) 2012, Opscode, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
require_recipe "postfix"
|
||||
|
||||
execute "update-postfix-aliases" do
|
||||
@@ -7,7 +23,5 @@ end
|
||||
|
||||
template "/etc/aliases" do
|
||||
source "aliases.erb"
|
||||
notifies :run, resources("execute[update-postfix-aliases]")
|
||||
#notifies :reload, resources(:service => "postfix")
|
||||
notifies :run, "execute[update-postfix-aliases]"
|
||||
end
|
||||
|
||||
|
||||
@@ -18,14 +18,12 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package "postfix" do
|
||||
action :install
|
||||
end
|
||||
package "postfix"
|
||||
|
||||
if node['postfix']['use_procmail']
|
||||
|
||||
package "procmail"
|
||||
|
||||
if node['postfix']['use_procmail'] then
|
||||
package "procmail" do
|
||||
action :install
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -34,26 +32,31 @@ service "postfix" do
|
||||
action :enable
|
||||
end
|
||||
|
||||
case node[:platform]
|
||||
when "redhat", "centos", "amazon", "scientific"
|
||||
case node['platform_family']
|
||||
when "rhel", "fedora"
|
||||
|
||||
service "sendmail" do
|
||||
action :nothing
|
||||
end
|
||||
|
||||
execute "switch_mailer_to_postfix" do
|
||||
command "/usr/sbin/alternatives --set mta /usr/sbin/sendmail.postfix"
|
||||
notifies :stop, resources(:service => "sendmail")
|
||||
notifies :start, resources(:service => "postfix")
|
||||
notifies :stop, "service[sendmail]"
|
||||
notifies :start, "service[postfix]"
|
||||
not_if "/usr/bin/test /etc/alternatives/mta -ef /usr/sbin/sendmail.postfix"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
%w{main master}.each do |cfg|
|
||||
|
||||
template "/etc/postfix/#{cfg}.cf" do
|
||||
source "#{cfg}.cf.erb"
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 0644
|
||||
notifies :restart, resources(:service => "postfix")
|
||||
group 0
|
||||
mode 00644
|
||||
notifies :restart, "service[postfix]"
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -18,10 +18,29 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
%w{ libsasl2-2 ca-certificates}.each do |pkg|
|
||||
package pkg do
|
||||
action :install
|
||||
include_recipe "postfix"
|
||||
|
||||
sasl_pkgs = []
|
||||
|
||||
# We use case instead of value_for_platform_family because we need
|
||||
# version specifics for RHEL.
|
||||
case node['platform_family']
|
||||
when "debian"
|
||||
sasl_pkgs = %w{libsasl2-2 ca-certificates}
|
||||
when "rhel"
|
||||
if node['platform_version'].to_i < 6
|
||||
sasl_pkgs = %w{cyrus-sasl openssl}
|
||||
else
|
||||
sasl_pkgs = %w{cyrus-sasl ca-certificates}
|
||||
end
|
||||
when "fedora"
|
||||
sasl_pkgs = %w{cyrus-sasl ca-certificates}
|
||||
end
|
||||
|
||||
sasl_pkgs.each do |pkg|
|
||||
|
||||
package pkg
|
||||
|
||||
end
|
||||
|
||||
execute "postmap-sasl_passwd" do
|
||||
@@ -34,7 +53,6 @@ template "/etc/postfix/sasl_passwd" do
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 0400
|
||||
notifies :run, resources(:execute => "postmap-sasl_passwd"), :immediately
|
||||
notifies :restart, resources(:service => "postfix")
|
||||
notifies :run, "execute[postmap-sasl_passwd]", :immediately
|
||||
notifies :restart, "service[postfix]"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user