Merge branch 'dabelenda-fix_nil_rsyslog_version'

This commit is contained in:
Steffen Zieger 2016-08-02 12:18:00 +02:00
Родитель 0aca4fa5d8 01952801d5
Коммит 66cab47eeb
3 изменённых файлов: 94 добавлений и 2 удалений

Просмотреть файл

@ -181,4 +181,96 @@ describe 'rsyslog::server', :type => :class do
end
end
context "Rsyslog version = nil" do
let(:default_facts) do
{
:rsyslog_version => nil
}
end
['RedHat', 'Debian'].each do |osfamily|
context "osfamily = #{osfamily}" do
let :facts do
default_facts.merge!({
:osfamily => osfamily,
:operatingsystem => osfamily,
:operatingsystemmajrelease => '6',
})
end
context "default usage (osfamily = #{osfamily})" do
let(:title) { 'rsyslog-server-basic' }
it 'should compile' do
should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/)
should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end
end
context "enable_onefile (osfamily = #{osfamily})" do
let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'enable_onefile' => 'true'} }
it 'should compile' do
should_not contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/)
should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end
end
context "hostname_template (osfamily = #{osfamily})" do
let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} }
it 'should compile' do
should contain_file('/etc/rsyslog.d/server.conf').with_content(/%hostname%\/auth.log/)
should contain_file('/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/)
end
end
end
end
context "osfamily = FreeBSD" do
let :facts do
default_facts.merge!({
:osfamily => 'FreeBSD',
:operatingsystem => 'FreeBSD',
})
end
context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-server-basic' }
it 'should compile' do
should contain_file('/etc/syslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/)
should contain_file('/etc/syslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end
end
context "enable_onefile (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'enable_onefile' => 'true'} }
it 'should compile' do
should_not contain_file('/etc/syslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/)
should contain_file('/etc/syslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end
end
context "hostname_template (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} }
it 'should compile' do
should contain_file('/etc/syslog.d/server.conf').with_content(/%hostname%\/auth.log/)
should contain_file('/etc/syslog.d/server.conf').with_content(/%hostname%\/messages/)
end
end
end
end
end # describe 'rsyslog::server'

Просмотреть файл

@ -14,7 +14,7 @@ $InputTCPServerRun <%= scope.lookupvar('rsyslog::server::port') %>
<% end -%>
<% if scope.lookupvar('rsyslog::server::enable_relp') -%>
<% if @rsyslog_version and (scope.function_versioncmp([@rsyslog_version, '6.3.6']) >= 0) -%>
<% if (@rsyslog_version and (scope.function_versioncmp([@rsyslog_version, '6.3.6']) >= 0)) -%>
$InputRELPServerBindRuleset remote
$InputRELPServerRun <%= scope.lookupvar('rsyslog::server::relp_port') %>
<% end -%>

Просмотреть файл

@ -9,7 +9,7 @@ $ModLoad imtcp
<% end -%>
<% if scope.lookupvar('rsyslog::server::enable_relp') -%>
<% if @rsyslog_version and (scope.function_versioncmp([@rsyslog_version, '6.3.6']) >= 0) -%>
<% if (@rsyslog_version and (scope.function_versioncmp([@rsyslog_version, '6.3.6']) >= 0)) -%>
# Load RELP module
$ModLoad imrelp
<% end -%>