Skip to content

Commit

Permalink
Chef 17 updates (#187)
Browse files Browse the repository at this point in the history
- Chef 17 updates: enable `unified_mode` on all resources
- Bump required Chef Infra Client to >= 15.3
- Remove support and testing for RHEL 6 and Ubuntu 16.04

Signed-off-by: Lance Albertson <lance@osuosl.org>
  • Loading branch information
ramereth authored Jun 18, 2021
1 parent 156a863 commit 82062df
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 47 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
- 'centos-7'
- 'centos-8'
- 'fedora-latest'
- 'ubuntu-1604'
- 'ubuntu-1804'
- 'ubuntu-2004'
- 'opensuse-leap-15'
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ This file is used to list changes made in each version of the rsyslog cookbook.

## Unreleased

- Chef 17 updates: enable `unified_mode` on all resources
- Bump required Chef Infra Client to >= 15.3
- Remove support and testing for RHEL 6 and Ubuntu 16.04

## 8.0.3 - *2021-06-01*

- Standardise files with files in sous-chefs/repo-management

## 8.0.2 - *2021-04-14*

- Add check for FreeBSD to prevent trying to install a RELP package
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of

### Chef

- Chef 13+
- Chef 15.3+

### Other

Expand Down
10 changes: 2 additions & 8 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,8 @@
'uucp,news.crit' => "#{node['rsyslog']['default_log_dir']}/spooler",
'local7.*' => "#{node['rsyslog']['default_log_dir']}/boot.log",
}
# journald is used in systemd
if node['init_package'] == 'systemd'
default['rsyslog']['modules'] = %w(imuxsock imjournal)
default['rsyslog']['additional_directives'] = { 'OmitLocalLogging' => 'on', 'IMJournalStateFile' => 'imjournal.state' }
else
# RainerScript is not well supported by default on older RHEL
default['rsyslog']['config_style'] = 'legacy'
end
default['rsyslog']['modules'] = %w(imuxsock imjournal)
default['rsyslog']['additional_directives'] = { 'OmitLocalLogging' => 'on', 'IMJournalStateFile' => 'imjournal.state' }
else
# format { facility => destination }
default['rsyslog']['default_facility_logs'] = {
Expand Down
7 changes: 0 additions & 7 deletions kitchen.dokken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ platforms:
image: dokken/fedora-latest
pid_one_command: /usr/lib/systemd/systemd

- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: ubuntu-18.04
driver:
image: dokken/ubuntu-18.04
Expand Down
1 change: 0 additions & 1 deletion kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ platforms:
- name: debian-10
- name: fedora-latest
- name: opensuse-leap-15
- name: ubuntu-16.04
- name: ubuntu-18.04
- name: ubuntu-20.04

Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
version '8.0.3'
source_url 'https://github.com/sous-chefs/rsyslog'
issues_url 'https://github.com/sous-chefs/rsyslog/issues'
chef_version '>= 13'
chef_version '>= 15.3'

supports 'amazon'
supports 'centos'
Expand Down
2 changes: 2 additions & 0 deletions resources/file_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
property :cookbook_source, String, default: 'rsyslog'
property :template_source, String, default: lazy { labeled_template('file-input.conf.erb', node['rsyslog']['config_style']) }

unified_mode true

action :create do
vars = {
file_name: new_resource.file,
Expand Down
6 changes: 3 additions & 3 deletions spec/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe 'rsyslog::client' do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu') do |node|
node.normal['rsyslog']['server_ip'] = server_ip
node.normal['rsyslog']['custom_remote'] = custom_remote
end.converge(described_recipe)
Expand Down Expand Up @@ -41,7 +41,7 @@

context 'on SmartOS' do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'smartos', version: '5.11') do |node|
ChefSpec::ServerRunner.new(platform: 'smartos') do |node|
node.normal['rsyslog']['server_ip'] = server_ip
node.normal['rsyslog']['custom_remote'] = custom_remote
end.converge(described_recipe)
Expand Down Expand Up @@ -84,7 +84,7 @@

context 'on SmartOS' do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'smartos', version: '5.11') do |node|
ChefSpec::ServerRunner.new(platform: 'smartos') do |node|
node.normal['rsyslog']['server_ip'] = server_ip
end.converge(described_recipe)
end
Expand Down
38 changes: 17 additions & 21 deletions spec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

describe 'rsyslog::default' do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe)
ChefSpec::ServerRunner.new(platform: 'ubuntu').converge(described_recipe)
end

let(:service_resource) { 'service[rsyslog]' }

it 'installs the rsyslog part' do
Expand All @@ -13,7 +12,7 @@

context "when node['rsyslog']['relp'] is true" do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu') do |node|
node.normal['rsyslog']['use_relp'] = true
end.converge(described_recipe)
end
Expand All @@ -26,7 +25,7 @@
context "when node['rsyslog']['enable_tls'] is true" do
context "when node['rsyslog']['tls_ca_file'] is not set" do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu') do |node|
node.normal['rsyslog']['enable_tls'] = true
end.converge(described_recipe)
end
Expand All @@ -38,7 +37,7 @@

context "when node['rsyslog']['tls_ca_file'] is set" do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu') do |node|
node.normal['rsyslog']['enable_tls'] = true
node.normal['rsyslog']['tls_ca_file'] = '/etc/path/to/ssl-ca.crt'
end.converge(described_recipe)
Expand All @@ -50,7 +49,7 @@

context "when protocol is not 'tcp'" do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu') do |node|
node.normal['rsyslog']['enable_tls'] = true
node.normal['rsyslog']['tls_ca_file'] = '/etc/path/to/ssl-ca.crt'
node.normal['rsyslog']['protocol'] = 'udp'
Expand Down Expand Up @@ -84,7 +83,7 @@

context 'on SmartOS' do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'smartos', version: '5.11').converge(described_recipe)
ChefSpec::ServerRunner.new(platform: 'smartos').converge(described_recipe)
end

let(:directory) { chef_run.directory('/opt/local/etc/rsyslog.d') }
Expand Down Expand Up @@ -150,7 +149,7 @@

context 'on SmartOS' do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'smartos', version: '5.11').converge(described_recipe)
ChefSpec::ServerRunner.new(platform: 'smartos').converge(described_recipe)
end

let(:template) { chef_run.template('/opt/local/etc/rsyslog.conf') }
Expand Down Expand Up @@ -203,7 +202,7 @@

context 'on SmartOS' do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'smartos', version: '5.11').converge(described_recipe)
ChefSpec::ServerRunner.new(platform: 'smartos').converge(described_recipe)
end

let(:template) { chef_run.template('/opt/local/etc/rsyslog.d/50-default.conf') }
Expand Down Expand Up @@ -233,7 +232,7 @@

context 'COOK-3608 maillog regression test' do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'centos', version: '6').converge(described_recipe)
ChefSpec::ServerRunner.new(platform: 'centos').converge(described_recipe)
end

it 'outputs mail.* to /var/log/maillog' do
Expand All @@ -260,9 +259,9 @@
end

context 'when template[/etc/rsyslog.d/35-imfile.conf] receives :create' do
context 'when on centos 6' do
context 'when on centos' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'centos', version: '6') do |node|
ChefSpec::ServerRunner.new(platform: 'centos') do |node|
node.normal['rsyslog']['imfile']['PollingInterval'] = 10
end.converge(described_recipe)
end
Expand All @@ -272,15 +271,12 @@
template.run_action(:create)
end

it "node['rsyslog']['config_style'] will be 'legacy' by default" do
expect(chef_run.node['rsyslog']['config_style']).to eq('legacy')
end
context '/etc/rsyslog.d/35-imfile.conf file' do
it 'will be create with legacy style syntax' do
expect(chef_run).to render_file(template.path).with_content('$ModLoad imfile')
it do
expect(chef_run).to_not render_file(template.path).with_content('$ModLoad imfile')
end
it 'will NOT include module parameter PollingInterval' do
expect(chef_run).not_to render_file(template.path).with_content('PollingInterval')
it do
expect(chef_run).to render_file(template.path).with_content('PollingInterval')
end
it 'is owned by root:root' do
expect(template.owner).to eq('root')
Expand All @@ -296,9 +292,9 @@
end
end
end
context 'when on ubuntu 16.04 ' do
context 'when on ubuntu' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu') do |node|
node.normal['rsyslog']['imfile']['PollingInterval'] = 10
end.converge(described_recipe)
end
Expand Down
8 changes: 4 additions & 4 deletions spec/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe 'rsyslog::server' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu') do |node|
node.default['rsyslog']['server'] = false
end.converge(described_recipe)
end
Expand Down Expand Up @@ -56,7 +56,7 @@

context 'on SmartOS' do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'smartos', version: '5.11') do |node|
ChefSpec::ServerRunner.new(platform: 'smartos') do |node|
node.default['rsyslog']['server'] = false
end.converge(described_recipe)
end
Expand Down Expand Up @@ -84,7 +84,7 @@

context '/etc/rsyslog.d/49-remote.conf file' do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe)
ChefSpec::ServerRunner.new(platform: 'ubuntu').converge(described_recipe)
end

before do
Expand All @@ -109,7 +109,7 @@
end

cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'smartos', version: '5.11') do |node|
ChefSpec::ServerRunner.new(platform: 'smartos') do |node|
node.override['rsyslog']['server'] = false
end.converge(described_recipe)
end
Expand Down

0 comments on commit 82062df

Please sign in to comment.