From cd5e300fa03221e8c11595fbcfdedc9c8d961a9f Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Thu, 6 Feb 2014 14:54:43 -0500 Subject: [PATCH] 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 fc33effe..69db3b74 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 74de5a18..23fb4157 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 938c58a3..958ca511 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -173,9 +173,8 @@ $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 @@ 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 @@ 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 @@ group => $sshd_banner_group, mode => $sshd_banner_mode, content => $sshd_banner_content, - require => Package['ssh_packages'], + require => Package[$packages_real], } } @@ -265,7 +264,7 @@ 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 7918ceb9..33b42910 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -16,12 +16,13 @@ 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 @@ 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-clients]'], }) } @@ -49,7 +50,7 @@ 'owner' => 'root', 'group' => 'root', 'mode' => '0600', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-clients]'], }) } @@ -101,12 +102,13 @@ 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 @@ 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-client]'], }) } @@ -134,7 +136,7 @@ 'owner' => 'root', 'group' => 'root', 'mode' => '0600', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-client]'], }) } @@ -189,9 +191,8 @@ 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 @@ 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'require' => 'Package[ssh_packages]', + 'require' => 'Package[openssh]', }) } @@ -221,7 +222,7 @@ 'owner' => 'root', 'group' => 'root', 'mode' => '0600', - 'require' => 'Package[ssh_packages]', + 'require' => 'Package[openssh]', }) } @@ -276,9 +277,8 @@ 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 @@ 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'require' => 'Package[ssh_packages]', + 'require' => 'Package[openssh]', }) } @@ -308,7 +308,7 @@ 'owner' => 'root', 'group' => 'root', 'mode' => '0600', - 'require' => 'Package[ssh_packages]', + 'require' => 'Package[openssh]', }) } @@ -393,7 +393,7 @@ 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-clients]'], }) } @@ -444,7 +444,7 @@ 'owner' => 'root', 'group' => 'root', 'mode' => '0600', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-clients]'], }) } @@ -472,7 +472,7 @@ 'group' => 'root', 'mode' => '0644', 'content' => 'textinbanner', - 'require' => 'Package[ssh_packages]', + 'require' => ['Package[openssh-server]', 'Package[openssh-clients]'], }) } end