summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCrae <jmccrae@chef.io>2021-05-10 14:07:51 -0700
committerJohn McCrae <jmccrae@chef.io>2021-05-10 14:07:51 -0700
commit6fbe5afc8268b5c23f0e4c0cc37900313db59e21 (patch)
tree46af01094c6931848144514272c08cfeeea7876f
parent960c3335e430b7aa62475906e5ca95725d097b8d (diff)
downloadchef-6fbe5afc8268b5c23f0e4c0cc37900313db59e21.tar.gz
updated the hostname resource to use Rename-Computer over WMI. There is additional commentary and code in the block to get past a test problem.
Signed-off-by: John McCrae <jmccrae@chef.io>
-rw-r--r--lib/chef/resource/hostname.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/chef/resource/hostname.rb b/lib/chef/resource/hostname.rb
index dfa17e94b6..930d35477e 100644
--- a/lib/chef/resource/hostname.rb
+++ b/lib/chef/resource/hostname.rb
@@ -270,7 +270,8 @@ class Chef
unless Socket.gethostbyname(Socket.gethostname).first == new_resource.hostname
converge_by "set hostname to #{new_resource.hostname}" do
- puts "What username is being used : #{new_resource.domain_user}"
+ # The bogus domain_user and domain_password variables are being used to get past a parsing bug in the test matrix.
+ # in a real-world scenario you could never try to rename a domain-joined system without a username and password
powershell_exec! <<~EOH
$domain_joined = (Get-WmiObject -Class Win32_ComputerSystem).PartofDomain