summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Preston <stuart@chef.io>2018-11-22 12:30:35 +0000
committerGitHub <noreply@github.com>2018-11-22 12:30:35 +0000
commitca49513fdbdd2b8d964028cf3808838644cd6b10 (patch)
tree6a7c9b0e5153a4ad23ac19a9166b51f04b135bf4
parent5c436ac98fd9a5dd78e243616123650217c90419 (diff)
parent3e66d2629be497172a0a3cb97775f6bcac7c0798 (diff)
downloadchef-ca49513fdbdd2b8d964028cf3808838644cd6b10.tar.gz
Merge pull request #7961 from derekgroh/master
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 48fcc9b946..9459146b4c 100644
--- a/lib/chef/resource/windows_share.rb
+++ b/lib/chef/resource/windows_share.rb
@@ -101,7 +101,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)
@@ -125,7 +125,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)