Support Puppet v4 and v3 with future parser
This commit is contained in:
parent
7462cd401c
commit
b434ea89ef
@ -2,7 +2,7 @@ fixtures:
|
||||
repositories:
|
||||
stdlib:
|
||||
repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
|
||||
ref: '3.2.0'
|
||||
ref: '4.6.0'
|
||||
common:
|
||||
repo: 'git://github.com/ghoneycutt/puppet-module-common.git'
|
||||
ref: 'v1.0.2'
|
||||
|
@ -16,14 +16,21 @@ env:
|
||||
- PUPPET_GEM_VERSION="~> 3.5.1"
|
||||
- PUPPET_GEM_VERSION="~> 3.6.0"
|
||||
- PUPPET_GEM_VERSION="~> 3.7.0"
|
||||
- PUPPET_GEM_VERSION="~> 3.7.0" FUTURE_PARSER="yes"
|
||||
- PUPPET_GEM_VERSION="~> 4.0.0"
|
||||
|
||||
|
||||
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'
|
||||
#script: 'bundle exec metadata-json-lint metadata.json && bundle exec rake validate && bundle exec rake lint && SPEC_OPTS="--format documentation" bundle exec rake spec'
|
||||
# don't care about lint right now..
|
||||
script: 'bundle exec metadata-json-lint metadata.json && bundle exec rake validate && SPEC_OPTS="--format documentation" bundle exec rake spec'
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
exclude:
|
||||
- rvm: 1.8.7
|
||||
env: PUPPET_GEM_VERSION="~> 4.0.0"
|
||||
- rvm: 2.0.0
|
||||
env: PUPPET_GEM_VERSION="~> 3.1.0"
|
||||
- rvm: 2.1.0
|
||||
|
2
Gemfile
2
Gemfile
@ -10,7 +10,7 @@ gem 'metadata-json-lint'
|
||||
gem 'puppetlabs_spec_helper', '>= 0.1.0'
|
||||
gem 'puppet-lint', '>= 1.0.0'
|
||||
gem 'facter', '>= 1.7.0'
|
||||
gem 'rspec-puppet', '~>1.0'
|
||||
gem 'rspec-puppet', '~> 2.0'
|
||||
|
||||
# rspec must be v2 for ruby 1.8.7
|
||||
if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '1.9'
|
||||
|
@ -8,7 +8,9 @@ The module uses exported resources to manage ssh keys and removes ssh keys that
|
||||
|
||||
# Compatability
|
||||
|
||||
This module has been tested to work on the following systems with Puppet v3 and Ruby versions 1.8.7, 1.9.3, 2.0.0 and 2.1.0.
|
||||
This module has been tested to work on the following systems with Puppet
|
||||
versions v3, v3 with future parser and v4 with Ruby versions 1.8.7 (Puppet v3
|
||||
only), 1.9.3, 2.0.0 and 2.1.0.
|
||||
|
||||
* Debian 7
|
||||
* EL 5
|
||||
|
@ -325,7 +325,7 @@ class ssh (
|
||||
if $ssh_sendenv == 'USE_DEFAULTS' {
|
||||
$ssh_sendenv_real = $default_ssh_sendenv
|
||||
} else {
|
||||
case type($ssh_sendenv) {
|
||||
case type3x($ssh_sendenv) {
|
||||
'string': {
|
||||
validate_re($ssh_sendenv, '^(true|false)$', "ssh::ssh_sendenv may be either 'true' or 'false' and is set to <${ssh_sendenv}>.")
|
||||
$ssh_sendenv_real = str2bool($ssh_sendenv)
|
||||
@ -342,7 +342,7 @@ class ssh (
|
||||
if $sshd_acceptenv == 'USE_DEFAULTS' {
|
||||
$sshd_acceptenv_real = $default_sshd_acceptenv
|
||||
} else {
|
||||
case type($sshd_acceptenv) {
|
||||
case type3x($sshd_acceptenv) {
|
||||
'string': {
|
||||
validate_re($sshd_acceptenv, '^(true|false)$', "ssh::sshd_acceptenv may be either 'true' or 'false' and is set to <${sshd_acceptenv}>.")
|
||||
$sshd_acceptenv_real = str2bool($sshd_acceptenv)
|
||||
@ -371,7 +371,7 @@ class ssh (
|
||||
if $service_hasstatus == 'USE_DEFAULTS' {
|
||||
$service_hasstatus_real = $default_service_hasstatus
|
||||
} else {
|
||||
case type($service_hasstatus) {
|
||||
case type3x($service_hasstatus) {
|
||||
'string': {
|
||||
validate_re($service_hasstatus, '^(true|false)$', "ssh::service_hasstatus must be 'true' or 'false' and is set to <${service_hasstatus}>.")
|
||||
$service_hasstatus_real = str2bool($service_hasstatus)
|
||||
@ -491,7 +491,7 @@ class ssh (
|
||||
|
||||
validate_re($sshd_ignorerhosts, '^(yes|no)$', "ssh::sshd_ignorerhosts may be either 'yes' or 'no' and is set to <${sshd_ignorerhosts}>.")
|
||||
|
||||
case type($hiera_merge) {
|
||||
case type3x($hiera_merge) {
|
||||
'string': {
|
||||
validate_re($hiera_merge, '^(true|false)$', "ssh::hiera_merge may be either 'true' or 'false' and is set to <${hiera_merge}>.")
|
||||
$hiera_merge_real = str2bool($hiera_merge)
|
||||
@ -504,14 +504,21 @@ class ssh (
|
||||
}
|
||||
}
|
||||
|
||||
if type($ssh_key_import) == 'string' {
|
||||
case type3x($ssh_key_import) {
|
||||
'string': {
|
||||
validate_re($ssh_key_import, '^(true|false)$', "ssh::ssh_key_import may be either 'true' or 'false' and is set to <${ssh_key_import}>.")
|
||||
$ssh_key_import_real = str2bool($ssh_key_import)
|
||||
} else {
|
||||
}
|
||||
'boolean': {
|
||||
$ssh_key_import_real = $ssh_key_import
|
||||
}
|
||||
default: {
|
||||
fail('ssh::ssh_key_import type must be true or false.')
|
||||
}
|
||||
}
|
||||
validate_bool($ssh_key_import_real)
|
||||
|
||||
case type($ssh_config_sendenv_xmodifiers) {
|
||||
case type3x($ssh_config_sendenv_xmodifiers) {
|
||||
'string': {
|
||||
$ssh_config_sendenv_xmodifiers_real = str2bool($ssh_config_sendenv_xmodifiers)
|
||||
}
|
||||
|
@ -10,11 +10,11 @@
|
||||
"requirements": [
|
||||
{
|
||||
"name": "pe",
|
||||
"version_requirement": ">= 3.2.0 < 4.0.0"
|
||||
"version_requirement": ">= 3.2.0 < 5.0.0"
|
||||
},
|
||||
{
|
||||
"name": "puppet",
|
||||
"version_requirement": "3.x"
|
||||
"version_requirement": ">= 3.0.0 < 5.0.0"
|
||||
}
|
||||
],
|
||||
"operatingsystem_support": [
|
||||
@ -79,7 +79,7 @@
|
||||
],
|
||||
"description": "Manage SSH",
|
||||
"dependencies": [
|
||||
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0 < 5.0.0"},
|
||||
{"name":"puppetlabs/stdlib","version_requirement":">= 4.6.0 < 6.0.0"},
|
||||
{"name":"ghoneycutt/common","version_requirement":">= 1.0.2 < 2.0.0"},
|
||||
{"name":"puppetlabs/firewall","version_requirement":">= 0.2.1 < 2.0.0"}
|
||||
]
|
||||
|
@ -2791,7 +2791,7 @@ describe 'ssh' do
|
||||
end
|
||||
|
||||
context 'specified as an invalid type' do
|
||||
let(:params) { { :ssh_config_global_known_hosts_file => ['invalid','type'] } }
|
||||
let(:params) { { :ssh_config_global_known_hosts_file => { 'invalid' => 'type'} } }
|
||||
let(:facts) do
|
||||
{ :fqdn => 'monkey.example.com',
|
||||
:osfamily => 'RedHat',
|
||||
@ -2802,7 +2802,7 @@ describe 'ssh' do
|
||||
it do
|
||||
expect {
|
||||
should contain_class('ssh')
|
||||
}.to raise_error(Puppet::Error,/^\[\"invalid\", \"type\"\] is not an absolute path./)
|
||||
}.to raise_error(Puppet::Error,/is not an absolute path/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1 +1,14 @@
|
||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.before :each do
|
||||
# Ensure that we don't accidentally cache facts and environment between
|
||||
# test cases. This requires each example group to explicitly load the
|
||||
# facts being exercised with something like
|
||||
# Facter.collection.loader.load(:ipaddress)
|
||||
Facter.clear
|
||||
Facter.clear_messages
|
||||
|
||||
Puppet[:parser] = 'future' if ENV['FUTURE_PARSER'] == 'yes'
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user