summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-12-14 09:00:53 -0800
committerGitHub <noreply@github.com>2018-12-14 09:00:53 -0800
commit0f72fa4740c6760d8b191fcb98cf1abfb41b2123 (patch)
treef2208cec033c8ce02b20fe383e28906848a0184d
parentca4c2a44d2ca0e20307da4eb37d2fe0e2ecc763b (diff)
parent466a89fb8a364d39edbc4aca5d40bbb96679685e (diff)
downloadchef-0f72fa4740c6760d8b191fcb98cf1abfb41b2123.tar.gz
Merge pull request #8054 from Intility/sensitive_ad_join
windows_ad_join: suppress sensitive stderr
-rw-r--r--lib/chef/resource/windows_ad_join.rb12
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