8 changes: 8 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fixtures:
repositories:
stdlib:
repo: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
ref: "2.6.0"
lsb: "git://github.com/razorsedge/puppet-lsb.git"
symlinks:
snmp: "#{source_dir}"
6 changes: 6 additions & 0 deletions .gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
gem 'puppet', puppetversion
gem 'puppet-lint', '>= 0.3.2'
gem 'puppetlabs_spec_helper', '>= 0.1.0'
2 changes: 2 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<name>snmp</name>
<comment></comment>
<projects>
<project>lsb</project>
<project>stdlib</project>
</projects>
<buildSpec>
<buildCommand>
Expand Down
23 changes: 15 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
language: ruby
rvm: 1.8.7
rvm:
- 1.8.7
#before_script:
# - 'git clone git://github.com/puppetlabs/puppetlabs-stdlib.git spec/fixtures/modules/stdlib'
script: "rake spec"
branches:
only:
- master
- develop
notifications:
email:
- github@razorsedge.org
gemfile: .gemfile
env:
- PUPPET_VERSION=2.6.4
- PUPPET_VERSION=2.6.9
- PUPPET_VERSION=2.6.16
- PUPPET_VERSION=2.7.6
- PUPPET_VERSION=2.7.9
- PUPPET_VERSION=2.7.12
- PUPPET_VERSION=2.7.13
# - PUPPET_VERSION=2.6.4 # PE 1.1
- PUPPET_VERSION=2.6.9 # PE 1.2
- PUPPET_VERSION=2.6.18 # latest 2.6
- PUPPET_VERSION=2.7.6 # PE 2.0
- PUPPET_VERSION=2.7.9 # PE 2.0.1+
- PUPPET_VERSION=2.7.12 # PE 2.5
- PUPPET_VERSION=2.7.19 # PE 2.6.0+
- PUPPET_VERSION=2.7.20 # PE 2.7.0+
- PUPPET_VERSION=2.7.21 # latest 2.7; PE 2.8.0+
69 changes: 69 additions & 0 deletions DEVELOP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Contributing
------------

normal

1. [Fork](http://help.github.com/forking/) puppet-snmp
2. Create a topic branch against the develop branch `git checkout develop; git checkout -b my_branch`
3. Push to your branch `git push origin my_branch`
4. Create a [Pull Request](http://help.github.com/pull-requests/) from your branch against the develop branch

[git-flow](https://github.com/nvie/gitflow)

1. [Fork](http://help.github.com/forking/) puppet-snmp
2. Create a feature `git flow feature start my-feature`
3. Publish your featue `git flow feature publish my-feature`
4. Create a [Pull Request](http://help.github.com/pull-requests/) from your branch against the develop branch

Testing
-------

Tests are written with [rspec-puppet](http://rspec-puppet.com/). CI is covered by [Travis CI](http://about.travis-ci.org/) and the current status is visible [here](http://travis-ci.org/razorsedge/puppet-snmp).

To run all tests:

rake spec

Branching
---------

This repository is organized and maintained with the help of [gitflow](https://github.com/nvie/gitflow). Developers are encouraged to use it when working with this repository.

We use the following naming convention for branches:

* develop (during development)
* master (will be or has been released)
* feature/<name> (feature branches)
* release/<name> (release branches)
* hotfix/<name> (hotfix branches)
* (empty version prefix)

During development, you should work in feature branches instead of committing to master directly. Tell gitflow that you want to start working on a feature and it will do the work for you (like creating a branch prefixed with feature/):

git flow feature start <FEATURE_NAME>

The work in a feature branch should be kept close to the original problem. Tell gitflow that a feature is finished and it will merge it into master and push it to the upstream repository:

git flow feature finish <FEATURE_NAME>

Even before a feature is finished, you might want to make your branch available to other developers. You can do that by publishing it, which will push it to the upstream repository:

git flow feature publish <FEATURE_NAME>

To track a feature that is located in the upstream repository and not yet present locally, invoke the following command:

git flow feature track <FEATURE_NAME>

Changes that should go into production should come from the up-to-date master branch. Enter the "release to production" phase by running:

git flow release start <VERSION_NUMBER>

In this phase, only meta information should be touched, like bumping the version and update the history. Finish the release phase with:

git flow release finish <VERSION_NUMBER>

Versioning
----------

This project is versioned with the help of the [Semantic Versioning Specification](http://semver.org/) using 0.0.1 as the initial version. Please make sure you have read the guidelines before increasing a version number either for a release or a hotfix.

12 changes: 0 additions & 12 deletions Gemfile

This file was deleted.

32 changes: 10 additions & 22 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
name 'razorsedge-snmp'
version '1.0.1'
version '2.0.0'

author 'razorsedge'
license 'Apache 2.0'
license 'Apache License, Version 2.0'
project_page 'https://github.com/razorsedge/puppet-snmp'
source 'git://github.com/razorsedge/puppet-snmp.git'
summary 'Puppet module to manage SNMP.'
description 'This module manages the installation of the SNMP server, SNMP client, and SNMP
trap server. It also can create a SNMPv3 user with authentication and privacy
passwords.
Actions:
Installs the SNMP client package and configuration.
Installs the SNMP daemon package, service, and configuration.
Installs the SNMP trap daemon service and configuration.
Creates a SNMPv3 user with authentication and encryption paswords.
OS Support:
RedHat family - tested on CentOS 5.8 and CentOS 6.2
Fedora - not yet supported
SuSE family - presently unsupported (patches welcome)
Debian family - presently unsupported (patches welcome)
Solaris family - presently unsupported (patches welcome)
Class documentation is available via puppetdoc.'
summary 'Install and manage SNMP services.'
description 'This module manages the installation of the SNMP server, SNMP client, and SNMP trap server. It also can create a SNMPv3 user with authentication and privacy passwords.'
dependency 'puppetlabs/stdlib', '>=2.3.0'
dependency 'razorsedge/lsb', '>=1.0.0'

# Generate the changelog file
system("git-log-to-changelog > CHANGELOG")
$? == 0 or fail "changelog generation #{$?}!"
44 changes: 34 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
Puppet SNMP Module
==================
Net-SNMP installation.
======================

[![Build Status](https://secure.travis-ci.org/razorsedge/puppet-snmp.png?branch=master)](http://travis-ci.org/razorsedge/puppet-snmp)
master branch: [![Build Status](https://secure.travis-ci.org/razorsedge/puppet-snmp.png?branch=master)](http://travis-ci.org/razorsedge/puppet-snmp)
develop branch: [![Build Status](https://secure.travis-ci.org/razorsedge/puppet-snmp.png?branch=develop)](http://travis-ci.org/razorsedge/puppet-snmp)

Introduction
------------

This module manages the installation of the SNMP server, SNMP client, and SNMP
trap server. It also can create a SNMPv3 user with authentication and privacy
passwords.
This module manages the installation of [Net-SNMP](http://www.net-snmp.org/)
client, server, and trap server. It also can create a SNMPv3 user with
authentication and privacy passwords.

Actions:

Expand All @@ -20,9 +21,8 @@ Actions:
OS Support:

* RedHat family - tested on CentOS 5.8 and CentOS 6.2
* Fedora - not yet supported
* SuSE family - presently unsupported (patches welcome)
* Debian family - presently unsupported (patches welcome)
* Debian family - initial Debian & Ubuntu suport (patches welcome)
* Solaris family - presently unsupported (patches welcome)

Class documentation is available via puppetdoc.
Expand Down Expand Up @@ -51,14 +51,38 @@ Examples
Notes
-----

* Only tested on CentOS 5.8 and CentOS 6.2 x86_64.
* Only tested on CentOS 5.8, CentOS 6.2 x86_64, and Debian squeeze.
* SNMPv3 user auth is not tested on Debian.
* There is a bug on Debian squeeze of net-snmp's status script. If snmptrapd is
not running the status script returns 'not running' so puppet restarts the
snmpd service. The following is a workaround: `class { 'snmp::server':
service_hasstatus => false, }`

Issues
------

* None.
* Debian will not support the use of non-numeric OIDs. Something about [rabid
freedom](http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561578).
* On osfamily Debian, starting the snmptrap service does not work. This will
be fixed in the upcomming refactor of this module.

Deprecation Warning
-------------------

The classes `snmp::server` and `snmp::trapd` will be merged into class `snmp`.
All of their class parameters will be made available in the `snmp` class.

License
-------

Please see LICENSE file.

Copyright
---------

Copyright (C) 2012 Mike Arnold <mike@razorsedge.org>

[razorsedge/puppet-snmp on GitHub](https://github.com/razorsedge/puppet-snmp)

[razorsedge/snmp on Puppet Forge](http://forge.puppetlabs.com/razorsedge/snmp)

66 changes: 14 additions & 52 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,60 +1,22 @@
require 'rake'
require 'rspec/core/rake_task'
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'

#task :default => [:spec, :lint]
task :default do
system("rake -T")
end

desc "Run all rspec-puppet tests"
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/*/*_spec.rb'
end

desc "Run all rspec-puppet tests visually"
RSpec::Core::RakeTask.new(:vspec) do |t|
desc "Run visual spec tests on an existing fixtures directory"
RSpec::Core::RakeTask.new(:spec_standalonev) do |t|
t.rspec_opts = ['--color', '--format documentation']
t.pattern = 'spec/*/*_spec.rb'
t.pattern = 'spec/{classes,defines,unit}/**/*_spec.rb'
end

def update_module_version
gitdesc = %x{git describe}.chomp
semver = gitdesc.gsub(/v?(\d+\.\d+\.\d+)-?(.*)/) do
newver = "#{$1}"
newver << "git-#{$2}" unless $2.empty?
newver
# https://github.com/stahnma/puppet-modules/blob/master/common/Rakefile
desc "Run puppet in noop mode and check for syntax errors."
task :validate do
Dir['manifests/**/*.pp'].each do |path|
sh "puppet parser validate --noop #{path}"
end
modulefile = File.read("Modulefile")
modulefile.gsub!(/^\s*version\s+'.*?'/, "version '#{semver}'")
File.open("Modulefile", 'w') do |f|
f.write(modulefile)
end
semver
end

desc "Build Puppet Module Package"
task :build do
# system("gimli README*.markdown")
FileUtils.cp "Modulefile", ".Modulefile.bak"
update_module_version
system("puppet-module build")
FileUtils.mv ".Modulefile.bak", "Modulefile"
end
#desc "Build puppet module package"
#task :build do
# # This will be deprecated once puppet-module is a face.
# begin
# Gem::Specification.find_by_name('puppet-module')
# rescue Gem::LoadError, NoMethodError
# require 'puppet/face'
# pmod = Puppet::Face['module', :current]
# pmod.build('./')
# end
#end
# Enable puppet-lint for all manifests: rake lint
require 'puppet-lint/tasks/puppet-lint'
#PuppetLint.configuration.send("disable_80chars") # no warnings on lines over 80 chars.
PuppetLint.configuration.ignore_paths = ["spec/fixtures/**/*.pp", "pkg/**/*"]

desc "Check puppet manifests with puppet-lint"
task :lint do
# This requires pull request: https://github.com/rodjek/puppet-lint/pull/81
system("echo '** manifests'; puppet-lint --with-filename manifests")
system("echo '** tests'; puppet-lint --with-filename tests")
end
22 changes: 22 additions & 0 deletions files/snmpd.sysconfig-Debian-12
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file controls the activity of snmpd and snmptrapd

# Don't load any MIBs by default.
# You might comment this lines once you have the MIBs downloaded.
export MIBS=

# snmpd control (yes means start daemon).
SNMPDRUN=yes

# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'

# snmptrapd control (yes means start daemon). As of net-snmp version
# 5.0, master agentx support must be enabled in snmpd before snmptrapd
# can be run. See snmpd.conf(5) for how to do this.
TRAPDRUN=no

# snmptrapd options (use syslog).
TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'

# create symlink on Debian legacy location to official RFC path
SNMPDCOMPAT=yes
11 changes: 6 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@
# Copyright (C) 2012 Mike Arnold, unless otherwise noted.
#
class snmp (
$ensure = 'present',
$autoupgrade = false
$ensure = $snmp::params::ensure,
$autoupgrade = $snmp::params::safe_autoupgrade
) inherits snmp::params {
# Validate our booleans
validate_bool($autoupgrade)

case $ensure {
/(present)/: {
Expand Down Expand Up @@ -79,12 +81,11 @@
require => Package['snmpd'],
}

#TODO var-net-snmp ensure => 'directory'
file { 'var-net-snmp':
ensure => 'directory',
mode => $snmp::params::varnetsnmp_perms,
owner => 'root',
group => 'root',
owner => $snmp::params::varnetsnmp_owner,
group => $snmp::params::varnetsnmp_group,
path => $snmp::params::var_net_snmp,
require => Package['snmpd'],
}
Expand Down
Loading