diff --git a/attributes/default.rb b/attributes/default.rb index 5778c5c..aae9886 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -121,26 +121,26 @@ end default['postfix']['master']['submission'] = false # OS Aliases -case node['platform'] -when 'freebsd' - default['postfix']['aliases'] = { - 'MAILER-DAEMON' => 'postmaster', - 'bin' => 'root', - 'daemon' => 'root', - 'named' => 'root', - 'nobody' => 'root', - 'uucp' => 'root', - 'www' => 'root', - 'ftp-bugs' => 'root', - 'postfix' => 'root', - 'manager' => 'root', - 'dumper' => 'root', - 'operator' => 'root', - 'abuse' => 'postmaster' - } -else - default['postfix']['aliases'] = {} -end +default['postfix']['aliases'] = case node['platform'] + when 'freebsd' + { + 'MAILER-DAEMON' => 'postmaster', + 'bin' => 'root', + 'daemon' => 'root', + 'named' => 'root', + 'nobody' => 'root', + 'uucp' => 'root', + 'www' => 'root', + 'ftp-bugs' => 'root', + 'postfix' => 'root', + 'manager' => 'root', + 'dumper' => 'root', + 'operator' => 'root', + 'abuse' => 'postmaster' + } + else + {} + end if node['postfix']['use_relay_restirictions_maps'] default['postfix']['main']['smtpd_relay_restrictions'] = "hash:#{node['postfix']['relay_restrictions_db']}, reject" diff --git a/metadata.rb b/metadata.rb index ca2e180..0dc02d8 100644 --- a/metadata.rb +++ b/metadata.rb @@ -20,4 +20,4 @@ recipe 'postfix::server', 'Sets the mail_type attribute to master' end source_url 'https://github.com/chef-cookbooks/postfix' if respond_to?(:issues_url) -issues_url 'https://github.com/chef-cookbooks/postfix/issues' if respond_to?(:source_url) \ No newline at end of file +issues_url 'https://github.com/chef-cookbooks/postfix/issues' if respond_to?(:source_url) diff --git a/recipes/aliases.rb b/recipes/aliases.rb index cd2eb3c..678b321 100644 --- a/recipes/aliases.rb +++ b/recipes/aliases.rb @@ -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') # rubocop: disable Lint/ParenthesesAsGroupedExpression action :nothing end diff --git a/recipes/sasl_auth.rb b/recipes/sasl_auth.rb index 519798d..7603d03 100644 --- a/recipes/sasl_auth.rb +++ b/recipes/sasl_auth.rb @@ -29,11 +29,11 @@ case node['platform_family'] when 'debian' sasl_pkgs = %w(libsasl2-2 libsasl2-modules ca-certificates) 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 + sasl_pkgs = if node['platform_version'].to_i < 6 + %w(cyrus-sasl cyrus-sasl-plain openssl) + else + %w(cyrus-sasl cyrus-sasl-plain ca-certificates) + end when 'fedora' sasl_pkgs = %w(cyrus-sasl cyrus-sasl-plain ca-certificates) end