[COOK-3617] Fix no method chomp on NilClass attribute errors

The hostname/myhost/mydomain attributes try to chomp on a `nil` value, mainly the node["domain"] attribute. Additionally, || is used after a chomp, so empty string values will probably never hit the second half of the statement.

Signed-off-by: Seth Vargo <sethvargo@gmail.com>
This commit is contained in:
Christopher H. Laco 2013-09-30 18:59:58 -04:00 committed by Seth Vargo
parent 5e06cdc9a0
commit 5e975b5a10

View File

@ -36,8 +36,8 @@ end
# Non-default main.cf attributes # Non-default main.cf attributes
default['postfix']['main']['biff'] = "no" default['postfix']['main']['biff'] = "no"
default['postfix']['main']['append_dot_mydomain'] = "no" default['postfix']['main']['append_dot_mydomain'] = "no"
default['postfix']['main']['myhostname'] = node['fqdn'].chomp('.') || node['hostname'].chomp('.') default['postfix']['main']['myhostname'] = (node['fqdn'] || node['hostname']).to_s.chomp('.')
default['postfix']['main']['mydomain'] = node['domain'].chomp('.') || node['hostname'].chomp('.') default['postfix']['main']['mydomain'] = (node['domain'] || node['hostname']).to_s.chomp('.')
default['postfix']['main']['myorigin'] = "$myhostname" default['postfix']['main']['myorigin'] = "$myhostname"
default['postfix']['main']['mydestination'] = [ node['postfix']['main']['myhostname'], node['hostname'], "localhost.localdomain", "localhost" ].compact default['postfix']['main']['mydestination'] = [ node['postfix']['main']['myhostname'], node['hostname'], "localhost.localdomain", "localhost" ].compact
default['postfix']['main']['smtpd_use_tls'] = "yes" default['postfix']['main']['smtpd_use_tls'] = "yes"