Showing with 135 additions and 154 deletions.
  1. +1 −0 .fixtures.yml
  2. +4 −2 .github/CONTRIBUTING.md
  3. +1 −1 .msync.yml
  4. +2 −1 .rubocop.yml
  5. +4 −1 .sync.yml
  6. +20 −12 .travis.yml
  7. +21 −0 CHANGELOG.md
  8. +4 −41 Gemfile
  9. +1 −32 Rakefile
  10. +4 −0 data/os/Debian/10.yaml
  11. +1 −1 data/os/Debian/9.yaml
  12. +14 −4 manifests/init.pp
  13. +7 −2 metadata.json
  14. +39 −3 spec/classes/snmp_init_spec.rb
  15. +4 −47 spec/spec_helper.rb
  16. +2 −7 spec/spec_helper_acceptance.rb
  17. +6 −0 templates/snmpd.service-dropin-Debian.epp
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fixtures:
repositories:
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
systemd: 'https://github.com/camptocamp/puppet-systemd.git'
6 changes: 4 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,20 @@ Beaker also supports docker containers. We also use that in our automated CI
pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant:

```sh
PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker
PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian10-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker
```

You can replace the string `debian9` with any common operating system.
You can replace the string `debian10` with any common operating system.
The following strings are known to work:

* ubuntu1604
* ubuntu1804
* debian8
* debian9
* debian10
* centos6
* centos7
* centos8

The easiest way to debug in a docker container is to open a shell:

Expand Down
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '2.10.0'
modulesync_config_version: '2.12.0'
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require: rubocop-rspec
AllCops:
TargetRubyVersion: 2.1
# Puppet Server 5 defaults to jruby 1.7 so TargetRubyVersion must stay at 1.9 until we drop support for puppet 5
TargetRubyVersion: 1.9
Include:
- ./**/*.rb
Exclude:
Expand Down
5 changes: 4 additions & 1 deletion .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
- set: ubuntu1604-64
- set: centos7-64
- set: centos6-64
- set: debian9-64
- set: debian8-64
- set: debian9-64
- set: debian10-64
secure: "IdEJp5VThHh+3f+EKA1mRtJva+QPZLMJ/8t+y/xNfmOQzT7tx5z0JAON01GBwa9vfsu5uuI1mnnXIJzMJiY7TNl4ogejQoHK/IYKHHqxVq4lerIcCk/eZCpSy1gMOot6+yfoR42n6oiDbXxu638QtCO80KC/S+4TMA6I+QRHw/Y="
spec/spec_helper_acceptance.rb:
unmanaged: false
32 changes: 20 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,51 +24,59 @@ matrix:
env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1804-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1804-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1604-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1604-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos7-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos7-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos6-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos6-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian8-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian8-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian9-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian9-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian10-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian10-64 CHECK=beaker
services: docker
branches:
only:
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v5.1.0](https://github.com/voxpupuli/puppet-snmp/tree/v5.1.0) (2020-04-19)

[Full Changelog](https://github.com/voxpupuli/puppet-snmp/compare/v5.0.0...v5.1.0)

**Implemented enhancements:**

- use systemd for debian 9 snmpd options [\#216](https://github.com/voxpupuli/puppet-snmp/pull/216) ([hdep](https://github.com/hdep))
- Support Debian 10 [\#214](https://github.com/voxpupuli/puppet-snmp/pull/214) ([antondollmaier](https://github.com/antondollmaier))

**Fixed bugs:**

- snmpd\_options parameter does not work with Debian 9 [\#110](https://github.com/voxpupuli/puppet-snmp/issues/110)

**Closed issues:**

- Release 4.1.1 [\#212](https://github.com/voxpupuli/puppet-snmp/issues/212)

**Merged pull requests:**

- Use voxpupuli-acceptance [\#221](https://github.com/voxpupuli/puppet-snmp/pull/221) ([ekohl](https://github.com/ekohl))

## [v5.0.0](https://github.com/voxpupuli/puppet-snmp/tree/v5.0.0) (2020-01-22)

[Full Changelog](https://github.com/voxpupuli/puppet-snmp/compare/v4.1.0...v5.0.0)
Expand Down
45 changes: 4 additions & 41 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,9 @@ def location_for(place, fake_version = nil)
end

group :test do
gem 'puppetlabs_spec_helper', '>= 2.14.0', :require => false
gem 'rspec-puppet-facts', '>= 1.9.5', :require => false
gem 'rspec-puppet-utils', :require => false
gem 'puppet-lint-leading_zero-check', :require => false
gem 'puppet-lint-trailing_comma-check', :require => false
gem 'puppet-lint-version_comparison-check', :require => false
gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false
gem 'puppet-lint-unquoted_string-check', :require => false
gem 'puppet-lint-variable_contains_upcase', :require => false
gem 'puppet-lint-absolute_classname-check', '>= 2.0.0', :require => false
gem 'puppet-lint-topscope-variable-check', :require => false
gem 'puppet-lint-legacy_facts-check', :require => false
gem 'puppet-lint-anchor-check', :require => false
gem 'metadata-json-lint', :require => false
gem 'redcarpet', :require => false
gem 'rubocop', '~> 0.49.1', :require => false
gem 'rubocop-rspec', '~> 1.15.0', :require => false
gem 'mocha', '~> 1.4.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'parallel_tests', :require => false
gem 'voxpupuli-test', '>= 1.0.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
end

group :development do
Expand All @@ -42,26 +24,7 @@ group :development do
end

group :system_tests do
gem 'winrm', :require => false
if beaker_version = ENV['BEAKER_VERSION']
gem 'beaker', *location_for(beaker_version)
else
gem 'beaker', '>= 4.2.0', :require => false
end
if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
gem 'beaker-rspec', *location_for(beaker_rspec_version)
else
gem 'beaker-rspec', :require => false
end
gem 'serverspec', :require => false
gem 'beaker-hostgenerator', '>= 1.1.22', :require => false
gem 'beaker-docker', :require => false
gem 'beaker-puppet', :require => false
gem 'beaker-puppet_install_helper', :require => false
gem 'beaker-module_install_helper', :require => false
gem 'rbnacl', '>= 4', :require => false
gem 'rbnacl-libsodium', :require => false
gem 'bcrypt_pbkdf', :require => false
gem 'voxpupuli-acceptance', :require => false
end

group :release do
Expand Down
33 changes: 1 addition & 32 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'voxpupuli/test/rake'

# load optional tasks for releases
# only available if gem group releases is installed
Expand All @@ -7,37 +7,6 @@ begin
rescue LoadError
end

PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'

desc 'Auto-correct puppet-lint offenses'
task 'lint:auto_correct' do
Rake::Task[:lint_fix].invoke
end

desc 'Run acceptance tests'
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = 'spec/acceptance'
end

desc 'Run tests'
task test: [:release_checks]

namespace :check do
desc 'Check for trailing whitespace'
task :trailing_whitespace do
Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename|
next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)}
File.foreach(filename).each_with_index do |line, index|
if line =~ %r{\s\n$}
puts "#{filename} has trailing whitespace on line #{index + 1}"
exit 1
end
end
end
end
end
Rake::Task[:release_checks].enhance ['check:trailing_whitespace']

desc "Run main 'test' task and report merged results to coveralls"
task test_with_coveralls: [:test] do
if Dir.exist?(File.expand_path('../lib', __FILE__))
Expand Down
4 changes: 4 additions & 0 deletions data/os/Debian/10.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
snmp::snmpd_options: "-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f -p /run/snmpd.pid"
snmp::varnetsnmp_group: 'Debian-snmp'
snmp::varnetsnmp_owner: 'Debian-snmp'
2 changes: 1 addition & 1 deletion data/os/Debian/9.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
snmp::snmpd_options: "-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux -p /var/run/snmpd.pid"
snmp::snmpd_options: "-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f"
snmp::varnetsnmp_group: 'Debian-snmp'
snmp::varnetsnmp_owner: 'Debian-snmp'
18 changes: 14 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,12 @@
Stdlib::Filemode $varnetsnmp_perms = '0755',
) {

$template_snmpd_conf = 'snmp/snmpd.conf.erb'
$template_snmpd_sysconfig = "snmp/snmpd.sysconfig-${facts['os']['family']}.erb"
$template_snmptrapd = 'snmp/snmptrapd.conf.erb'
$template_snmptrapd_sysconfig = "snmp/snmptrapd.sysconfig-${facts['os']['family']}.erb"
$template_snmpd_conf = 'snmp/snmpd.conf.erb'
$template_snmpd_sysconfig = "snmp/snmpd.sysconfig-${facts['os']['family']}.erb"
$template_snmpd_service_dropin = "snmp/snmpd.service-dropin-${facts['os']['family']}.epp"

$template_snmptrapd = 'snmp/snmptrapd.conf.erb'
$template_snmptrapd_sysconfig = "snmp/snmptrapd.sysconfig-${facts['os']['family']}.erb"

if $ensure == 'present' {
if $autoupgrade {
Expand Down Expand Up @@ -439,6 +441,14 @@
notify => Service['snmpd'],
}

# Debian 9 use systemd
if ( $facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['major'], '9') >= 0 ) {
systemd::dropin_file { 'snmpd.conf':
unit => 'snmpd.service',
content => epp($template_snmpd_service_dropin),
} ~> Class['systemd::systemctl::daemon_reload'] ~> Service['snmpd']
}

if $facts['os']['family'] == 'RedHat' {
file { 'snmptrapd.sysconfig':
ensure => $file_ensure,
Expand Down
9 changes: 7 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-snmp",
"version": "5.0.0",
"version": "5.1.0",
"author": "Vox Pupuli",
"summary": "Simple Network Management Protocol is for monitoring network and computer equipment. Net-SNMP implements v1, v2c, and v3 on both IPv4 and IPv6.",
"license": "Apache-2.0",
Expand All @@ -16,6 +16,10 @@
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.25.0 < 7.0.0"
},
{
"name": "camptocamp/systemd",
"version_requirement": ">= 2.5.1 < 3.0.0"
}
],
"operatingsystem_support": [
Expand Down Expand Up @@ -50,7 +54,8 @@
"operatingsystem": "Debian",
"operatingsystemrelease": [
"8",
"9"
"9",
"10"
]
},
{
Expand Down
42 changes: 39 additions & 3 deletions spec/classes/snmp_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@
).that_requires('Package[snmpd]').that_notifies('Service[snmpd]')
}
case facts[:os]['release']['major']
when '8', '9', '16.04', '18.04'
when '8', '9', '10', '16.04', '18.04'
it {
is_expected.to contain_file('snmptrapd.sysconfig').with(
ensure: 'present',
Expand Down Expand Up @@ -607,7 +607,43 @@
end

case facts[:os]['release']['major']
when '9', '18.04'
when '9'
describe 'Debian-snmp as snmp user' do
it 'contains File[snmpd.sysconfig] with contents "SNMPDOPTS="-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux -p /var/run/snmpd.pid""' do
verify_contents(catalogue, 'snmpd.sysconfig', [
'SNMPDRUN=yes',
'SNMPDOPTS=\'-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f\''
])
end
it {
is_expected.to contain_file('var-net-snmp').with(
ensure: 'directory',
mode: '0755',
owner: 'Debian-snmp',
group: 'Debian-snmp',
path: '/var/lib/snmp'
).that_requires('Package[snmpd]')
}
end
when '10'
describe 'Debian-snmp as snmp user' do
it 'contains File[snmpd.sysconfig] with contents "SNMPDOPTS="-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux -p /var/run/snmpd.pid""' do
verify_contents(catalogue, 'snmpd.sysconfig', [
'SNMPDRUN=yes',
'SNMPDOPTS=\'-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f -p /run/snmpd.pid\''
])
end
it {
is_expected.to contain_file('var-net-snmp').with(
ensure: 'directory',
mode: '0755',
owner: 'Debian-snmp',
group: 'Debian-snmp',
path: '/var/lib/snmp'
).that_requires('Package[snmpd]')
}
end
when '18.04'
describe 'Debian-snmp as snmp user' do
it 'contains File[snmpd.sysconfig] with contents "SNMPDOPTS="-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux -p /var/run/snmpd.pid""' do
verify_contents(catalogue, 'snmpd.sysconfig', [
Expand Down Expand Up @@ -646,7 +682,7 @@
end

case facts[:os]['release']['major']
when '8', '9', '16.04', '18.04'
when '8', '9', '10', '16.04', '18.04'
describe 'service_ensure => stopped and trap_service_ensure => running' do
let :params do
{
Expand Down
Loading