From 219c27e1920ec4f905bbb3dbf84ab44fe12c9e04 Mon Sep 17 00:00:00 2001 From: Trevor Vaughan Date: Wed, 9 May 2018 16:34:06 -0400 Subject: [PATCH] Fix support for 'puppet generate types' (#6) This works around SERVER-94 issues Puppet < 4.10.4 does not properly process the 'puppet generate types' supporting composite namevars. Closes #5 --- .travis.yml | 8 ++++---- CHANGELOG.md | 7 ++++++- lib/puppet/type/pg_hba.rb | 40 ++++++++++++++++++++------------------- metadata.json | 20 ++++++++++++++++++-- 4 files changed, 49 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 463b6bb..185eff6 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 b52441f..16b09fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,13 @@ # Changelog +## 3.0.0 + +- Fix support for 'puppet generate types' +- Added CentOS and OracleLinux to supported OS list + ## 2.0.4 -- Upped supported Puppet versions to include Puppet 5 +- Upped supported Puppet versions to include Puppet 5 ## 2.0.3 diff --git a/lib/puppet/type/pg_hba.rb b/lib/puppet/type/pg_hba.rb index 8f296d1..ca2b5ed 100644 --- a/lib/puppet/type/pg_hba.rb +++ b/lib/puppet/type/pg_hba.rb @@ -45,6 +45,8 @@ def insync?(is) munge do |value| if value.is_a? Array value + elsif value.is_a? String + value.split(',') else [value] end @@ -59,6 +61,8 @@ def insync?(is) munge do |value| if value.is_a? Array value + elsif value.is_a? String + value.split(',') else [value] end @@ -81,49 +85,47 @@ def insync?(is) end def self.title_patterns - identity = lambda { |x| x } - comma_split = lambda { |x| x.split(',') } [ [ /^(local)\s+to\s+(\S+)\s+on\s+(\S+)\s+in\s+(.*)$/, [ - [ :type, identity ], - [ :user, comma_split ], - [ :database, comma_split ], - [ :target, identity ], + [ :type ], + [ :user ], + [ :database ], + [ :target ], ] ], [ /^(local)\s+to\s+(\S+)\s+on\s+(\S+)$/, [ - [ :type, identity ], - [ :user, comma_split ], - [ :database, comma_split ], + [ :type ], + [ :user ], + [ :database ], ] ], [ /^(host\S*)\s+to\s+(\S+)\s+on\s+(\S+)\s+from\s+(\S+)\s+in\s+(.*)$/, [ - [ :type, identity ], - [ :user, comma_split ], - [ :database, comma_split ], - [ :address, identity ], - [ :target, identity ] + [ :type ], + [ :user ], + [ :database ], + [ :address ], + [ :target ] ] ], [ /^(host\S*)\s+to\s+(\S+)\s+on\s+(\S+)\s+from\s+(\S+)$/, [ - [ :type, identity ], - [ :user, comma_split ], - [ :database, comma_split ], - [ :address, identity ], + [ :type ], + [ :user ], + [ :database ], + [ :address ], ] ], [ /(.*)/, [ - [ :name, identity ], + [ :name ], ] ] ] diff --git a/metadata.json b/metadata.json index bf34865..f0f9f38 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "herculesteam-augeasproviders_postgresql", - "version": "2.0.4", + "version": "3.0.0", "author": "Dominic Cleal, Raphael Pinson", "summary": "Augeas-based postgresql types and providers for Puppet", "license": "Apache-2.0", @@ -43,9 +43,25 @@ "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" } + { "name": "puppet", "version_requirement": ">= 4.10.4 < 6.0.0" } ] }