diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-05-21 09:21:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-21 09:21:51 -0700 |
commit | ffbfdc336fbb18e08eed958fcb300e69164b01e2 (patch) | |
tree | 16be148618e6f70668ed9c8b65f8e1279868b0da /lib/chef/provider/user/dscl.rb | |
parent | d2cd93486f8183a96d83024d8c2e9d8b0b5088b6 (diff) | |
parent | b3a1cc9165904e6be09b8a62065e9289a905bfb4 (diff) | |
download | chef-ffbfdc336fbb18e08eed958fcb300e69164b01e2.tar.gz |
Merge pull request #7249 from chef/lcg/cleanup-user
Cleanup AIX and Solaris user resources.
Diffstat (limited to 'lib/chef/provider/user/dscl.rb')
-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 79a2c73339..67fe8f3762 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"); @@ -654,9 +654,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: / @@ -664,9 +662,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: "?") |