summaryrefslogtreecommitdiff
path: root/lib/chef/provider/user/linux.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/provider/user/linux.rb')
-rw-r--r--lib/chef/provider/user/linux.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/provider/user/linux.rb b/lib/chef/provider/user/linux.rb
index bab8588151..40b5985cb1 100644
--- a/lib/chef/provider/user/linux.rb
+++ b/lib/chef/provider/user/linux.rb
@@ -96,7 +96,7 @@ class Chef
passwd_s = shell_out("passwd", "-S", new_resource.username, returns: [ 0, 1 ])
# checking "does not exist" has to come before exit code handling since centos and ubuntu differ in exit codes
- if passwd_s.stderr =~ /does not exist/
+ if /does not exist/.match?(passwd_s.stderr)
return false if whyrun_mode?
raise Chef::Exceptions::User, "User #{new_resource.username} does not exist when checking lock status for #{new_resource}"
@@ -108,8 +108,8 @@ class Chef
# now the actual output parsing
@locked = nil
status_line = passwd_s.stdout.split(" ")
- @locked = false if status_line[1] =~ /^[PN]/
- @locked = true if status_line[1] =~ /^L/
+ @locked = false if /^[PN]/.match?(status_line[1])
+ @locked = true if /^L/.match?(status_line[1])
raise Chef::Exceptions::User, "Cannot determine if user #{new_resource.username} is locked for #{new_resource}" if @locked.nil?