diff options
author | Tim Smith <tsmith@chef.io> | 2018-12-14 09:00:53 -0800 |
---|---|---|
committer | Stuart Preston <stuart@chef.io> | 2018-12-18 14:28:50 +0000 |
commit | b82670cf59caddc005c2ab70221dcce34d03759c (patch) | |
tree | bd1bd476ff92be1b9bb4b7cf06a5336cc6f3858e /lib | |
parent | 2b760d66bece0c91d2005291d25b373cbf68e08a (diff) | |
download | chef-b82670cf59caddc005c2ab70221dcce34d03759c.tar.gz |
Merge pull request #8054 from Intility/sensitive_ad_join
windows_ad_join: suppress sensitive stderr
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/resource/windows_ad_join.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/chef/resource/windows_ad_join.rb b/lib/chef/resource/windows_ad_join.rb index b3acacc703..50e71ef362 100644 --- a/lib/chef/resource/windows_ad_join.rb +++ b/lib/chef/resource/windows_ad_join.rb @@ -73,7 +73,13 @@ class Chef converge_by("join Active Directory domain #{new_resource.domain_name}") do ps_run = powershell_out(cmd) - raise "Failed to join the domain #{new_resource.domain_name}: #{ps_run.stderr}}" if ps_run.error? + if ps_run.error? + if sensitive? + raise "Failed to join the domain #{new_resource.domain_name}: *suppressed sensitive resource output*" + else + raise "Failed to join the domain #{new_resource.domain_name}: #{ps_run.stderr}" + end + end unless new_resource.reboot == :never reboot "Reboot to join domain #{new_resource.domain_name}" do @@ -104,6 +110,10 @@ class Chef reboot_action end end + + def sensitive? + !!new_resource.sensitive + end end end end |