Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
pkg/
# Default .gitignore for Ruby
*.gem
*.rbc
.bundle
.config
coverage
InstalledFiles
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp

# YARD artifacts
.yardoc
_yardoc
doc/

# Vim
*.swp
/spec/fixtures

# OS X
.DS_Store

# Puppet
coverage/
spec/fixtures/modules/*
spec/fixtures/manifests/*
Gemfile.lock
65 changes: 49 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,67 @@
---
branches:
only:
- master
language: ruby
bundler_args: --without development
script: bundle exec rake spec SPEC_OPTS='--format documentation'
after_success:
- git clone -q git://github.com/puppetlabs/ghpublisher.git .forge-releng
- .forge-releng/publish
env:
global:
- PUBLISHER_LOGIN=saz
- secure: |-
koyI8EYdgR0mw7EzgHjeVxHLCqIWCp89yyWiV0YZcwGH4nx09p2MJyA9zTWXb+IbeTvNAgoe
5g+Mk/pA3UOw2fyZaFtna4xTkKfZc5RvuHe+sM/Tz/rpDH4iBs0Pvkmo3UgPx4awb9/e6Uvg
RHGqRD8dKFLYRk10AdQ2emmr7iw=

language: ruby

rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- 2.1.0

env:
matrix:
- PUPPET_GEM_VERSION="~> 2.7.0"
- PUPPET_GEM_VERSION="~> 3.0.0"
- PUPPET_GEM_VERSION="~> 3.1.0"
- PUPPET_GEM_VERSION="~> 3.2.0"
- PUPPET_GEM_VERSION="~> 3.3.0"
global:
- PUBLISHER_LOGIN=saz
- secure: |-
koyI8EYdgR0mw7EzgHjeVxHLCqIWCp89yyWiV0YZcwGH4nx09p2MJyA9zTWXb+IbeTvNAgoe
5g+Mk/pA3UOw2fyZaFtna4xTkKfZc5RvuHe+sM/Tz/rpDH4iBs0Pvkmo3UgPx4awb9/e6Uvg
RHGqRD8dKFLYRk10AdQ2emmr7iw=
- PUPPET_GEM_VERSION="~> 3.4.0"
- PUPPET_GEM_VERSION="~> 3.5.0"
- PUPPET_GEM_VERSION="~> 3.6.0"
- PUPPET_GEM_VERSION="~> 3.7.0"
- PUPPET_GEM_VERSION="~> 3.8.0"
- PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes"
- PUPPET_GEM_VERSION="~> 4.0.0"
- PUPPET_GEM_VERSION="~> 4.1.0"
- PUPPET_GEM_VERSION="~> 4.2.0"
- PUPPET_GEM_VERSION="~> 4.3.0"
- PUPPET_GEM_VERSION="~> 4" STRICT_VARIABLES="yes"

sudo: false

script: 'bundle exec metadata-json-lint metadata.json && bundle exec rake validate && bundle exec rake lint && SPEC_OPTS="--format documentation" bundle exec rake spec'

matrix:
include:
fast_finish: true
exclude:
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.1.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.1.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.2.0"
- rvm: 2.0.0
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.3.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.4.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4.0.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4.1.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4.2.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4.3.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4" STRICT_VARIABLES="yes"

notifications:
email: false
23 changes: 19 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@ source 'https://rubygems.org'

group :development, :test do
gem 'rake'
gem 'puppet-lint'
gem 'rspec', '< 3.2.0', {"platforms"=>["ruby_18"]}
gem 'rspec-puppet', '=1.0.1'
gem 'rspec-puppet'
gem 'metadata-json-lint'
gem 'puppetlabs_spec_helper'
gem 'puppet-lint', :git => 'https://github.com/rodjek/puppet-lint.git'
gem 'puppet-lint-absolute_classname-check'
gem 'puppet-lint-alias-check'
gem 'puppet-lint-empty_string-check'
gem 'puppet-lint-file_ensure-check'
gem 'puppet-lint-file_source_rights-check'
gem 'puppet-lint-fileserver-check'
gem 'puppet-lint-leading_zero-check'
gem 'puppet-lint-spaceship_operator_without_tag-check'
gem 'puppet-lint-trailing_comma-check'
gem 'puppet-lint-undef_in_function-check'
gem 'puppet-lint-unquoted_string-check'
gem 'puppet-lint-variable_contains_upcase'
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
Expand All @@ -14,4 +26,7 @@ else
gem 'puppet', :require => false
end

gem 'hiera-puppet', :require => false
# rspec must be v2 for ruby 1.8.7
if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '1.9'
gem 'rspec', '~> 2.0'
end
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ This module manages the limits of the PAM module pam_limits.

## How to use

`include ::limits`

## Compatibility

This module has been tested to work with Puppet v3 (with and without the future
parser) and v4 with Ruby versions 1.8.7 (Puppet v3 only), 1.9.3, 2.0.0 and
2.1.0.

### Purge limits.d directory

The class `limits` will purge the limit.d directory as default.
Expand Down
17 changes: 17 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.relative = true
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

desc 'Validate manifests, templates, and ruby files'
task :validate do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end
9 changes: 6 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
class limits(
# == Class: limits
#
class limits (
$purge_limits_d_dir = true,
$entries_hash = hiera_hash(limits::entries, {})
) inherits limits::params {
) inherits ::limits::params {

file { $limits::params::limits_dir:
ensure => directory,
ensure => 'directory',
owner => 'root',
group => 'root',
force => true,
Expand Down
5 changes: 4 additions & 1 deletion manifests/limits.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# == Define: limits::limits
#
define limits::limits(
$user,
$limit_type,
Expand All @@ -6,7 +8,8 @@
$soft = undef,
$both = undef
) {
include limits::params

include ::limits::params

if $name =~ /\.conf$/ {
$target_file = "${limits::params::limits_dir}${name}"
Expand Down
12 changes: 4 additions & 8 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "2.3.0",
"author": "saz",
"summary": "Manage user limits via puppet",
"license": "Apache License, Version 2.0",
"description": "Manage user limits via puppet",
"license": "Apache-2.0",
"source": "https://github.com/saz/puppet-limits.git",
"project_page": "https://github.com/saz/puppet-limits",
"issues_url": "https://github.com/saz/puppet-limits/issues",
Expand All @@ -27,18 +28,13 @@
"requirements": [
{
"name": "pe",
"version_requirement": ">= 3.2.0"
"version_requirement": ">= 3.2.0 < 5.0.0"
},
{
"name": "puppet",
"version_requirement": "3.x"
"version_requirement": ">= 3.0.0 < 5.0.0"
}
],
"description": "Manage user limits via puppet",
"types": [

],
"dependencies": [

]
}
2 changes: 1 addition & 1 deletion tests/init.pp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include limits
include ::limits