From 80f77a20007d50f8c8dac3ed1748fb22df596e2f Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Tue, 7 Apr 2015 13:55:49 -0400 Subject: [PATCH] Work with Phil on PR Numbers are treated as strings, so removed those from the test. Simplified validation of sshd_config_forcecommand to simply check if it is a string. --- manifests/init.pp | 4 +--- spec/classes/init_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 963deb7..063aa6a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -460,9 +460,7 @@ class ssh ( } if $sshd_config_forcecommand != undef { - if is_string($sshd_config_forcecommand) == false { - fail("ssh::sshd_config_forcecommand must be a string. Detected value is ${sshd_config_forcecommand}.") - } + validate_string($sshd_config_forcecommand) } if $sshd_config_match != undef { diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 0a3e687..cdbf06d 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -1120,14 +1120,14 @@ describe 'ssh' do end end - [true,3,2.42,['array'],a = { 'ha' => 'sh' }].each do |value| + [true,['array'],a = { 'ha' => 'sh' }].each do |value| context "set to invalid #{value} (as #{value.class})" do let (:params) {{'sshd_config_forcecommand' => value }} it 'should fail' do expect { should - }.to raise_error(Puppet::Error, /ssh::sshd_config_forcecommand must be a string. Detected value is #{value}/) + }.to raise_error(Puppet::Error, /is not a string/) end end end