Skip to content

Commit 56c384a

Browse files
committed
Remove baseline_os filter
Fix spec for supported OS in metadata.json
1 parent f00c8c9 commit 56c384a

15 files changed

+416
-424
lines changed

Diff for: .sync.yml

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ spec/spec_helper.rb:
88
mock_with: ':mocha'
99
spec_overrides:
1010
- "require 'support/acceptance/supported_versions'"
11-
- "require 'spec_helper_methods'"
1211
.puppet-lint.rc:
1312
enabled_lint_checks:
1413
- parameter_documentation

Diff for: spec/classes/agent_spec.rb

+29-8
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
}
1515
end
1616

17-
on_supported_os(baseline_os_hash).each do |os, facts|
17+
on_supported_os.each do |os, facts|
1818
context "on #{os}" do
1919
config_path = case facts[:os]['name']
2020
when 'windows'
2121
'C:/ProgramData/zabbix/zabbix_agentd.conf'
22+
when 'FreeBSD'
23+
'/usr/local/etc/zabbix6/zabbix_agentd.conf'
2224
else
2325
'/etc/zabbix/zabbix_agentd.conf'
2426
end
@@ -32,6 +34,8 @@
3234
include_dir = case facts[:os]['name']
3335
when 'windows'
3436
'C:/ProgramData/zabbix/zabbix_agentd.d'
37+
when 'FreeBSD'
38+
'/usr/local/etc/zabbix6/zabbix_agentd.d'
3539
else
3640
'/etc/zabbix/zabbix_agentd.d'
3741
end
@@ -50,6 +54,9 @@
5054
when 'windows'
5155
package_name = 'zabbix-agent'
5256
service_name = 'Zabbix Agent'
57+
when 'FreeBSD'
58+
package_name = 'zabbix6-agent'
59+
service_name = 'zabbix_agentd'
5360
else
5461
package_name = 'zabbix-agent'
5562
service_name = 'zabbix-agent'
@@ -60,7 +67,7 @@
6067
context 'with all defaults' do
6168
it { is_expected.to contain_selinux__module('zabbix-agent') } if facts[:os]['family'] == 'RedHat'
6269
it { is_expected.to contain_yumrepo('zabbix-frontend') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
63-
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
70+
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' && %w[OracleLinux CentOS].include?(facts[:os]['name'])
6471
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if facts[:os]['family'] == 'Debian'
6572
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if facts[:os]['family'] == 'Debian'
6673
it { is_expected.to contain_file(include_dir).with_ensure('directory') }
@@ -75,11 +82,20 @@
7582
)
7683
end
7784
else
78-
it do
79-
is_expected.to contain_package(package_name).
80-
with_ensure('present').
81-
with_tag('zabbix').
82-
that_requires('Class[zabbix::repo]')
85+
86+
if facts[:os]['family'] == 'Gentoo'
87+
it do
88+
is_expected.to contain_package(package_name).
89+
with_ensure('present').
90+
with_tag('zabbix')
91+
end
92+
else
93+
it do
94+
is_expected.to contain_package(package_name).
95+
with_ensure('present').
96+
with_tag('zabbix').
97+
that_requires('Class[zabbix::repo]')
98+
end
8399
end
84100

85101
it do
@@ -103,7 +119,7 @@
103119
end
104120

105121
case facts[:os]['family']
106-
when 'Archlinux'
122+
when %w[Archlinux Gentoo FreeBSD].include?(facts[:os]['family'])
107123
it { is_expected.not_to compile.with_all_deps }
108124
when 'Debian'
109125
# rubocop:disable RSpec/RepeatedExample
@@ -218,6 +234,9 @@
218234
end
219235

220236
context 'when declaring manage_startup_script is true' do
237+
next if facts[:os]['family'] == 'FreeBSD'
238+
next if facts[:os]['family'] == 'Gentoo'
239+
221240
let :params do
222241
{
223242
manage_startup_script: true
@@ -478,6 +497,8 @@
478497
end
479498

480499
context 'when zabbix_package_agent is zabbix-agent2' do
500+
next if facts[:os]['family'] == 'Gentoo'
501+
481502
let :params do
482503
{
483504
zabbix_package_agent: 'zabbix-agent2', startagents: 1,

Diff for: spec/classes/database_mysql_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'rspec.puppet.com'
88
end
99

10-
on_supported_os(baseline_os_hash).each do |os, facts|
10+
on_supported_os.each do |os, facts|
1111
next if facts[:os]['name'] == 'windows'
1212

1313
context "on #{os}" do

Diff for: spec/classes/database_postgresql_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'rspec.puppet.com'
88
end
99

10-
on_supported_os(baseline_os_hash).each do |os, facts|
10+
on_supported_os.each do |os, facts|
1111
next if facts[:os]['name'] == 'windows'
1212

1313
context "on #{os}" do

Diff for: spec/classes/database_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'rspec.puppet.com'
88
end
99

10-
on_supported_os(baseline_os_hash).each do |os, facts|
10+
on_supported_os.each do |os, facts|
1111
next if facts[:os]['name'] == 'windows'
1212

1313
context "on #{os}" do

Diff for: spec/classes/javagateway_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'rspec.puppet.com'
88
end
99

10-
on_supported_os(baseline_os_hash).each do |os, facts|
10+
on_supported_os.each do |os, facts|
1111
next if facts[:os]['name'] == 'windows'
1212

1313
context "on #{os}" do
@@ -28,7 +28,7 @@
2828
it { is_expected.to contain_service('zabbix-java-gateway').with_require(['Package[zabbix-java-gateway]', 'File[/etc/zabbix/zabbix_java_gateway.conf]']) }
2929

3030
it { is_expected.to contain_yumrepo('zabbix-frontend') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
31-
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
31+
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' && %w[OracleLinux CentOS].include?(facts[:os]['name'])
3232
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if facts[:os]['family'] == 'Debian'
3333
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if facts[:os]['family'] == 'Debian'
3434
end

0 commit comments

Comments
 (0)