summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-11-27 19:23:17 -0800
committerGitHub <noreply@github.com>2018-11-27 19:23:17 -0800
commitbb51ad2fc3dc94f8cad4a7de4a2dd58fa0d0bbf4 (patch)
tree62f74aa47c72be44128980960593b4940bc87fbd
parentfd8477a4c41171fe82e990b13e1993f83f4bdd47 (diff)
parent60e50b566afcb17f5d265607cba747594ec2f648 (diff)
downloadchef-bb51ad2fc3dc94f8cad4a7de4a2dd58fa0d0bbf4.tar.gz
Merge pull request #7991 from chef/share
windows_share: Avoid ConvertTo-Json errors on Windows 2012r2 with powershell 4
-rw-r--r--lib/chef/resource/windows_share.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/resource/windows_share.rb b/lib/chef/resource/windows_share.rb
index 0b245e8590..1fda67e820 100644
--- a/lib/chef/resource/windows_share.rb
+++ b/lib/chef/resource/windows_share.rb
@@ -102,7 +102,7 @@ class Chef
# this command selects individual objects because EncryptData & CachingMode have underlying
# types that get converted to their Integer values by ConvertTo-Json & we need to make sure
# those get written out as strings
- share_state_cmd = "Get-SmbShare -Name '#{desired.share_name}' | Select-Object Name,Path, Description, Temporary, CATimeout, ContinuouslyAvailable, ConcurrentUserLimit, EncryptData | ConvertTo-Json"
+ 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)
@@ -126,7 +126,7 @@ class Chef
encrypt_data results["EncryptData"]
# folder_enumeration_mode results['FolderEnumerationMode']
- perm_state_cmd = %{Get-SmbShareAccess -Name "#{desired.share_name}" | Select-Object AccountName,AccessControlType,AccessRight | ConvertTo-Json}
+ 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)