Skip to content

Commit

Permalink
(SIMP-4009) Add support for OEL and Puppet 5 (simp#66)
Browse files Browse the repository at this point in the history
* (SIMP-4009) Add support for OEL and Puppet 5
  • Loading branch information
trevor-vaughan authored and ayohrling committed Jul 13, 2018
1 parent 571dcc7 commit 96799b3
Show file tree
Hide file tree
Showing 11 changed files with 413 additions and 230 deletions.
506 changes: 312 additions & 194 deletions .gitlab-ci.yml

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ before_install:
- rm -f Gemfile.lock

jobs:
allow_failures:
- env: STRICT_VARIABLES=yes TRUSTED_NODE_DATA=yes PUPPET_VERSION="~> 5.0"

include:
- stage: check
rvm: 2.4.1
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Fri Jul 13 2018 Trevor Vaughan <[email protected]> - 7.2.0-0
- Add support for Puppet5 and OEL
- Update acceptance tests to use environment variables

* Thu Jun 28 2018 Nick Miller <[email protected]> - 7.1.3-0
- Update docs
- Update ci assets
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
class rsyslog::params {
$service_name = 'rsyslog'
if ($facts['os']['name'] in ['RedHat','CentOS']) and ($facts['os']['release']['major'] == '6') {
if ($facts['os']['name'] in ['RedHat','CentOS','OracleLinux']) and ($facts['os']['release']['major'] == '6') {
$package_name = 'rsyslog7'
$read_journald = false
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/selinux.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class rsyslog::server::selinux {
assert_private()

if ($facts['os']['name'] in ['RedHat','CentOS']) and ($facts['os']['release']['major'] > '6') {
if ($facts['os']['name'] in ['RedHat','CentOS','OracleLinux']) and ($facts['os']['release']['major'] > '6') {
if $facts['selinux_current_mode'] and $facts['selinux_current_mode'] != 'disabled' {
selboolean { 'nis_enabled':
persistent => true,
Expand Down
11 changes: 9 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simp-rsyslog",
"version": "7.1.3",
"version": "7.2.0",
"author": "SIMP Team",
"summary": "A puppet module to support RSyslog versions 7 and higher using new style RainerScript.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -56,12 +56,19 @@
"6",
"7"
]
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"6",
"7"
]
}
],
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 4.7.0 < 5.0.0"
"version_requirement": ">= 4.7.0 < 6.0.0"
}
]
}
18 changes: 14 additions & 4 deletions spec/acceptance/nodesets/default.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<%
if ENV['BEAKER_HYPERVISOR']
hypervisor = ENV['BEAKER_HYPERVISOR']
else
hypervisor = 'vagrant'
end
-%>
HOSTS:
client:
roles:
Expand All @@ -6,26 +13,29 @@ HOSTS:
- client
platform: el-7-x86_64
box: centos/7
hypervisor: vagrant
hypervisor: <%= hypervisor %>
server-1:
roles:
- server
platform: el-7-x86_64
box: centos/7
hypervisor: vagrant
hypervisor: <%= hypervisor %>
server-2:
roles:
- server
platform: el-6-x86_64
box: centos/6
hypervisor: vagrant
hypervisor: <%= hypervisor %>
server-3:
roles:
- failover_server
platform: el-7-x86_64
box: centos/7
hypervisor: vagrant
hypervisor: <%= hypervisor %>
CONFIG:
log_level: verbose
type: aio
vagrant_memsize: 256
<% if ENV['BEAKER_PUPPET_ENVIRONMENT'] -%>
puppet_environment: <%= ENV['BEAKER_PUPPET_ENVIRONMENT'] %>
<% end -%>
41 changes: 41 additions & 0 deletions spec/acceptance/nodesets/oel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<%
if ENV['BEAKER_HYPERVISOR']
hypervisor = ENV['BEAKER_HYPERVISOR']
else
hypervisor = 'vagrant'
end
-%>
HOSTS:
client:
roles:
- default
- master
- client
platform: el-7-x86_64
box: elastic/oel-7-x86_64
hypervisor: <%= hypervisor %>
server-1:
roles:
- server
platform: el-7-x86_64
box: elastic/oel-7-x86_64
hypervisor: <%= hypervisor %>
server-2:
roles:
- server
platform: el-6-x86_64
box: elastic/oel-6-x86_64
hypervisor: <%= hypervisor %>
server-3:
roles:
- failover_server
platform: el-7-x86_64
box: elastic/oel-7-x86_64
hypervisor: <%= hypervisor %>
CONFIG:
log_level: verbose
type: aio
vagrant_memsize: 256
<% if ENV['BEAKER_PUPPET_ENVIRONMENT'] -%>
puppet_environment: <%= ENV['BEAKER_PUPPET_ENVIRONMENT'] %>
<% end -%>
25 changes: 25 additions & 0 deletions spec/acceptance/suites/default/00_default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
let(:client){ only_host_with_role( hosts, 'client' ) }
let(:manifest) {
<<-EOS
# Turns off firewalld in EL7
include 'iptables'
iptables::listen::tcp_stateful { 'ssh':
dports => 22,
trusted_nets => ['any'],
}
class { 'rsyslog': pki => false }
EOS
}
Expand Down Expand Up @@ -120,6 +128,23 @@ class { 'rsyslog': pki => false }
end

it 'should collect iptables log messages in /var/log/iptables.log' do
# Trigger an iptables block event for the logs
require 'socket'
require 'timeout'

begin
Timeout::timeout(5) do
begin
s = TCPSocket.new(client.ip, 44)
sleep(1)
s.close
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
# This should be rejected
end
end
rescue Timeout::Error
end

# kern facility messages cannot be created by a user via logger,
# because the facility is automatically changed to user. So, the
# only way to test this is to cause an actual iptables drop.
Expand Down
15 changes: 0 additions & 15 deletions spec/acceptance/suites/default/01_client_server_no_tls_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@

describe 'rsyslog client -> 1 server without TLS' do

before(:context) do
hosts.each do |host|
interfaces = fact_on(host, 'interfaces').strip.split(',')
interfaces.delete_if do |x|
x =~ /^lo/
end

interfaces.each do |iface|
if fact_on(host, "ipaddress_#{iface}").strip.empty?
on(host, "ifup #{iface}", :accept_all_exit_codes => true)
end
end
end
end

let(:client){ only_host_with_role( hosts, 'client' ) }
let(:server){ hosts_with_role( hosts, 'server' ).first }
let(:client_fqdn){ fact_on( client, 'fqdn' ) }
Expand Down
16 changes: 6 additions & 10 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
context 'default parameters' do
rsyslog_package_name = 'rsyslog'

if ['RedHat','CentOS'].include?(os_facts[:operatingsystem])
if os_facts[:operatingsystemmajrelease] == '6'
rsyslog_package_name = 'rsyslog7'
end
if os_facts[:operatingsystemmajrelease] == '6'
rsyslog_package_name = 'rsyslog7'
end

let(:params) {{ }}
Expand Down Expand Up @@ -96,12 +94,10 @@
it { is_expected.to contain_class('rsyslog::config::logrotate') }
it { is_expected.to contain_logrotate__rule('syslog')}

if ['RedHat','CentOS'].include?(os_facts[:operatingsystem])
if os_facts[:operatingsystemmajrelease].to_s < '7'
it { should create_file('/etc/logrotate.d/syslog').with_content(/#{file_content_6}/)}
else
it { should create_file('/etc/logrotate.d/syslog').with_content(/#{file_content_7}/)}
end
if os_facts[:operatingsystemmajrelease].to_s < '7'
it { should create_file('/etc/logrotate.simp.d/syslog').with_content(/#{file_content_6}/)}
else
it { should create_file('/etc/logrotate.simp.d/syslog').with_content(/#{file_content_7}/)}
end
end

Expand Down

0 comments on commit 96799b3

Please sign in to comment.