diff --git a/.fixtures.yml b/.fixtures.yml index 3a45c97..1da8a2b 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -2,6 +2,6 @@ fixtures: repositories: stdlib: repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git' - ref: '3.2.0' + ref: '4.6.0' symlinks: chattr: "#{source_dir}" diff --git a/.gitignore b/.gitignore index cdc0315..02fac62 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ spec/reports test/tmp test/version_tmp tmp +Gemfile.lock # YARD artifacts .yardoc @@ -27,4 +28,4 @@ doc/ # Puppet coverage/ spec/fixtures/modules/* -spec/fixtures/ +spec/fixtures diff --git a/.travis.yml b/.travis.yml index bc38887..e27f4d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,50 @@ --- +language: ruby + +rvm: + - 1.8.7 + - 1.9.3 + - 2.0.0 + - 2.1.0 + env: -- PUPPET_VERSION=3.3.2 -- PUPPET_VERSION=3.4.2 -- PUPPET_VERSION=3.5.1 + matrix: + - PUPPET_GEM_VERSION="~> 3.1" + - PUPPET_GEM_VERSION="~> 3.2" + - PUPPET_GEM_VERSION="~> 3.3" + - PUPPET_GEM_VERSION="~> 3.4" + - PUPPET_GEM_VERSION="~> 3.5" + - PUPPET_GEM_VERSION="~> 3.6" + - PUPPET_GEM_VERSION="~> 3.7" + - PUPPET_GEM_VERSION="~> 3.8" + - PUPPET_GEM_VERSION="~> 3" PARSER="future" + - PUPPET_GEM_VERSION="~> 4.0" + - PUPPET_GEM_VERSION="~> 4.1" + - PUPPET_GEM_VERSION="~> 4" + +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: + fast_finish: true + exclude: + - rvm: 2.0.0 + env: PUPPET_GEM_VERSION="~> 3.1" + - rvm: 2.1.0 + env: PUPPET_GEM_VERSION="~> 3.1" + - rvm: 2.1.0 + env: PUPPET_GEM_VERSION="~> 3.2" + - rvm: 2.1.0 + env: PUPPET_GEM_VERSION="~> 3.3" + - rvm: 2.1.0 + env: PUPPET_GEM_VERSION="~> 3.4" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 4.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 4.1" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 4" + notifications: -email: false -rvm: -- 1.8.7 -- 1.9.3 -- 2.0.0 -language: ruby -before_script: "gem install --no-ri --no-rdoc bundler" -script: 'bundle exec rake validate && bundle exec rake lint && SPEC_OPTS="--format documentation" bundle exec rake spec' -gemfile: Gemfile + email: false diff --git a/Gemfile b/Gemfile index 60aff61..706913c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,18 @@ -source "https://rubygems.org" +source 'https://rubygems.org' -puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.3'] -gem 'puppet', puppetversion +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', :require => false +end + +gem 'metadata-json-lint' gem 'puppetlabs_spec_helper', '>= 0.1.0' -gem 'puppet-lint', '>= 0.3.2' +gem 'puppet-lint', '>= 1.0.0' gem 'facter', '>= 1.7.0' +gem 'rspec-puppet' + +# 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/Modulefile b/Modulefile deleted file mode 100644 index b317073..0000000 --- a/Modulefile +++ /dev/null @@ -1,10 +0,0 @@ -name 'kinneygroup-chattr' -version '0.1.0' -source 'git://github.com/kinneygroup/puppet-module-chattr.git' -author 'kinneygroup' -license 'Apache License, Version 2.0' -summary 'deal with immutable attribute bug' -description 'manage chattr attributes' -project_page 'https://github.com/kinneygroup/puppet-module-chattr' - -dependency 'puppetlabs/stdlib', '>= 3.2.0' diff --git a/README.md b/README.md index abb96de..f984b4e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ Hack to get around Puppet's inability to manage files with the immutable attribu # Compatibility --------------- -This module is built for use with Puppet v3 with Ruby versions 1.8.7, 1.9.3, and 2.0.0 on all Linux systems. +This module is built for use with Puppet v4 and v3 (with and without future +parser) with Ruby versions 1.8.7, 1.9.3, 2.0.0 and 2.1.0 on all Linux systems. === diff --git a/Rakefile b/Rakefile index d1e11f7..e2c6d52 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,10 @@ -require 'rubygems' 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" +desc 'Validate manifests, templates, and ruby files' task :validate do Dir['manifests/**/*.pp'].each do |manifest| sh "puppet parser validate --noop #{manifest}" diff --git a/manifests/init.pp b/manifests/init.pp index 38f251e..07643db 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -11,7 +11,7 @@ $attribute_removes_hiera_merge = true, ) { - if type($attribute_adds_hiera_merge) == 'string' { + if type3x($attribute_adds_hiera_merge) == 'string' { $attribute_adds_hiera_merge_real = str2bool($attribute_adds_hiera_merge) } else { $attribute_adds_hiera_merge_real = $attribute_adds_hiera_merge @@ -28,7 +28,7 @@ create_resources('chattr::attribute_add',$attribute_adds_real) } - if type($attribute_removes_hiera_merge) == 'string' { + if type3x($attribute_removes_hiera_merge) == 'string' { $attribute_removes_hiera_merge_real = str2bool($attribute_removes_hiera_merge) } else { $attribute_removes_hiera_merge_real = $attribute_removes_hiera_merge diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..fd518a5 --- /dev/null +++ b/metadata.json @@ -0,0 +1,87 @@ +{ + "name": "kinneygroup-chattr", + "version": "0.1.0", + "author": "kinneygroup", + "summary": "deal with immutable attribute bug", + "license": "Apache-2.0", + "source": "git://github.com/kinneygroup/puppet-module-chattr.git", + "project_page": "https://github.com/kinneygroup/puppet-module-chattr", + "issues_url": "https://github.com/kinneygroup/puppet-module-chattr/issues", + "description": "manage chattr attributes", + "requirements": [ + { + "name": "pe", + "version_requirement": ">= 3.2.0 < 5.0.0" + }, + { + "name": "puppet", + "version_requirement": ">= 3.0.0 < 5.0.0" + } + ], + "operatingsystem_support": [ + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "6" + ] + }, + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] + }, + { + "operatingsystem": "CentOS", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] + }, + { + "operatingsystem": "OracleLinux", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] + }, + { + "operatingsystem": "Scientific", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] + }, + { + "operatingsystem": "SLES", + "operatingsystemrelease": [ + "10", + "11", + "12" + ] + }, + { + "operatingsystem": "SLED", + "operatingsystemrelease": [ + "10", + "11", + "12" + ] + }, + { + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "12.04", + "14.04" + ] + } + ], + "dependencies": [ + {"name":"puppetlabs/stdlib","version_requirement":">= 4.6.0"} + ] +} diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index dc7e9f4..748cdad 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,2 +1,7 @@ -require 'rubygems' require 'puppetlabs_spec_helper/module_spec_helper' + +RSpec.configure do |config| + config.before :each do + Puppet[:parser] = 'future' if ENV['PARSER'] == 'future' + end +end