diff --git a/.gitignore b/.gitignore index a4851cf..e6122c7 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.travis.yml b/.travis.yml index 9c8dc56..30038e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Gemfile b/Gemfile index 27747bc..e2f4f26 100644 --- a/Gemfile +++ b/Gemfile @@ -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'] @@ -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 diff --git a/README.md b/README.md index 7f7cef5..864ba40 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/Rakefile b/Rakefile index cd3d379..e2c6d52 100644 --- a/Rakefile +++ b/Rakefile @@ -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 diff --git a/manifests/init.pp b/manifests/init.pp index 7f141c7..c0ef7d2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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, diff --git a/manifests/limits.pp b/manifests/limits.pp index 38dcac3..4c85d33 100644 --- a/manifests/limits.pp +++ b/manifests/limits.pp @@ -1,3 +1,5 @@ +# == Define: limits::limits +# define limits::limits( $user, $limit_type, @@ -6,7 +8,8 @@ $soft = undef, $both = undef ) { - include limits::params + + include ::limits::params if $name =~ /\.conf$/ { $target_file = "${limits::params::limits_dir}${name}" diff --git a/metadata.json b/metadata.json index f9aec28..c564662 100644 --- a/metadata.json +++ b/metadata.json @@ -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", @@ -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": [ - ] } diff --git a/tests/init.pp b/tests/init.pp index 2011942..98d263d 100644 --- a/tests/init.pp +++ b/tests/init.pp @@ -1 +1 @@ -include limits +include ::limits