summaryrefslogtreecommitdiff
path: root/lib/chef/resource/powershell_package_source.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-02-28 16:49:40 -0800
committerTim Smith <tsmith84@gmail.com>2020-04-05 12:24:06 -0700
commitcb60b16d66363d27fa4b5dd23a3b79379b08d330 (patch)
treeac519cea72b59934867a66171ecb84feb8f747b1 /lib/chef/resource/powershell_package_source.rb
parent2f546b50bd67314251b0f62554fc71cbf6a7a29a (diff)
downloadchef-powershell_exec.tar.gz
Convert resources to powershell_execpowershell_exec
powershell_exec is significantly faster than powershell_script. We can use this now that we only support Windows 2012+ Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource/powershell_package_source.rb')
-rw-r--r--lib/chef/resource/powershell_package_source.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/chef/resource/powershell_package_source.rb b/lib/chef/resource/powershell_package_source.rb
index d253de0958..d0915906b9 100644
--- a/lib/chef/resource/powershell_package_source.rb
+++ b/lib/chef/resource/powershell_package_source.rb
@@ -78,28 +78,28 @@ class Chef
if package_source_exists?
converge_if_changed :url, :trusted, :publish_location, :script_source_location, :script_publish_location do
update_cmd = build_ps_repository_command("Set", new_resource)
- res = powershell_out(update_cmd)
- raise "Failed to update #{new_resource.source_name}: #{res.stderr}" unless res.stderr.empty?
+ res = powershell_exec(update_cmd)
+ raise "Failed to update #{new_resource.source_name}: #{res.errors.first}" if res.error?
end
else
converge_by("register source: #{new_resource.source_name}") do
register_cmd = build_ps_repository_command("Register", new_resource)
- res = powershell_out(register_cmd)
- raise "Failed to register #{new_resource.source_name}: #{res.stderr}" unless res.stderr.empty?
+ res = powershell_exec(register_cmd)
+ raise "Failed to register #{new_resource.source_name}: #{res.errors.first}" if res.error?
end
end
else
if package_source_exists?
converge_if_changed :url, :trusted, :provider_name do
update_cmd = build_package_source_command("Set", new_resource)
- res = powershell_out(update_cmd)
- raise "Failed to update #{new_resource.source_name}: #{res.stderr}" unless res.stderr.empty?
+ res = powershell_exec(update_cmd)
+ raise "Failed to update #{new_resource.source_name}: #{res.errors.first}" if res.error?
end
else
converge_by("register source: #{new_resource.source_name}") do
register_cmd = build_package_source_command("Register", new_resource)
- res = powershell_out(register_cmd)
- raise "Failed to register #{new_resource.source_name}: #{res.stderr}" unless res.stderr.empty?
+ res = powershell_exec(register_cmd)
+ raise "Failed to register #{new_resource.source_name}: #{res.errors.first}" if res.error?
end
end
end