Skip to content

Commit

Permalink
Clarify README example and add basic spec test for log_server entries…
Browse files Browse the repository at this point in the history
… with port values.
  • Loading branch information
greigm committed Jul 14, 2016
1 parent 7f453aa commit 69f307a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ Transport protocol used by rsyslog. Valid values are 'tcp' and 'udp'

log_server
----------
String or array of server to send logs to if remote_logging is true.
String or array of server to send logs to if remote_logging is true. May include an optional port number if you wish to override the log_server_port value for an entry.

*Example:*
<pre>
Expand All @@ -346,6 +346,7 @@ _OR_
rsyslog::log_server:
- 'log1'
- 'log2:1514'
- 'log3:2514'
</pre>

- *Default*: "log.${::domain}"
Expand Down
8 changes: 6 additions & 2 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp.so$/) }
end

['logserver', %w(logserver1 logserver2)].each do |values|
['logserver', %w(logserver1 logserver2 logserver3:1514 logserver4:2514)].each do |values|
context "with remote_logging enabled and log_server=#{values} (as #{values.class})" do
let :params do
{
Expand All @@ -261,7 +261,11 @@

if values.class == Array
values.each do |value|
it { should contain_file('rsyslog_config').with_content(/^\*\.\* @@#{value}:514$/) }
if value.include? ":"
it { should contain_file('rsyslog_config').with_content(/^\*\.\* @@#{value}$/) }
else
it { should contain_file('rsyslog_config').with_content(/^\*\.\* @@#{value}:514$/) }
end
end
else
it { should contain_file('rsyslog_config').with_content(/^\*\.\* @@logserver:514$/) }
Expand Down

0 comments on commit 69f307a

Please sign in to comment.