diff --git a/manifests/init.pp b/manifests/init.pp index 378993e..1c7fd53 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -43,20 +43,19 @@ class ssh ( $sshd_client_alive_interval = '0', ) { - # - validate_re($sshd_password_authentication, '^(yes|no)$', "sshd_password_authentication may be either 'yes' or 'no' and is set to '${sshd_password_authentication}'.") - validate_re($sshd_allow_tcp_forwarding, '^(yes|no)$', "sshd_allow_tcp_forwarding may be either 'yes' or 'no' and is set to '${sshd_allow_tcp_forwarding}'.") - validate_re($sshd_x11_forwarding, '^(yes|no)$', "sshd_x11_forwarding may be either 'yes' or 'no' and is set to '${sshd_x11_forwarding}'.") - validate_re($sshd_use_pam, '^(yes|no)$', "sshd_use_pam may be either 'yes' or 'no' and is set to '${sshd_use_pam}'.") - if is_integer($sshd_client_alive_interval) == false { fail("sshd_client_alive_interval must be an integer and is set to '${sshd_client_alive_interval}'.") } - # + # validate params + validate_re($sshd_password_authentication, '^(yes|no)$', "sshd_password_authentication may be either 'yes' or 'no' and is set to <${sshd_password_authentication}>.") + validate_re($sshd_allow_tcp_forwarding, '^(yes|no)$', "sshd_allow_tcp_forwarding may be either 'yes' or 'no' and is set to <${sshd_allow_tcp_forwarding}>.") + validate_re($sshd_x11_forwarding, '^(yes|no)$', "sshd_x11_forwarding may be either 'yes' or 'no' and is set to <${sshd_x11_forwarding}>.") + validate_re($sshd_use_pam, '^(yes|no)$', "sshd_use_pam may be either 'yes' or 'no' and is set to <${sshd_use_pam}>.") + if is_integer($sshd_client_alive_interval) == false { fail("sshd_client_alive_interval must be an integer and is set to <${sshd_client_alive_interval}>.") } case $permit_root_login { 'no', 'yes', 'without-password', 'forced-commands-only': { # noop } default: { - fail("permit_root_login may be either 'yes', 'without-password', 'forced-commands-only' or 'no' and is set to ${permit_root_login}") + fail("permit_root_login may be either 'yes', 'without-password', 'forced-commands-only' or 'no' and is set to <${permit_root_login}>") } } @@ -68,7 +67,7 @@ class ssh ( $key = $::sshdsakey } default: { - fail("ssh_key_type must be 'ssh-rsa', 'rsa', 'ssh-dsa', or 'dsa' and is ${ssh_key_type}") + fail("ssh_key_type must be 'ssh-rsa', 'rsa', 'ssh-dsa', or 'dsa' and is <${ssh_key_type}>") } } @@ -77,7 +76,7 @@ class ssh ( # noop } default: { - fail("purge_keys must be 'true' or 'false' and is ${purge_keys}") + fail("purge_keys must be 'true' or 'false' and is <${purge_keys}>") } } diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 81dbcf0..8ff3074 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -502,7 +502,7 @@ describe 'ssh' do it 'should fail' do expect { should include_class('ssh') - }.to raise_error(Puppet::Error,/sshd_password_authentication may be either \'yes\' or \'no\' and is set to \'invalid\'./) + }.to raise_error(Puppet::Error,/sshd_password_authentication may be either \'yes\' or \'no\' and is set to ./) end end @@ -521,7 +521,7 @@ describe 'ssh' do it 'should fail' do expect { should include_class('ssh') - }.to raise_error(Puppet::Error,/sshd_allow_tcp_forwarding may be either \'yes\' or \'no\' and is set to \'invalid\'./) + }.to raise_error(Puppet::Error,/sshd_allow_tcp_forwarding may be either \'yes\' or \'no\' and is set to ./) end end @@ -540,7 +540,7 @@ describe 'ssh' do it 'should fail' do expect { should include_class('ssh') - }.to raise_error(Puppet::Error,/sshd_x11_forwarding may be either \'yes\' or \'no\' and is set to \'invalid\'./) + }.to raise_error(Puppet::Error,/sshd_x11_forwarding may be either \'yes\' or \'no\' and is set to ./) end end @@ -559,7 +559,7 @@ describe 'ssh' do it 'should fail' do expect { should include_class('ssh') - }.to raise_error(Puppet::Error,/sshd_use_pam may be either \'yes\' or \'no\' and is set to \'invalid\'./) + }.to raise_error(Puppet::Error,/sshd_use_pam may be either \'yes\' or \'no\' and is set to ./) end end @@ -578,7 +578,7 @@ describe 'ssh' do it 'should fail' do expect { should include_class('ssh') - }.to raise_error(Puppet::Error,/sshd_client_alive_interval must be an integer and is set to \'invalid\'./) + }.to raise_error(Puppet::Error,/sshd_client_alive_interval must be an integer and is set to ./) end end