summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Magnus Rakvåg <tor.magnus@outlook.com>2018-12-14 13:01:41 +0100
committerTor Magnus Rakvåg <tor.magnus@outlook.com>2018-12-14 13:01:41 +0100
commit2625f44c2008448159bf7fbb70bdca5887c0d2a6 (patch)
treeecaf13e4cea214dfd03dd27cbc70fe032bbbae0f
parentca4c2a44d2ca0e20307da4eb37d2fe0e2ecc763b (diff)
downloadchef-2625f44c2008448159bf7fbb70bdca5887c0d2a6.tar.gz
suppress error messages when sensitive is set
Signed-off-by: Tor Magnus Rakvåg <tor.magnus@outlook.com>
-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..b6a66bae47 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}: *sensitive output suppressed*"
+ 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