summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorDerek Groh <derekgroh@gmail.com>2018-09-12 14:18:28 -0500
committerDerek Groh <derekgroh@gmail.com>2018-09-12 14:18:34 -0500
commit8ae6fde12697e1e578dbeb9855b256ca39269124 (patch)
treed89655c829f8c76f43fd85412fbcb24ad38afdcd /lib/chef
parent1f2bd56d781868cd259b71ce56e6b9bc992f0bea (diff)
downloadchef-8ae6fde12697e1e578dbeb9855b256ca39269124.tar.gz
add newname property
Signed-off-by: Derek Groh <derekgroh@github.io>
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/resource/windows_ad_join.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/chef/resource/windows_ad_join.rb b/lib/chef/resource/windows_ad_join.rb
index d2848c71cd..29abadb77b 100644
--- a/lib/chef/resource/windows_ad_join.rb
+++ b/lib/chef/resource/windows_ad_join.rb
@@ -52,6 +52,9 @@ class Chef
description: "Controls the system reboot behavior post domain joining. Reboot immediately, after the Chef run completes, or never. Note that a reboot is necessary for changes to take effect.",
default: :immediate
+ property :newname, String,
+ description: "Specifies a new name for the computer in the new domain."
+
# define this again so we can default it to true. Otherwise failures print the password
property :sensitive, [TrueClass, FalseClass],
default: true
@@ -64,6 +67,7 @@ class Chef
cmd << "$credential = New-Object System.Management.Automation.PSCredential (\"#{new_resource.domain_user}\",$pswd);"
cmd << "Add-Computer -DomainName #{new_resource.domain_name} -Credential $credential"
cmd << " -OUPath \"#{new_resource.ou_path}\"" if new_resource.ou_path
+ cmd << " -NewName \"#{new_resource.newname}\"" if new_resource.newname
cmd << " -Force"
converge_by("join Active Directory domain #{new_resource.domain_name}") do