From 96799b34f1b33f0fb98f93bf438637345ffc0380 Mon Sep 17 00:00:00 2001 From: Trevor Vaughan Date: Fri, 13 Jul 2018 13:10:09 -0400 Subject: [PATCH] (SIMP-4009) Add support for OEL and Puppet 5 (#66) * (SIMP-4009) Add support for OEL and Puppet 5 --- .gitlab-ci.yml | 506 +++++++++++------- .travis.yml | 3 - CHANGELOG | 4 + manifests/params.pp | 2 +- manifests/server/selinux.pp | 2 +- metadata.json | 11 +- spec/acceptance/nodesets/default.yml | 18 +- spec/acceptance/nodesets/oel.yml | 41 ++ .../suites/default/00_default_spec.rb | 25 + .../default/01_client_server_no_tls_spec.rb | 15 - spec/classes/init_spec.rb | 16 +- 11 files changed, 413 insertions(+), 230 deletions(-) create mode 100644 spec/acceptance/nodesets/oel.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c89fb49..de8d054 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,242 +1,360 @@ -# The testing matrix considers ruby/puppet versions supported by SIMP and PE: -# -# https://puppet.com/docs/pe/2017.3/overview/component_versions_in_recent_pe_releases.html -# https://puppet.com/misc/puppet-enterprise-lifecycle -# https://puppet.com/docs/pe/2017.3/overview/getting_support_for_pe.html#standard-releases-and-long-term-support-releases -# ------------------------------------------------------------------------------ -# release pup ruby eol -# PE 2016.4 4.7 2.1.9 2018-10 (LTS) -# SIMP6.0.0 4.8 2.1.9 TBD -# PE 2017.2 4.10 2.1.9 2018-02-21 -# PE 2017.3 5.3 2.4.1 2018-07 -# PE 2018.1 ??? ????? ????-?? (LTS) --- -.cache_bundler: &cache_bundler - cache: - untracked: true - # A broad attempt at caching between runs (ala Travis CI) - key: "${CI_PROJECT_NAMESPACE}__bundler" - paths: - - '.vendor' - - 'vendor' -.setup_bundler_env: &setup_bundler_env - before_script: - - 'echo Files in cache: $(find .vendor | wc -l) || :' - - 'export GEM_HOME=.vendor/gem_install' - - 'export BUNDLE_CACHE_PATH=.vendor/bundler' - - 'declare GEM_BUNDLER_VER=(-v ''~> ${BUNDLER_VERSION:-1.16.0}'')' - - declare GEM_INSTALL=(gem install --no-document) - - declare BUNDLER_INSTALL=(bundle install --no-binstubs --jobs $(nproc) --path=.vendor "${FLAGS[@]}") - - gem list -ie "${GEM_BUNDLE_VER[@]}" --silent bundler || "${GEM_INSTALL[@]}" --local "${GEM_BUNDLE_VER[@]}" bundler || "${GEM_INSTALL[@]}" "${GEM_BUNDLE_VER[@]}" bundler - - 'rm -rf pkg/ || :' - - bundle check || rm -f Gemfile.lock && ("${BUNDLER_INSTALL[@]}" --local || "${BUNDLER_INSTALL[@]}") +#======================================================================= +# Global stuff +stages: + - 'sanity' + - 'lint' + - 'unit' + - 'acceptance' + - 'deployment' + +# Default versions are set only as fallbacks for jobs that don't care which +# version they use. Versions should be explicitly set in any job with specific +# version requirements, even if they match these defaults. +image: 'ruby:2.1' +variables: + PUPPET_VERSION: '~> 4.10.0' + BUNDLER_VERSION: '' # Unset this in case it's defined on the runner + BUNDLER_EXTRA_ARGS: '--without development system_tests' + MODULE_NAME: "$(ruby -r json -e 'JSON.load(File.read('metadata.json'))['name']')" + MODULE_VERSION: "$(ruby -r json -e 'JSON.load(File.read('metadata.json'))['version']')" + GEM_HOME: '${CI_PROJECT_DIR}/vendor/ruby' # Isolate the Ruby Gems environment + GEM_PATH: '$GEM_HOME' + +before_script: + - 'PATH="${GEM_HOME}/bin:${PATH}"; export PATH' + - '[ "$BUNDLER_VERSION" ] && BUNDLER_VERSION_ARGS="-v $BUNDLER_VERSION"; export BUNDLER_VERSION_ARGS' + - 'ruby -v' + - 'gem environment' + - 'gem sources -u' + - 'gem install bundler --no-document $BUNDLER_VERSION_ARGS' + - 'bundle install -j "$(nproc)" --no-binstubs --path vendor $BUNDLER_EXTRA_ARGS' + +cache: + key: '${CI_COMMIT_REF_SLUG}' + paths: + - 'vendor/ruby' +#======================================================================= +# Anchors -.validation_checks: &validation_checks +.lint_base: &lint_base + stage: 'lint' + tags: ['docker'] script: - - bundle exec rake syntax - - bundle exec rake check:dot_underscore - - bundle exec rake check:test_file - - bundle exec rake pkg:check_version - - bundle exec rake pkg:compare_latest_tag - - bundle exec rake lint - - bundle exec rake clean - - bundle exec puppet module build + - 'bundle exec rake syntax' + - 'bundle exec rake lint' + cache: + policy: 'pull' + dependencies: [] + artifacts: + when: 'always' + paths: + - 'Gemfile.lock' -.spec_tests: &spec_tests +.unit_base: &unit_base + stage: 'unit' + tags: ['docker'] + variables: + STRINGIFY_FACTS: 'no' + TRUSTED_NODE_DATA: 'yes' script: - - bundle exec rake spec + - 'bundle exec rake spec' + cache: + policy: 'pull' + dependencies: [] + artifacts: + when: 'always' + paths: + - 'Gemfile.lock' -stages: - - validation - - unit - - acceptance - - deploy - -# Puppet 4.7 for PE 2016.4 LTS Support (EOL: 2018-10-21) -# See: https://puppet.com/misc/puppet-enterprise-lifecycle -# -------------------------------------- -pup4_7-validation: - stage: validation - tags: - - docker - image: ruby:2.1 +.acceptance_base: &acceptance_base + stage: 'acceptance' + tags: ['beaker'] variables: - PUPPET_VERSION: '~> 4.7.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *validation_checks + BUNDLER_EXTRA_ARGS: '--without development' + cache: + policy: 'pull' + dependencies: [] + artifacts: + when: 'always' + paths: + - 'Gemfile.lock' -pup4_7-unit: - stage: unit - tags: - - docker - image: ruby:2.1 +# ---------------------------------------------------------------------- +# Version Matrix +# +# It would be too expensive, both in time and compute resources, to test +# against every last version combination, so we restrict it to a subset. +# Version sets are selected based on current support policies for major platform +# software, such as Puppet and Ruby. Namely, we use the version combinations +# bundled in Puppet Enterprise. +# +# For more information see: +# * https://puppet.com/docs/pe/latest/overview/component_versions_in_recent_pe_releases.html +# * https://puppet.com/misc/puppet-enterprise-lifecycle +# * https://puppet.com/docs/pe/latest/overview/getting_support_for_pe.html#standard-releases-and-long-term-support-releases +# +# | Release | Puppet | Ruby | End-of-Life Date | +# |-----------|--------|------|------------------| +# | PE 2016.4 | 4.7* | 2.1 | 2018-10 +# | PE 2016.5 | 4.8 | 2.1 | 2017-05 +# | SIMP 6.0 | 4.8 | 2.1 | TBD +# | PE 2017.1 | 4.9 | 2.1 | 2017-10 +# | PE 2017.2 | 4.10 | 2.1 | 2018-02 +# | SIMP 6.1 | 4.10 | 2.1 | TBD +# | PE 2017.3 | 5.3 | 2.4 | 2018-08 +# | PE 2018.1 | 5.5 | 2.4 | 2020-05 +# +# * PE 2016.4 released with Puppet 4.7.0, but upgraded to the 4.10 series +# starting with 2016.4.5. +# + +.pe_2016_4: &pe_2016_4 variables: PUPPET_VERSION: '~> 4.7.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *spec_tests +.simp_6_0: &simp_6_0 + variables: + PUPPET_VERSION: '~> 4.8.1' -# Puppet 4.8 for SIMP 6.0 + 6.1 support -# -------------------------------------- -pup4_8-validation: - stage: validation - tags: - - docker - image: ruby:2.1 +.simp_6_1: &simp_6_1 variables: - PUPPET_VERSION: '~> 4.8.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *validation_checks + PUPPET_VERSION: '~> 4.10.8' -pup4_8-unit: - stage: unit - tags: - - docker - image: ruby:2.1 +.pe_2017_3: &pe_2017_3 variables: - PUPPET_VERSION: '~> 4.8.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *spec_tests + BEAKER_PUPPET_COLLECTION: 'puppet5' + PUPPET_VERSION: '~> 5.3.2' +.pe_2018_1: &pe_2018_1 + variables: + BEAKER_PUPPET_COLLECTION: 'puppet5' + PUPPET_VERSION: '~> 5.5.1' -# Puppet 4.10 for PE 2017.2 support (EOL:2018-02-21) -# See: https://puppet.com/misc/puppet-enterprise-lifecycle -# -------------------------------------- -pup4_10-validation: - stage: validation - tags: - - docker - image: ruby:2.1 +.pup4_latest: &pup4_latest variables: - PUPPET_VERSION: '~> 4.10.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *validation_checks + PUPPET_VERSION: '~> 4.0' -pup4_10-unit: - stage: unit - tags: - - docker - image: ruby:2.1 +.pup5_latest: &pup5_latest variables: - PUPPET_VERSION: '~> 4.10.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *spec_tests + BEAKER_PUPPET_COLLECTION: 'puppet5' + PUPPET_VERSION: '~> 5.0' -# Puppet 5.3 for PE 2017.3 support (EOL: 2018-07) -# See: https://puppet.com/misc/puppet-enterprise-lifecycle -# -------------------------------------- -pup5_3-validation: - stage: validation - tags: - - docker - image: ruby:2.4 - variables: - PUPPET_VERSION: '~> 5.3.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *validation_checks - allow_failure: true +#======================================================================= +# Basic Sanity Checks +# -pup5_3-unit: - stage: unit - tags: - - docker - image: ruby:2.4 - variables: - PUPPET_VERSION: '~> 5.3.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *spec_tests - allow_failure: true +# Execute simple sanity checks on the environment before proceeding to more +# resource-intensive jobs. Besides running checks, this condenses the initial +# cache generation into a single job for the later stages. The first stage, +# in particular, would otherwise suffer a heavy cache-miss penalty as its +# jobs kick off in parallel. +sanity_checks: + stage: 'sanity' + tags: ['docker'] + script: + - 'bundle exec rake check:dot_underscore' + - 'bundle exec rake check:test_file' + - 'bundle exec rake pkg:check_version' + - 'bundle exec rake pkg:compare_latest_tag' +tag_check: + stage: 'sanity' + only: ['tags'] + tags: ['docker'] + script: '[ "$CI_COMMIT_TAG" = "$MODULE_VERSION" ] || ( echo "ERROR: Tag does not match metadata version" && exit 1 )' -# Keep an eye on the latest puppet 5 -# ---------------------------------- -pup5_latest-validation: - stage: validation - tags: - - docker - image: ruby:2.4 - variables: - PUPPET_VERSION: '~> 5.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *validation_checks - allow_failure: true +#======================================================================= +# Lint Tests +# + +# Linting, for the most part, isn't affected by version changes in Puppet, +# so we only test against the latest version for each MAJOR release. +pup4_latest-lint: + <<: *lint_base + <<: *pup4_latest + image: 'ruby:2.1' + +pup5_latest-lint: + <<: *lint_base + <<: *pup5_latest + image: 'ruby:2.4' + +#======================================================================= +# Unit Test Matrix +# + +# ---------------------------------------------------------------------- +# Puppet 4.7 for early releases of PE 2016.4 LTS +pup4_7-unit: + <<: *unit_base + <<: *pe_2016_4 + image: 'ruby:2.1' + +# ---------------------------------------------------------------------- +# Puppet 4.8 for SIMP 6 and PE 2016.5 +pup4_8-unit: + <<: *unit_base + <<: *simp_6_0 + image: 'ruby:2.1' + +# ---------------------------------------------------------------------- +# Puppet 4.10 for SIMP 6.1, PE 2016.4 LTS, and 2017.2 +pup4_10-unit: + <<: *unit_base + <<: *simp_6_1 + image: 'ruby:2.1' + +# ---------------------------------------------------------------------- +# Puppet 5.3 for PE 2017.3 +pup5_3-unit: + <<: *unit_base + <<: *pe_2017_3 + image: 'ruby:2.4' + +# ---------------------------------------------------------------------- +# Puppet 5.5 for PE 2018.1 LTS +pup5_5-unit: + <<: *unit_base + <<: *pe_2018_1 + image: 'ruby:2.4' + +# ---------------------------------------------------------------------- +# Keep an eye on the latest Puppet 5.x release pup5_latest-unit: - stage: unit - tags: - - docker - image: ruby:2.4 + <<: *unit_base + <<: *pup5_latest + image: 'ruby:2.4' + + +# ============================================================================== +# Acceptance tests +# + +# Because acceptance tests are so much more expensive than other tests, this +# test matrix is even more limited. Here we stick to versions supported +# by non-EOL meta-releases of SIMP and LTS versions of Puppet Enterprise. + +# ---------------------------------------------------------------------- +# Puppet 4.8 for SIMP 6.0 and PE 2016.5 +el-pup4_8: + <<: *acceptance_base + <<: *simp_6_0 + script: + - 'bundle exec rake beaker:suites' + +el-pup4_8-fips: + <<: *acceptance_base + <<: *simp_6_0 variables: - PUPPET_VERSION: '~> 5.0' - <<: *cache_bundler - <<: *setup_bundler_env - <<: *spec_tests - allow_failure: true + BEAKER_fips: 'yes' + script: + - 'bundle exec rake beaker:suites' +oel-pup4_8: + <<: *acceptance_base + <<: *simp_6_0 + script: + - 'bundle exec rake beaker:suites[default,oel]' +# ---------------------------------------------------------------------- +# Puppet 4.10 for SIMP 6.1, PE 2016.4 LTS, and PE 2017.2 +el-pup4_10: + <<: *acceptance_base + <<: *simp_6_1 + script: + - 'bundle exec rake beaker:suites' -# Acceptance tests -# ============================================================================== -default: - stage: acceptance - tags: - - beaker - <<: *cache_bundler - <<: *setup_bundler_env +el-pup4_10-fips: + <<: *acceptance_base + <<: *simp_6_1 variables: - PUPPET_VERSION: '4.10' + BEAKER_fips: 'yes' script: - - bundle exec rake spec_clean - - bundle exec rake beaker:suites[default] + - bundle exec rake beaker:suites -default-fips: - stage: acceptance - tags: - - beaker - <<: *cache_bundler - <<: *setup_bundler_env +el-pup4_10-failover: + <<: *acceptance_base + <<: *simp_6_1 + script: + - 'bundle exec rake beaker:suites[failover]' + allow_failure: true + +el-pup4_10-failover-fips: + <<: *acceptance_base + <<: *simp_6_1 variables: - PUPPET_VERSION: '4.10' BEAKER_fips: 'yes' script: - - bundle exec rake spec_clean - - bundle exec rake beaker:suites[default] + - 'bundle exec rake beaker:suites[failover]' + allow_failure: true -failover: - stage: acceptance - tags: - - beaker - <<: *cache_bundler - <<: *setup_bundler_env +# ---------------------------------------------------------------------- +# Puppet 5.5 for PE 2018.1 LTS +el-pup5_5: + <<: *acceptance_base + <<: *pe_2018_1 + script: + - 'bundle exec rake beaker:suites' + +el-pup5_5-fips: + <<: *acceptance_base + <<: *pe_2018_1 variables: - PUPPET_VERSION: '4.10' + BEAKER_fips: 'yes' + script: + - 'bundle exec rake beaker:suites' + +oel-pup5_5: + <<: *acceptance_base + <<: *pe_2018_1 + script: + - 'bundle exec rake beaker:suites[default,oel]' + +el-pup5_5-failover: + <<: *acceptance_base + <<: *pe_2018_1 script: - - bundle exec rake spec_clean - - bundle exec rake beaker:suites[failover] + - 'bundle exec rake beaker:suites[failover]' allow_failure: true -failover-fips: - stage: acceptance - tags: - - beaker - <<: *cache_bundler - <<: *setup_bundler_env +el-pup5_5-failover-fips: + <<: *acceptance_base + <<: *pe_2018_1 variables: - PUPPET_VERSION: '4.10' BEAKER_fips: 'yes' script: - - bundle exec rake spec_clean - - bundle exec rake beaker:suites[failover] + - 'bundle exec rake beaker:suites[failover]' + allow_failure: true + +oel-pup5_5-failover: + <<: *acceptance_base + <<: *pe_2018_1 + script: + - 'bundle exec rake beaker:suites[failover,oel]' allow_failure: true + +#======================================================================= +# Deployment Jobs + +module_build: + only: + - 'tags' + stage: 'deployment' + tags: + - 'docker' + script: + - 'bundle exec rake clean' + - 'rm -rf pkg/' + - 'bundle exec puppet module build' + artifacts: + name: 'forge_release-${CI_COMMIT_TAG}' + when: 'on_success' + paths: + - 'pkg/${MODULE_NAME}-${MODULE_VERSION}.tar.gz' + +# vi:tabstop=2:shiftwidth=2:expandtab diff --git a/.travis.yml b/.travis.yml index de7f8ef..68e2a7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/CHANGELOG b/CHANGELOG index 1db9e87..4f53a10 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +* Fri Jul 13 2018 Trevor Vaughan - 7.2.0-0 +- Add support for Puppet5 and OEL +- Update acceptance tests to use environment variables + * Thu Jun 28 2018 Nick Miller - 7.1.3-0 - Update docs - Update ci assets diff --git a/manifests/params.pp b/manifests/params.pp index 7722cf5..ad1daf3 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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 } diff --git a/manifests/server/selinux.pp b/manifests/server/selinux.pp index cf9591d..9c56d9e 100644 --- a/manifests/server/selinux.pp +++ b/manifests/server/selinux.pp @@ -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, diff --git a/metadata.json b/metadata.json index 32abd38..f41c9f8 100644 --- a/metadata.json +++ b/metadata.json @@ -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", @@ -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" } ] } diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml index bbe131e..33f555f 100644 --- a/spec/acceptance/nodesets/default.yml +++ b/spec/acceptance/nodesets/default.yml @@ -1,3 +1,10 @@ +<% + if ENV['BEAKER_HYPERVISOR'] + hypervisor = ENV['BEAKER_HYPERVISOR'] + else + hypervisor = 'vagrant' + end +-%> HOSTS: client: roles: @@ -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 -%> diff --git a/spec/acceptance/nodesets/oel.yml b/spec/acceptance/nodesets/oel.yml new file mode 100644 index 0000000..84d3c33 --- /dev/null +++ b/spec/acceptance/nodesets/oel.yml @@ -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 -%> diff --git a/spec/acceptance/suites/default/00_default_spec.rb b/spec/acceptance/suites/default/00_default_spec.rb index 7726258..c2b5162 100644 --- a/spec/acceptance/suites/default/00_default_spec.rb +++ b/spec/acceptance/suites/default/00_default_spec.rb @@ -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 } @@ -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. diff --git a/spec/acceptance/suites/default/01_client_server_no_tls_spec.rb b/spec/acceptance/suites/default/01_client_server_no_tls_spec.rb index 55010c3..eda90e8 100644 --- a/spec/acceptance/suites/default/01_client_server_no_tls_spec.rb +++ b/spec/acceptance/suites/default/01_client_server_no_tls_spec.rb @@ -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' ) } diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 2f486fb..c99ccc8 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -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) {{ }} @@ -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