Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifests/broker/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
owner => $user_name,
group => $group_name,
mode => $config_mode,
content => template('kafka/properties.erb'),
content => epp('kafka/properties.epp', { 'doctag' => $doctag, 'config' => $config }),
notify => $config_notify,
require => File[$config_dir],
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/consumer/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
owner => $user_name,
group => $group_name,
mode => $config_mode,
content => template('kafka/properties.erb'),
content => epp('kafka/properties.epp', { 'doctag' => $doctag, 'config' => $config }),
notify => $config_notify,
require => File[$config_dir],
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/producer/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
owner => $user_name,
group => $group_name,
mode => $config_mode,
content => template('kafka/properties.erb'),
content => epp('kafka/properties.epp', { 'doctag' => $doctag, 'config' => $config }),
notify => $config_notify,
require => File[$config_dir],
}
Expand Down
35 changes: 34 additions & 1 deletion spec/classes/broker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,40 @@

describe 'kafka::broker::config' do
context 'defaults' do
it { is_expected.to contain_file('/opt/kafka/config/server.properties') }
it {
is_expected.to contain_file('/opt/kafka/config/server.properties').
with_content(%r{zookeeper.connect=localhost:2181})
}
end

context 'array values' do
let(:params) do
{
'config' => {
'listeners' => ['PLAINTEXT://:9092', 'SSL://:9093'],
}
}
end

it {
is_expected.to contain_file('/opt/kafka/config/server.properties').
with_content(%r{^listeners=PLAINTEXT://:9092,SSL://:9093$})
}
end

context 'special delimiter for super.users' do
let(:params) do
{
'config' => {
'super.users' => ['User:Alice', 'User:Bob'],
}
}
end

it {
is_expected.to contain_file('/opt/kafka/config/server.properties').
with_content(%r{^super.users=User:Alice;User:Bob$})
}
end

context 'with manage_log4j => true' do
Expand Down
14 changes: 14 additions & 0 deletions templates/properties.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<%- |
String $doctag,
Hash $config
| -%>
#
# Note: This file is managed by Puppet.
#
# See: http://kafka.apache.org/documentation.html#<%= $doctag %> for more details
#
<% $config.keys.sort.each |$k| { -%>
<% $v = $config[$k] -%>
<% if $k == 'super.users' { $delimiter = ';' } else { $delimiter = ',' } -%>
<%= $k %>=<%= if $v =~ Array { $v.join($delimiter) } else { $v } %>
<% } -%>
10 changes: 0 additions & 10 deletions templates/properties.erb

This file was deleted.

Loading