diff options
author | Tim Smith <tsmith@chef.io> | 2021-06-06 18:16:20 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2021-06-06 18:16:20 -0700 |
commit | 0f1838d74236dcd32dbc983bc95a03f023d540a7 (patch) | |
tree | 299db4b4b09e94993290ae41287393cd615d7b55 | |
parent | c66c37b7dd2dc0413d8d98885d4ad7b6ef604016 (diff) | |
download | chef-0f1838d74236dcd32dbc983bc95a03f023d540a7.tar.gz |
Avoid double logging the printer deletion
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/resource/windows_printer.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/chef/resource/windows_printer.rb b/lib/chef/resource/windows_printer.rb index c8d869b6b4..daabc6887d 100644 --- a/lib/chef/resource/windows_printer.rb +++ b/lib/chef/resource/windows_printer.rb @@ -1,6 +1,7 @@ # # Author:: Doug Ireton (<doug@1strategy.com>) # Copyright:: 2012-2018, Nordstrom, Inc. +# Copyright:: Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -149,12 +150,10 @@ class Chef end def delete_printer - declare_resource(:powershell_script, "Deleting printer: #{new_resource.device_id}") do - code <<-EOH + powershell_exec! <<-EOH $printer = Get-WMIObject -class Win32_Printer -EnableAllPrivileges -Filter "name = '#{new_resource.device_id}'" $printer.Delete() - EOH - end + EOH end end end |