Skip to content

Commit

Permalink
Merge pull request #422 from bigbam505/bm-nil-object-error
Browse files Browse the repository at this point in the history
Fix uniq for nil:NilClass error introduced in 3.2.2
  • Loading branch information
svanzoest committed Apr 27, 2016
2 parents 1e11c89 + 70a26c2 commit 2f594f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libraries/listen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ def self.converted_listen_ports_and_addresses(node)
return [] unless node['apache']['listen_ports'] || node['apache']['listen_addresses']
Chef::Log.warn "node['apache']['listen_ports'] and node['apache']['listen_addresses'] are deprecated in favor of node['apache']['listen']. Please adjust your cookbooks"

node['apache']['listen_addresses'].uniq.each_with_object([]) do |address, listen|
node['apache']['listen_ports'].uniq.each do |port|
# Defaults to * for addresses or 80 / 443 for ports if not specified
(node['apache']['listen_addresses'] || %w(*)).uniq.each_with_object([]) do |address, listen|
(node['apache']['listen_ports'] || %w(80 443)).uniq.each do |port|
listen << "#{address}:#{port}"
end
end
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/cookbooks/apache2_test/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# limitations under the License.
#

default['apache']['listen_ports'] = ['80']
default['apache_test']['auth_username'] = 'bork'
default['apache_test']['auth_password'] = 'secret'
default['apache_test']['cache_expiry_seconds'] = 60
Expand Down

0 comments on commit 2f594f9

Please sign in to comment.