diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-05-10 14:06:39 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-05-10 14:06:39 -0700 |
commit | b584400b5f7b7e315e9602937c4803d453bad3ab (patch) | |
tree | ff3f150c399ff254d21536b5d2bf702111567683 | |
parent | 8f5a6701c590abf01525e3ca64ed90f3adce497c (diff) | |
download | chef-b584400b5f7b7e315e9602937c4803d453bad3ab.tar.gz |
bonus fix to remove unnecessary duping in dscl user
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/provider/user/dscl.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb index 50d255db8b..380bffdbd0 100644 --- a/lib/chef/provider/user/dscl.rb +++ b/lib/chef/provider/user/dscl.rb @@ -1,6 +1,6 @@ # # Author:: Dreamcat4 (<dreamcat4@gmail.com>) -# Copyright:: Copyright 2009-2017, Chef Software Inc. +# Copyright:: Copyright 2009-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -657,9 +657,7 @@ user password using shadow hash.") end def run_dscl(*args) - argdup = args.dup - cmd = argdup.shift - result = shell_out_compact("dscl", ".", "-#{cmd}", argdup) + result = shell_out_compact("dscl", ".", "-#{args[0]}", args[1..-1]) return "" if ( args.first =~ /^delete/ ) && ( result.exitstatus != 0 ) raise(Chef::Exceptions::DsclCommandFailed, "dscl error: #{result.inspect}") unless result.exitstatus == 0 raise(Chef::Exceptions::DsclCommandFailed, "dscl error: #{result.inspect}") if result.stdout =~ /No such key: / @@ -667,9 +665,7 @@ user password using shadow hash.") end def run_plutil(*args) - argdup = args.dup - cmd = argdup.shift - result = shell_out_compact("plutil", "-#{cmd}", argdup) + result = shell_out_compact("plutil", "-#{args[0]}", args[1..-1]) raise(Chef::Exceptions::PlistUtilCommandFailed, "plutil error: #{result.inspect}") unless result.exitstatus == 0 if result.stdout.encoding == Encoding::ASCII_8BIT result.stdout.encode("utf-8", "binary", undef: :replace, invalid: :replace, replace: "?") |