Skip to content

Commit

Permalink
Fix Rubocop Performance/StringInclude offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
mhashizume committed Jan 10, 2024
1 parent 2f4be63 commit 41f721e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/type/sshkey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand All @@ -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
Expand Down

0 comments on commit 41f721e

Please sign in to comment.