Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #329 from zhmurko/feature-issue-326
Browse files Browse the repository at this point in the history
Feature #326: Ubuntu 18.04 Bionic Support
  • Loading branch information
vkhatri authored Mar 3, 2019
2 parents bd21a53 + 824065a commit 565d9f6
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 10 deletions.
11 changes: 9 additions & 2 deletions .kitchen.dokken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ provisioner:
disable_conf_d: false

platforms:
- name: ubuntu-14
- name: ubuntu-1404
driver:
image: ubuntu:14.04
pid_one_command: /sbin/init
Expand All @@ -36,14 +36,21 @@ platforms:
icinga2-test-mysql-instance:
service_manager: sysvinit

- name: ubuntu-16
- name: ubuntu-1604
driver:
image: ubuntu:16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update -qq
- RUN /usr/bin/apt-get install -y net-tools apt-transport-https initscripts procps lsb-release curl gnupg

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

- name: debian-8
driver:
image: debian:8.9
Expand Down
6 changes: 6 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ platforms:
- name: ubuntu-16.04
run_list:
- recipe[apt::default]
- name: ubuntu-18.04
run_list:
- recipe[apt::default]
- name: debian-8.5
run_list:
- recipe[apt::default]
- name: debian-9.5
run_list:
- recipe[apt::default]

suites:
- name: chef12server
Expand Down
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ services: docker

env:
matrix:
- INSTANCE=chef12server-ubuntu-14
- INSTANCE=chef12server-ubuntu-16
- INSTANCE=chef12server-ubuntu-1404
- INSTANCE=chef12server-ubuntu-1604
- INSTANCE=chef12server-ubuntu-1804
- INSTANCE=chef12server-debian-8
- INSTANCE=chef12server-debian-9
- INSTANCE=chef12server-centos-6
- INSTANCE=chef12server-centos-7
- INSTANCE=chef12server-fedora-26
- INSTANCE=chef12server-amazon
- INSTANCE=chef13server-ubuntu-14
- INSTANCE=chef13server-ubuntu-16
- INSTANCE=chef13server-ubuntu-1404
- INSTANCE=chef13server-ubuntu-1604
- INSTANCE=chef13server-ubuntu-1804
- INSTANCE=chef13server-debian-8
- INSTANCE=chef13server-debian-9
- INSTANCE=chef13server-centos-6
Expand Down
2 changes: 2 additions & 0 deletions recipes/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
service 'icinga2' do
service_name node['icinga2']['service_name']
supports :status => true, :reload => platform?('windows') ? false : true, :restart => true
retries 2
retry_delay 5
action [:enable]
end

Expand Down
59 changes: 55 additions & 4 deletions spec/unit/recipes/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
expect(chef_run).to create_directory('/etc/icinga2/repository.d')
end

it 'install package icinga2' do
expect(chef_run).to install_package('icinga2')
%w(icinga2 icinga2-bin icinga2-common icinga2-doc).each do |p|
it "install package #{p}" do
expect(chef_run).to install_package(p)
end
end

it 'configure logrotate for icinga2' do
Expand Down Expand Up @@ -171,6 +173,14 @@
mode: 0o640
)
end

it 'set proper ulimits' do
expect(chef_run).to create_user_ulimit('icinga').with(
filehandle_limit: 48_000,
process_limit: 'unlimited',
memory_limit: 'unlimited'
)
end
end

context 'rhel' do
Expand All @@ -193,7 +203,7 @@
include_context 'rhel_family'
end

context 'ubuntu' do
shared_context 'ubuntu_family' do
let(:chef_run) do
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |node|
node.automatic['platform_family'] = 'debian'
Expand All @@ -220,7 +230,7 @@
expect(chef_run).to remove_apt_repository('icinga2-snapshot')
end

%w(g++ mailutils build-essential).each do |p|
%w(g++ mailutils build-essential libicinga2).each do |p|
it 'install packages' do
expect(chef_run).to install_package(p)
end
Expand Down Expand Up @@ -265,5 +275,46 @@
mode: 0o640
)
end

it 'set proper ulimits' do
expect(chef_run).to create_user_ulimit('nagios').with(
filehandle_limit: 48_000,
process_limit: 'unlimited',
memory_limit: 'unlimited'
)
end
end

context 'ubuntu 14.04' do
let(:chef_run) do
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |node|
node.automatic['platform_family'] = 'debian'
node.automatic['lsb']['codename'] = 'trusty'
end.converge(described_recipe)
end

include_context 'ubuntu_family'
end

context 'ubuntu 16.04' do
let(:chef_run) do
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04') do |node|
node.automatic['platform_family'] = 'debian'
node.automatic['lsb']['codename'] = 'xenial'
end.converge(described_recipe)
end

include_context 'ubuntu_family'
end

context 'ubuntu 18.04' do
let(:chef_run) do
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04') do |node|
node.automatic['platform_family'] = 'debian'
node.automatic['lsb']['codename'] = 'bionic'
end.converge(described_recipe)
end

include_context 'ubuntu_family'
end
end

0 comments on commit 565d9f6

Please sign in to comment.