diff --git a/lib/puppet/type/sshkey.rb b/lib/puppet/type/sshkey.rb index 11d6cef..7971d62 100644 --- a/lib/puppet/type/sshkey.rb +++ b/lib/puppet/type/sshkey.rb @@ -85,7 +85,7 @@ def should if %r{\s}.match?(value) raise Puppet::Error, _('Aliases cannot include whitespace') end - if %r{,}.match?(value) + if value.include?(',') raise Puppet::Error, _('Aliases must be provided as an array, not a comma-separated list') end end diff --git a/spec/acceptance/tests/resource/ssh_authorized_key/create_spec.rb b/spec/acceptance/tests/resource/ssh_authorized_key/create_spec.rb index d19d328..5a9f53d 100644 --- a/spec/acceptance/tests/resource/ssh_authorized_key/create_spec.rb +++ b/spec/acceptance/tests/resource/ssh_authorized_key/create_spec.rb @@ -65,7 +65,7 @@ 'drop_privileges=false', "target=/home/testuser/tmp/ssh_authorized_keys_#{name}/authorized_keys_#{name}"] on(agent, puppet_resource('ssh_authorized_key', name.to_s, args)) do |_res| - fail_test unless %r{the target path is not trusted}.match?(stderr) + fail_test unless stderr.include?('the target path is not trusted') end on(agent, "rm -rf #{custom_key_directory}") @@ -81,7 +81,7 @@ 'drop_privileges=false', "target='#{custom_key}'"] on(agent, puppet_resource('ssh_authorized_key', name.to_s, args), acceptable_exit_codes: [0, 1]) do |_res| - fail_test unless %r{the target path is not trusted}.match?(stderr) + fail_test unless stderr.include?('the target path is not trusted') end end end