Skip to content

Commit

Permalink
Fix support for 'puppet generate types' (#41)
Browse files Browse the repository at this point in the history
This works around SERVER-94 issues

Puppet < 4.10.4 does not properly process the 'puppet generate types'
supporting composite namevars.

Closes #40
  • Loading branch information
trevor-vaughan authored May 9, 2018
1 parent b6268b3 commit da5fe25
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 20 deletions.
22 changes: 15 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
language: ruby
dist: precise
sudo: required
rvm:
- 2.1.9
- 2.3.1
# Ruby with Puppet 5
- 2.4.4
notifications:
email:
- [email protected]
env:
# Most common LTS Puppet Version
- PUPPET=4.7 RUBY_AUGEAS=0.5 FORGE_PUBLISH=true
# Current LTS Puppet Version
- PUPPET=4.10 RUBY_AUGEAS=0.5
# base env
# Test Puppet 4
- PUPPET=4.0 RUBY_AUGEAS=0.5
# Test Oldest Puppet, Inc. supported Puppet
- PUPPET=4.10.4 RUBY_AUGEAS=0.5 FORGE_PUBLISH=true
# Test latest Puppet version
- PUPPET=5.5 RUBY_AUGEAS=0.5

matrix:
fast_finish: true
exclude:
# base exclude
# No support for Ruby 2.1.9 in Puppet 5
- rvm: 2.1.9
env: PUPPET=5.5 RUBY_AUGEAS=0.5

install:
- "travis_retry ./.travis.sh"

script:
- AUGEAS_LENS_LIB=lib/augeas/lenses:augeas/lenses bundle exec rake
# Do not include the augeas/ directory in the deployed module
- rm -rf augeas/

deploy:
provider: puppetforge
user: herculesteam
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 3.0.0

- Fix support for 'puppet generate types'
- Bumped supported puppet version to less than 6.0.0
- Updated the spec_helper.rb to correctly load for Puppet 5
- Added CentOS and OracleLinux to supported OS list

## 2.5.3

- ssh_config: fix HostKeyAlgorithms and KexAlgorithms (#GH 36)
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/sshd_config_match/augeas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def position!
end
end

def create
def create
augopen! do |aug|
path = self.class.static_path(resource)
aug.defnode('resource', path, nil)
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/type/sshd_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@

newproperty(:value, :array_matching => :all) do
desc "Value to change the setting to. The follow parameters take an array of values:
- MACs;
- AcceptEnv;
- AllowGroups;
- AllowUsers;

This comment has been minimized.

Copy link
@logicminds

logicminds Jun 13, 2018

Don't Ciphers and KexAlgorithms also take arrays?

This comment has been minimized.

Copy link
@trevor-vaughan

trevor-vaughan Jun 15, 2018

Author Contributor

@logicminds Quite possibly but that's irrelevant to the actual change here and should probably be filed as a separate bug.

- DenyGroups;
- DenyUsers.
All other parameters take a string. When passing an array to other parameters, only the first value in the array will be considered."
end

Expand Down
13 changes: 6 additions & 7 deletions lib/puppet/type/sshd_config_match.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,26 @@ def insync?(is)
end

def self.title_patterns
identity = lambda { |x| x }
[
[
/^(((?:\S*\s+\S*)+)\s+in\s+(\S+))$/,
[
[ :name, identity ],
[ :condition, identity ],
[ :target, identity ],
[ :name ],
[ :condition ],
[ :target ],
]
],
[
/^(((?:\S*\s+\S*)+))$/,
[
[ :name, identity ],
[ :condition, identity ],
[ :name ],
[ :condition ],
]
],
[
/(.*)/,
[
[ :name, identity ],
[ :name ],
]
]
]
Expand Down
20 changes: 18 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "herculesteam-augeasproviders_ssh",
"version": "2.5.3",
"version": "3.0.0",
"author": "Dominic Cleal, Raphael Pinson",
"summary": "Augeas-based ssh types and providers for Puppet",
"license": "Apache-2.0",
Expand Down Expand Up @@ -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 < 5.0.0" }
{ "name": "puppet", "version_requirement": ">= 4.10.4 < 6.0.0" }
]
}
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# ticket https://tickets.puppetlabs.com/browse/MODULES-823
#
ver = Gem::Version.new(Puppet.version.split('-').first)
if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver || Gem::Requirement.new("~> 4.0") =~ ver
if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver || Gem::Requirement.new("~> 4.0") =~ ver || Gem::Requirement.new("~> 5.0") =~ ver
puts "augeasproviders: setting Puppet[:libdir] to work around broken type autoloading"
# libdir is only a single dir, so it can only workaround loading of one external module
Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib"
Expand Down

0 comments on commit da5fe25

Please sign in to comment.