summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Preston <stuart@chef.io>2018-09-14 14:06:57 +0100
committerGitHub <noreply@github.com>2018-09-14 14:06:57 +0100
commit49f4dc1f9fc3c962e3bc5f6e9777f8483233d605 (patch)
tree9032d5199d9f4ccaa204ab1685b0cd32a2cbac39
parentdaa99568cf655871f93567c31553fc86dde24bf7 (diff)
parent68959ae508dc6d2d616b34693c07d38d83f6dddd (diff)
downloadchef-49f4dc1f9fc3c962e3bc5f6e9777f8483233d605.tar.gz
Merge pull request #7637 from derekgroh/feature/windows_ad_join_newname
windows_ad_join resource - add newname property
-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..8d864840d3 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 :new_name, 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.new_name}\"" if new_resource.new_name
cmd << " -Force"
converge_by("join Active Directory domain #{new_resource.domain_name}") do