From a2484ab2395cc432b479f5ab2c8706aa30169262 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Thu, 6 Feb 2014 14:43:09 -0500 Subject: [PATCH 1/2] Support Ruby v2.0.0 --- .fixtures.yml | 18 +++++++++--------- .travis.yml | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 325af1a..f8b6dce 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,12 +1,12 @@ fixtures: repositories: - "stdlib": - repo: "git://github.com/puppetlabs/puppetlabs-stdlib.git" - ref: "3.2.0" - "common": - repo: "git://github.com/ghoneycutt/puppet-module-common.git" - ref: "v1.0.2" - "firewall": - repo: "git://github.com/puppetlabs/puppetlabs-firewall.git" + stdlib: + repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git' + ref: '3.2.0' + common: + repo: 'git://github.com/ghoneycutt/puppet-module-common.git' + ref: 'v1.0.2' + firewall: + repo: 'git://github.com/puppetlabs/puppetlabs-firewall.git' symlinks: - "ssh": "#{source_dir}" + ssh: "#{source_dir}" diff --git a/.travis.yml b/.travis.yml index 2c28477..fc33eff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,6 @@ rvm: matrix: fast_finish: true allow_failures: - - rvm: 2.0.0 - env: PUPPET_VERSION=3.4.2 language: ruby before_script: "gem install --no-ri --no-rdoc bundler" From cd5e300fa03221e8c11595fbcfdedc9c8d961a9f Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Thu, 6 Feb 2014 14:54:43 -0500 Subject: [PATCH 2/2] Support Puppet v3.4 --- .travis.yml | 4 --- README.md | 2 +- manifests/init.pp | 11 ++++---- spec/classes/init_spec.rb | 54 +++++++++++++++++++-------------------- 4 files changed, 33 insertions(+), 38 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc33eff..69db3b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,10 +8,6 @@ rvm: - 1.8.7 - 1.9.3 - 2.0.0 -matrix: - fast_finish: true - allow_failures: - - env: PUPPET_VERSION=3.4.2 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' diff --git a/README.md b/README.md index 74de5a1..23fb415 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ 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. +This module has been tested to work on the following systems with Puppet v3 and Ruby versions 1.8.7, 1.9.3 and 2.0.0. * Debian 7 * EL 5 diff --git a/manifests/init.pp b/manifests/init.pp index 938c58a..958ca51 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -173,9 +173,8 @@ class ssh ( $sshd_config_subsystem_sftp_real = $sshd_config_subsystem_sftp } - package { 'ssh_packages': + package { $packages_real: ensure => installed, - name => $packages_real, } file { 'ssh_config' : @@ -185,7 +184,7 @@ class ssh ( group => $ssh_config_group, mode => $ssh_config_mode, content => template('ssh/ssh_config.erb'), - require => Package['ssh_packages'], + require => Package[$packages_real], } file { 'sshd_config' : @@ -195,7 +194,7 @@ class ssh ( owner => $sshd_config_owner, group => $sshd_config_group, content => template('ssh/sshd_config.erb'), - require => Package['ssh_packages'], + require => Package[$packages_real], } if $sshd_config_banner != 'none' and $sshd_banner_content != undef { @@ -206,7 +205,7 @@ class ssh ( group => $sshd_banner_group, mode => $sshd_banner_mode, content => $sshd_banner_content, - require => Package['ssh_packages'], + require => Package[$packages_real], } } @@ -265,7 +264,7 @@ class ssh ( ensure => $ssh_key_ensure, type => $ssh_key_type, key => $key, - require => Package['ssh_packages'], + require => Package[$packages_real], } # import all nodes' ssh keys diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 7918ceb..33b4291 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -16,12 +16,13 @@ describe 'ssh' do it { should_not contain_class('common')} - it { - should contain_package('ssh_packages').with({ - 'ensure' => 'installed', - 'name' => ['openssh-server','openssh-clients'], - }) - } + ['openssh-server','openssh-clients'].each do |pkg| + it { + should contain_package(pkg).with({ + 'ensure' => 'installed', + }) + } + end it { should contain_file('ssh_config').with({ @@ -30,7 +31,7 @@ describe 'ssh' do 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-clients]'], }) } @@ -49,7 +50,7 @@ describe 'ssh' do 'owner' => 'root', 'group' => 'root', 'mode' => '0600', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-clients]'], }) } @@ -101,12 +102,13 @@ describe 'ssh' do it { should_not contain_class('common')} - it { - should contain_package('ssh_packages').with({ - 'ensure' => 'installed', - 'name' => ['openssh-server','openssh-client'], - }) - } + ['openssh-server','openssh-client'].each do |pkg| + it { + should contain_package(pkg).with({ + 'ensure' => 'installed', + }) + } + end it { should contain_file('ssh_config').with({ @@ -115,7 +117,7 @@ describe 'ssh' do 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-client]'], }) } @@ -134,7 +136,7 @@ describe 'ssh' do 'owner' => 'root', 'group' => 'root', 'mode' => '0600', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-client]'], }) } @@ -189,9 +191,8 @@ describe 'ssh' do it { should_not contain_class('common')} it { - should contain_package('ssh_packages').with({ + should contain_package('openssh').with({ 'ensure' => 'installed', - 'name' => 'openssh', }) } @@ -202,7 +203,7 @@ describe 'ssh' do 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'require' => 'Package[ssh_packages]', + 'require' => 'Package[openssh]', }) } @@ -221,7 +222,7 @@ describe 'ssh' do 'owner' => 'root', 'group' => 'root', 'mode' => '0600', - 'require' => 'Package[ssh_packages]', + 'require' => 'Package[openssh]', }) } @@ -276,9 +277,8 @@ describe 'ssh' do it { should_not contain_class('common')} it { - should contain_package('ssh_packages').with({ + should contain_package('openssh').with({ 'ensure' => 'installed', - 'name' => 'openssh', }) } @@ -289,7 +289,7 @@ describe 'ssh' do 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'require' => 'Package[ssh_packages]', + 'require' => 'Package[openssh]', }) } @@ -308,7 +308,7 @@ describe 'ssh' do 'owner' => 'root', 'group' => 'root', 'mode' => '0600', - 'require' => 'Package[ssh_packages]', + 'require' => 'Package[openssh]', }) } @@ -393,7 +393,7 @@ describe 'ssh' do 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-clients]'], }) } @@ -444,7 +444,7 @@ describe 'ssh' do 'owner' => 'root', 'group' => 'root', 'mode' => '0600', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-clients]'], }) } @@ -472,7 +472,7 @@ describe 'ssh' do 'group' => 'root', 'mode' => '0644', 'content' => 'textinbanner', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-clients]'], }) } end