Make foodcritic and rubocop happy again

This commit is contained in:
Stanislav Voroniy 2015-10-06 10:17:11 +02:00
parent 2b91f3513f
commit 0c0580f7e5
2 changed files with 14 additions and 18 deletions

View File

@ -3,7 +3,6 @@ source 'https://rubygems.org'
group :lint do group :lint do
gem 'foodcritic', '~> 4.0' gem 'foodcritic', '~> 4.0'
gem 'rubocop', '~> 0.33' gem 'rubocop', '~> 0.33'
gem 'rake'
end end
group :unit do group :unit do

View File

@ -16,32 +16,29 @@
node['postfix']['maps'].each do |type, maps| node['postfix']['maps'].each do |type, maps|
if node['platform_family'] == 'debian' if node['platform_family'] == 'debian'
if ['pgsql', 'mysql', 'ldap', 'cdb'].include?(type) package "postfix-#{type}" if %w(pgsql mysql ldap cdb).include?(type)
package "postfix-#{type}"
end
end end
if %w(pgsql mysql ldap memcache sqlite).include?(type)
separator = ' = '
else
separator = ' '
end
maps.each do |file, content| maps.each do |file, content|
if ['btree', 'cdb', 'dbm', 'hash', 'sdbm'].include?(type)
execute "update-postmap-#{file}" do execute "update-postmap-#{file}" do
command "postmap #{file}" command "postmap #{file}"
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')
action :nothing action :nothing
end end if %w(btree cdb dbm hash sdbm).include?(type)
end template "#{file}-#{type}" do
if ['pgsql', 'mysql', 'ldap', 'memcache', 'sqlite'].include?(type) path file
separator = " = "
else
separator = " "
end
template file do
source 'maps.erb' source 'maps.erb'
only_if "postconf -m | grep -q #{type}" only_if "postconf -m | grep -q #{type}"
variables( variables(
map: content, map: content,
separator: separator separator: separator
) )
if ['btree', 'cdb', 'dbm', 'hash', 'sdbm'].include?(type) if %w(btree cdb dbm hash sdbm).include?(type)
notifies :run, "execute[update-postmap-#{file}]" notifies :run, "execute[update-postmap-#{file}]"
end end
notifies :restart, 'service[postfix]' notifies :restart, 'service[postfix]'