From 4e9ff96f1fc919fb96e59d03a3180bcb70c9cf65 Mon Sep 17 00:00:00 2001 From: Trevor Vaughan Date: Wed, 9 May 2018 16:44:06 -0400 Subject: [PATCH] Fix support for 'puppet generate types' (#7) This works around SERVER-94 issues Puppet < 4.10.4 does not properly process the 'puppet generate types' supporting composite namevars. Closes #6 --- .travis.yml | 8 ++++---- CHANGELOG.md | 6 ++++++ lib/puppet/type/apache_directive.rb | 17 ++++++++-------- metadata.json | 20 +++++++++++++++++-- .../provider/apache_directive/augeas_spec.rb | 2 -- .../provider/apache_setenv/augeas_spec.rb | 2 -- 6 files changed, 36 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index f0dd50d..c8329ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ sudo: required rvm: - 2.1.9 # Ruby with Puppet 5 - - 2.4.0 + - 2.4.4 notifications: email: - raphael.pinson@camptocamp.com @@ -13,9 +13,9 @@ env: # Test Puppet 4 - PUPPET=4.0 RUBY_AUGEAS=0.5 # Test Oldest Puppet, Inc. supported Puppet - - PUPPET=4.7.1 RUBY_AUGEAS=0.5 FORGE_PUBLISH=true + - PUPPET=4.10.4 RUBY_AUGEAS=0.5 FORGE_PUBLISH=true # Test latest Puppet version - - PUPPET=5.0 RUBY_AUGEAS=0.5 + - PUPPET=5.5 RUBY_AUGEAS=0.5 matrix: fast_finish: true @@ -23,7 +23,7 @@ matrix: # base exclude # No support for Ruby 2.1.9 in Puppet 5 - rvm: 2.1.9 - env: PUPPET=5.0 RUBY_AUGEAS=0.5 + env: PUPPET=5.5 RUBY_AUGEAS=0.5 install: - "travis_retry ./.travis.sh" diff --git a/CHANGELOG.md b/CHANGELOG.md index d7ce274..5cc4d51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 3.0.0 + +- Fix support for 'puppet generate types' +- Remove misplaced stubs in spec tests +- Added CentOS and OracleLinux to supported OS list + ## 2.0.2 - Upped supported Puppet versions to include Puppet 5 diff --git a/lib/puppet/type/apache_directive.rb b/lib/puppet/type/apache_directive.rb index 5e6bd7e..b23466e 100644 --- a/lib/puppet/type/apache_directive.rb +++ b/lib/puppet/type/apache_directive.rb @@ -56,34 +56,33 @@ def insync?(is) end def self.title_patterns - identity = lambda { |x| x } [ [ /^(\S+)\s+from\s+(\S+)\s+in\s+(.*)$/, [ - [ :name, identity ], - [ :context, identity ], - [ :target, identity ], + [ :name ], + [ :context ], + [ :target ], ] ], [ /^(\S+)\s+from\s+(\S+)$/, [ - [ :name, identity ], - [ :context, identity ], + [ :name ], + [ :context ], ] ], [ /^(\S+)\s+in\s+(.*)$/, [ - [ :name, identity ], - [ :target, identity ], + [ :name ], + [ :target ], ] ], [ /(.*)/, [ - [ :name, identity ], + [ :name ], ] ] ] diff --git a/metadata.json b/metadata.json index 07d723d..5669a86 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "herculesteam-augeasproviders_apache", - "version": "2.0.2", + "version": "3.0.0", "author": "Dominic Cleal, Raphael Pinson", "summary": "Augeas-based apache types and providers for Puppet", "license": "Apache-2.0", @@ -43,12 +43,28 @@ "6", "7" ] + }, + { + "operatingsystem": "CentOS", + "operatingsystemrelease": [ + "4", + "5", + "6", + "7" + ] + }, + { + "operatingsystem": "OracleLinux", + "operatingsystemrelease": [ + "6", + "7" + ] } ], "requirements": [ { "name": "puppet", - "version_requirement": ">= 2.7.0 < 6.0.0" + "version_requirement": ">= 4.10.4 < 6.0.0" } ] } diff --git a/spec/unit/puppet/provider/apache_directive/augeas_spec.rb b/spec/unit/puppet/provider/apache_directive/augeas_spec.rb index 8992e4a..d25ee70 100644 --- a/spec/unit/puppet/provider/apache_directive/augeas_spec.rb +++ b/spec/unit/puppet/provider/apache_directive/augeas_spec.rb @@ -2,8 +2,6 @@ require 'spec_helper' -FileTest.stubs(:exist?).returns false -FileTest.stubs(:exist?).with('/etc/apache2/apache2.conf').returns true provider_class = Puppet::Type.type(:apache_directive).provider(:augeas) describe provider_class do diff --git a/spec/unit/puppet/provider/apache_setenv/augeas_spec.rb b/spec/unit/puppet/provider/apache_setenv/augeas_spec.rb index 91844e9..4753957 100644 --- a/spec/unit/puppet/provider/apache_setenv/augeas_spec.rb +++ b/spec/unit/puppet/provider/apache_setenv/augeas_spec.rb @@ -2,8 +2,6 @@ require 'spec_helper' -FileTest.stubs(:exist?).returns false -FileTest.stubs(:exist?).with('/etc/apache2/apache2.conf').returns true provider_class = Puppet::Type.type(:apache_setenv).provider(:augeas) describe provider_class do