diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-02-28 16:49:40 -0800 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-04-05 12:24:06 -0700 |
commit | cb60b16d66363d27fa4b5dd23a3b79379b08d330 (patch) | |
tree | ac519cea72b59934867a66171ecb84feb8f747b1 /lib/chef/resource/windows_dfs_server.rb | |
parent | 2f546b50bd67314251b0f62554fc71cbf6a7a29a (diff) | |
download | chef-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_dfs_server.rb')
-rw-r--r-- | lib/chef/resource/windows_dfs_server.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/chef/resource/windows_dfs_server.rb b/lib/chef/resource/windows_dfs_server.rb index ae613d931b..8d5eedf441 100644 --- a/lib/chef/resource/windows_dfs_server.rb +++ b/lib/chef/resource/windows_dfs_server.rb @@ -2,7 +2,7 @@ # Author:: Jason Field # # Copyright:: 2018, Calastone Ltd. -# Copyright:: 2019-2020, Chef Software Inc. +# Copyright:: 2019-2020, 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. @@ -47,14 +47,13 @@ class Chef default: 3600 load_current_value do - ps_results = powershell_out("Get-DfsnServerConfiguration -ComputerName '#{ENV["COMPUTERNAME"]}' | Select LdapTimeoutSec, PreferLogonDC, EnableSiteCostedReferrals, SyncIntervalSec, UseFqdn | ConvertTo-Json") + ps_results = powershell_exec("Get-DfsnServerConfiguration -ComputerName '#{ENV["COMPUTERNAME"]}' | Select LdapTimeoutSec, PreferLogonDC, EnableSiteCostedReferrals, SyncIntervalSec, UseFqdn").result if ps_results.error? raise "The dfs_server resource failed to fetch the current state via the Get-DfsnServerConfiguration PowerShell cmlet. Is the DFS Windows feature installed?" end Chef::Log.debug("The Get-DfsnServerConfiguration results were #{ps_results.stdout}") - results = Chef::JSONCompat.from_json(ps_results.stdout) use_fqdn results["UseFqdn"] || false ldap_timeout_secs results["LdapTimeoutSec"] @@ -67,7 +66,7 @@ class Chef description "Configure DFS settings." converge_if_changed do - powershell_out("Set-DfsnServerConfiguration -ComputerName '#{ENV["COMPUTERNAME"]}' EnableSiteCostedReferrals $#{new_resource.enable_site_costed_referrals} -UseFqdn $#{new_resource.use_fqdn} -LdapTimeoutSec #{new_resource.ldap_timeout_secs} -PreferLogonDC $#{new_resource.prefer_login_dc} -SyncIntervalSec #{new_resource.sync_interval_secs}") + powershell_exec("Set-DfsnServerConfiguration -ComputerName '#{ENV["COMPUTERNAME"]}' EnableSiteCostedReferrals $#{new_resource.enable_site_costed_referrals} -UseFqdn $#{new_resource.use_fqdn} -LdapTimeoutSec #{new_resource.ldap_timeout_secs} -PreferLogonDC $#{new_resource.prefer_login_dc} -SyncIntervalSec #{new_resource.sync_interval_secs}") end end end |