Skip to content

Commit

Permalink
Merge pull request #200 from Dan33l/drop-bsd
Browse files Browse the repository at this point in the history
drop EOL FreeBSD and OpenBSD
  • Loading branch information
Dan33l authored Aug 7, 2019
2 parents 5aca00a + fec2a70 commit e1aff94
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 181 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ Net-SNMP module support is available with these operating systems:
* RedHat family - tested on CentOS 6, CentOS 7
* SuSE family - tested on SLES 11 SP1
* Debian family - tested on Debian 8, Debian 9, Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04
* FreeBSD family - tested on FreeBSD 9.2, FreeBSD 10.0
* OpenBSD family - tested on OpenBSD 5.9

### Notes:

Expand Down
4 changes: 1 addition & 3 deletions lib/facter/snmpv3_user.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# snmpv3_user.rb --- Get SNMP usmUser data from configuration
Facter.add(:snmpv3_user) do
confine :os do |os|
%w[Debian FreeBSD OpenBSD RedHat Suse].include? os['family']
%w[Debian RedHat Suse].include? os['family']
end

setcode do
fact = {}

config = case Facter.value(:os)['family']
when 'Debian' then '/var/lib/snmp/snmpd.conf'
when 'FreeBSD' then '/var/net-snmp/snmpd.conf'
when 'OpenBSD' then '/var/net-snmp/snmpd.conf'
when 'RedHat' then '/var/lib/net-snmp/snmpd.conf'
when 'Suse' then '/var/lib/net-snmp/snmpd.conf'
end
Expand Down
30 changes: 9 additions & 21 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,6 @@
require => Package['snmpd'],
}

if $facts['os']['family'] == 'FreeBSD' {
file { $service_config_dir_path:
ensure => 'directory',
owner => $service_config_dir_owner,
group => $service_config_dir_group,
mode => $service_config_dir_perms,
require => Package['snmpd'],
}
}

if $facts['os']['family'] == 'Suse' {
file { '/etc/init.d/snmptrapd':
source => '/usr/share/doc/packages/net-snmp/rc.snmptrapd',
Expand Down Expand Up @@ -438,17 +428,15 @@
}


unless $facts['os']['family'] == 'FreeBSD' or $facts['os']['family'] == 'OpenBSD' {
file { 'snmpd.sysconfig':
ensure => $file_ensure,
path => $sysconfig,
owner => 'root',
group => 'root',
mode => '0644',
content => template($template_snmpd_sysconfig),
require => Package['snmpd'],
notify => Service['snmpd'],
}
file { 'snmpd.sysconfig':
ensure => $file_ensure,
path => $sysconfig,
owner => 'root',
group => 'root',
mode => '0644',
content => template($template_snmpd_sysconfig),
require => Package['snmpd'],
notify => Service['snmpd'],
}

if $facts['os']['family'] == 'RedHat' {
Expand Down
13 changes: 0 additions & 13 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,6 @@
"7"
]
},
{
"operatingsystem": "FreeBSD",
"operatingsystemrelease": [
"9.2",
"10.0"
]
},
{
"operatingsystem": "OpenBSD",
"operatingsystemrelease": [
"5.9"
]
},
{
"operatingsystem": "SLES",
"operatingsystemrelease": [
Expand Down
33 changes: 0 additions & 33 deletions spec/classes/snmp_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,39 +55,6 @@
require: nil
)
}
when 'FreeBSD'
it {
is_expected.to contain_package('snmp-client').with(
ensure: 'present',
name: 'net-mgmt/net-snmp'
)
}
it {
is_expected.not_to contain_file('snmp.conf').with(
ensure: 'present',
mode: '0755',
owner: 'root',
group: 'wheel',
path: '/usr/local/etc/snmp/snmp.conf'
)
}
when 'OpenBSD'
it {
is_expected.to contain_package('snmp-client').with(
ensure: 'present',
name: 'net-snmp'
)
}
it {
is_expected.not_to contain_file('snmp.conf').with(
ensure: 'present',
mode: '0755',
owner: 'root',
group: 'wheel',
path: '/etc/snmp/snmp.conf',
require: nil
)
}
end
end

Expand Down
109 changes: 0 additions & 109 deletions spec/classes/snmp_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -823,115 +823,6 @@
])
end
end

when 'FreeBSD'
it {
is_expected.to contain_package('snmpd').with(
ensure: 'present',
name: 'net-mgmt/net-snmp'
)
}
it {
is_expected.to contain_file('var-net-snmp').with(
ensure: 'directory',
mode: '0600',
owner: 'root',
group: 'wheel',
path: '/var/net-snmp'
).that_requires('Package[snmpd]')
}

it {
is_expected.to contain_file('snmpd.conf').with(
ensure: 'present',
mode: '0755',
owner: 'root',
group: 'wheel',
path: '/usr/local/etc/snmp/snmpd.conf'
).that_requires('Package[snmpd]').that_notifies('Service[snmpd]')
}
it {
is_expected.to contain_service('snmpd').with(
ensure: 'running',
name: 'snmpd',
enable: true,
hasstatus: true,
hasrestart: true
).that_requires(['Package[snmpd]', 'File[var-net-snmp]'])
}

it {
is_expected.to contain_file('snmptrapd.conf').with(
ensure: 'present',
mode: '0755',
owner: 'root',
group: 'wheel',
path: '/usr/local/etc/snmp/snmptrapd.conf'
).that_requires('Package[snmpd]').that_notifies('Service[snmptrapd]')
}
it {
is_expected.to contain_service('snmptrapd').with(
ensure: 'stopped',
name: 'snmptrapd',
enable: false,
hasstatus: true,
hasrestart: true
).that_requires(['Package[snmpd]', 'File[var-net-snmp]'])
}
when 'OpenBSD'
it {
is_expected.to contain_package('snmpd').with(
ensure: 'present',
name: 'net-snmp'
)
}
it {
is_expected.to contain_file('var-net-snmp').with(
ensure: 'directory',
mode: '0600',
owner: '_netsnmp',
group: 'wheel',
path: '/var/net-snmp'
).that_requires('Package[snmpd]')
}

it {
is_expected.to contain_file('snmpd.conf').with(
ensure: 'present',
mode: '0755',
owner: 'root',
group: 'wheel',
path: '/etc/snmp/snmpd.conf'
).that_requires('Package[snmpd]').that_notifies('Service[snmpd]')
}
it {
is_expected.to contain_service('snmpd').with(
ensure: 'running',
name: 'netsnmpd',
enable: true,
hasstatus: true,
hasrestart: true
).that_requires(['Package[snmpd]', 'File[var-net-snmp]'])
}

it {
is_expected.to contain_file('snmptrapd.conf').with(
ensure: 'present',
mode: '0755',
owner: 'root',
group: 'wheel',
path: '/etc/snmp/snmptrapd.conf'
).that_requires('Package[snmpd]').that_notifies('Service[snmptrapd]')
}
it {
is_expected.to contain_service('snmptrapd').with(
ensure: 'stopped',
name: 'netsnmptrapd',
enable: false,
hasstatus: true,
hasrestart: true
).that_requires(['Package[snmpd]', 'File[var-net-snmp]'])
}
else
is_expected.to raise_error(Puppet::Error, %r{Module snmp is not supported on bar})
end
Expand Down

0 comments on commit e1aff94

Please sign in to comment.