cutting rubocop offenses down to 32
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#
|
||||
# encoding: utf-8
|
||||
# Copyright:: Copyright (c) 2012, Opscode, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -14,14 +14,14 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe "postfix"
|
||||
include_recipe 'postfix'
|
||||
|
||||
execute "update-postfix-aliases" do
|
||||
command "newaliases"
|
||||
execute 'update-postfix-aliases' do
|
||||
command 'newaliases'
|
||||
action :nothing
|
||||
end
|
||||
|
||||
template node['postfix']['aliases_db'] do
|
||||
source "aliases.erb"
|
||||
notifies :run, "execute[update-postfix-aliases]"
|
||||
source 'aliases.erb'
|
||||
notifies :run, 'execute[update-postfix-aliases]'
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#
|
||||
# encoding: utf-8
|
||||
# Author:: Joshua Timberman(<joshua@opscode.com>)
|
||||
# Cookbook Name:: postfix
|
||||
# Recipe:: client
|
||||
@@ -24,19 +24,19 @@ if Chef::Config[:solo]
|
||||
end
|
||||
|
||||
query = "role:#{node['postfix']['relayhost_role']}"
|
||||
relayhost = ""
|
||||
relayhost = ''
|
||||
results = []
|
||||
|
||||
if node.run_list.roles.include?(node['postfix']['relayhost_role'])
|
||||
relayhost << node['ipaddress']
|
||||
elsif node['postfix']['multi_environment_relay']
|
||||
results = search(:node, query)
|
||||
relayhost = results.map {|n| n['ipaddress']}.first
|
||||
relayhost = results.map { |n| n['ipaddress'] }.first
|
||||
else
|
||||
results = search(:node, "#{query} AND chef_environment:#{node.chef_environment}")
|
||||
relayhost = results.map {|n| n['ipaddress']}.first
|
||||
relayhost = results.map { |n| n['ipaddress'] }.first
|
||||
end
|
||||
|
||||
node.set['postfix']['main']['relayhost'] = "[#{relayhost}]"
|
||||
|
||||
include_recipe "postfix"
|
||||
include_recipe 'postfix'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#
|
||||
# encoding: utf-8
|
||||
# Author:: Joshua Timberman(<joshua@opscode.com>)
|
||||
# Cookbook Name:: postfix
|
||||
# Recipe:: default
|
||||
@@ -18,35 +18,35 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package "postfix"
|
||||
package 'postfix'
|
||||
|
||||
if node['postfix']['use_procmail']
|
||||
package "procmail"
|
||||
package 'procmail'
|
||||
end
|
||||
|
||||
case node['platform_family']
|
||||
when "rhel", "fedora"
|
||||
service "sendmail" do
|
||||
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, "service[sendmail]"
|
||||
notifies :start, "service[postfix]"
|
||||
not_if "/usr/bin/test /etc/alternatives/mta -ef /usr/sbin/sendmail.postfix"
|
||||
execute 'switch_mailer_to_postfix' do
|
||||
command '/usr/sbin/alternatives --set mta /usr/sbin/sendmail.postfix'
|
||||
notifies :stop, 'service[sendmail]'
|
||||
notifies :start, 'service[postfix]'
|
||||
not_if '/usr/bin/test /etc/alternatives/mta -ef /usr/sbin/sendmail.postfix'
|
||||
end
|
||||
end
|
||||
|
||||
if !node['postfix']['sender_canonical_map_entries'].empty?
|
||||
template "#{node['postfix']['conf_dir']}/sender_canonical" do
|
||||
owner "root"
|
||||
owner 'root'
|
||||
group 0
|
||||
mode '0644'
|
||||
notifies :restart, "service[postfix]"
|
||||
notifies :restart, 'service[postfix]'
|
||||
end
|
||||
|
||||
if !node['postfix']['main'].has_key?('sender_canonical_maps')
|
||||
if !node['postfix']['main'].key?('sender_canonical_maps')
|
||||
node.set['postfix']['main']['sender_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/sender_canonical"
|
||||
end
|
||||
end
|
||||
@@ -54,16 +54,16 @@ end
|
||||
%w{main master}.each do |cfg|
|
||||
template "#{node['postfix']['conf_dir']}/#{cfg}.cf" do
|
||||
source "#{cfg}.cf.erb"
|
||||
owner "root"
|
||||
owner 'root'
|
||||
group 0
|
||||
mode 00644
|
||||
notifies :restart, "service[postfix]"
|
||||
variables(:settings => node['postfix'][cfg])
|
||||
notifies :restart, 'service[postfix]'
|
||||
variables(settings: node['postfix'][cfg])
|
||||
cookbook node['postfix']["#{cfg}_template_source"]
|
||||
end
|
||||
end
|
||||
|
||||
service "postfix" do
|
||||
supports :status => true, :restart => true, :reload => true
|
||||
service 'postfix' do
|
||||
supports status: true, restart: true, reload: true
|
||||
action [:enable, :start]
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Author:: Joshua Timberman(<joshua@opscode.com>)
|
||||
# Cookbook Name:: postfix
|
||||
@@ -18,42 +19,40 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe "postfix"
|
||||
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"
|
||||
when 'debian'
|
||||
sasl_pkgs = %w{libsasl2-2 libsasl2-modules ca-certificates}
|
||||
when "rhel"
|
||||
when 'rhel'
|
||||
if node['platform_version'].to_i < 6
|
||||
sasl_pkgs = %w{cyrus-sasl cyrus-sasl-plain openssl}
|
||||
else
|
||||
sasl_pkgs = %w{cyrus-sasl cyrus-sasl-plain ca-certificates}
|
||||
end
|
||||
when "fedora"
|
||||
when 'fedora'
|
||||
sasl_pkgs = %w{cyrus-sasl cyrus-sasl-plain ca-certificates}
|
||||
end
|
||||
|
||||
sasl_pkgs.each do |pkg|
|
||||
|
||||
package pkg
|
||||
|
||||
end
|
||||
|
||||
execute "postmap-sasl_passwd" do
|
||||
command "postmap /etc/postfix/sasl_passwd"
|
||||
execute 'postmap-sasl_passwd' do
|
||||
command 'postmap /etc/postfix/sasl_passwd'
|
||||
action :nothing
|
||||
end
|
||||
|
||||
template "/etc/postfix/sasl_passwd" do
|
||||
source "sasl_passwd.erb"
|
||||
owner "root"
|
||||
group "root"
|
||||
template '/etc/postfix/sasl_passwd' do
|
||||
source 'sasl_passwd.erb'
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode 0400
|
||||
notifies :run, "execute[postmap-sasl_passwd]", :immediately
|
||||
notifies :restart, "service[postfix]"
|
||||
variables(:settings => node['postfix']['sasl'])
|
||||
notifies :run, 'execute[postmap-sasl_passwd]', :immediately
|
||||
notifies :restart, 'service[postfix]'
|
||||
variables(settings: node['postfix']['sasl'])
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Author:: Joshua Timberman(<joshua@opscode.com>)
|
||||
# Cookbook Name:: postfix
|
||||
@@ -21,4 +22,4 @@
|
||||
node.override['postfix']['mail_type'] = 'master'
|
||||
node.override['postfix']['main']['inet_interfaces'] = 'all'
|
||||
|
||||
include_recipe "postfix"
|
||||
include_recipe 'postfix'
|
||||
|
||||
Reference in New Issue
Block a user