summaryrefslogtreecommitdiff
path: root/lib/chef/resource/windows_share.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/windows_share.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/windows_share.rb')
-rw-r--r--lib/chef/resource/windows_share.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/resource/windows_share.rb b/lib/chef/resource/windows_share.rb
index 2c4d79522a..676aab3f29 100644
--- a/lib/chef/resource/windows_share.rb
+++ b/lib/chef/resource/windows_share.rb
@@ -106,16 +106,16 @@ class Chef
share_state_cmd = "Get-SmbShare -Name '#{desired.share_name}' | Select-Object Name,Path, Description, Temporary, CATimeout, ContinuouslyAvailable, ConcurrentUserLimit, EncryptData | ConvertTo-Json -Compress"
Chef::Log.debug("Running '#{share_state_cmd}' to determine share state'")
- ps_results = powershell_out(share_state_cmd)
+ ps_results = powershell_exec(share_state_cmd)
# detect a failure without raising and then set current_resource to nil
if ps_results.error?
- Chef::Log.debug("Error fetching share state: #{ps_results.stderr}")
+ Chef::Log.debug("Error fetching share state: #{ps_results.errors.first}")
current_value_does_not_exist!
end
- Chef::Log.debug("The Get-SmbShare results were #{ps_results.stdout}")
- results = Chef::JSONCompat.from_json(ps_results.stdout)
+ Chef::Log.debug("The Get-SmbShare results were #{ps_results.result}")
+ results = ps_results.result
path results["Path"]
description results["Description"]
@@ -130,7 +130,7 @@ class Chef
perm_state_cmd = %{Get-SmbShareAccess -Name "#{desired.share_name}" | Select-Object AccountName,AccessControlType,AccessRight | ConvertTo-Json -Compress}
Chef::Log.debug("Running '#{perm_state_cmd}' to determine share permissions state'")
- ps_perm_results = powershell_out(perm_state_cmd)
+ ps_perm_results = powershell_exec(perm_state_cmd)
# we raise here instead of warning like above because we'd only get here if the above Get-SmbShare
# command was successful and that continuing would leave us with 1/2 known state