summaryrefslogtreecommitdiff
path: root/lib/chef/provider/user/dscl.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-08-03 15:21:16 -0700
committerTim Smith <tsmith84@gmail.com>2020-08-03 16:23:27 -0700
commit9a6ac264ade2ca205b00e4247c7c2d4d8d757f4a (patch)
treeb1d2192c5a04fa6920d92a30c00ca35d883fa98a /lib/chef/provider/user/dscl.rb
parentc202ce4e318a6bc842158970aeb6b3d13fa6a0df (diff)
downloadchef-9a6ac264ade2ca205b00e4247c7c2d4d8d757f4a.tar.gz
Use .key? instead of keys.include
We don't need to create an array that we then search when we can just search the hash. Also disable a few hash like calls that are false positives Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/provider/user/dscl.rb')
-rw-r--r--lib/chef/provider/user/dscl.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index 4c056b00fd..7b86fa5269 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -562,7 +562,7 @@ in 'password', with the associated 'salt' and 'iterations'.")
# Sets a value in user information hash using Chef attributes as keys.
#
def dscl_set(user_hash, key, value)
- raise "Unknown dscl key #{key}" unless DSCL_PROPERTY_MAP.keys.include?(key)
+ raise "Unknown dscl key #{key}" unless DSCL_PROPERTY_MAP.key?(key)
user_hash[DSCL_PROPERTY_MAP[key]] = [ value ]
user_hash
@@ -572,7 +572,7 @@ in 'password', with the associated 'salt' and 'iterations'.")
# Gets a value from user information hash using Chef attributes as keys.
#
def dscl_get(user_hash, key)
- raise "Unknown dscl key #{key}" unless DSCL_PROPERTY_MAP.keys.include?(key)
+ raise "Unknown dscl key #{key}" unless DSCL_PROPERTY_MAP.key?(key)
# DSCL values are set as arrays
value = user_hash[DSCL_PROPERTY_MAP[key]]