diff options
author | Tim Smith <tsmith@chef.io> | 2018-03-22 14:46:41 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-03-22 14:56:39 -0700 |
commit | 7b7a918a0b60e6c1bc7e5da6947db453f7b6dc4a (patch) | |
tree | f22e6314641aa3273f77c43c4a3e4742e7e0fdac | |
parent | 63fc9a59b870b1890ed658056d04619467c66710 (diff) | |
download | chef-7b7a918a0b60e6c1bc7e5da6947db453f7b6dc4a.tar.gz |
Require the domain_name to be a FQDN
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/resource/windows_adjoin.rb | 6 | ||||
-rw-r--r-- | spec/unit/resource/windows_adjoin.rb | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/chef/resource/windows_adjoin.rb b/lib/chef/resource/windows_adjoin.rb index 25e2537c03..edc2effe26 100644 --- a/lib/chef/resource/windows_adjoin.rb +++ b/lib/chef/resource/windows_adjoin.rb @@ -30,7 +30,9 @@ class Chef introduced "14.0" property :domain_name, String, - description: "The domain name to join.", + description: "The FQDN of the AD domain to join.", + validation_message: "The 'domain_name' property must be a FQDN.", + regex: /.\../, # anything.anything name_property: true property :domain_user, String, @@ -46,7 +48,7 @@ class Chef property :reboot, Symbol, equal_to: [:immediate, :delayed, :never], - validation_message: "The reboot property accepts :immediate (reboot as soon as the resource completes), :delayed (reboot once the Chef run completes), and :never (Don't reboot)" + validation_message: "The reboot property accepts :immediate (reboot as soon as the resource completes), :delayed (reboot once the Chef run completes), and :never (Don't reboot)", 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 diff --git a/spec/unit/resource/windows_adjoin.rb b/spec/unit/resource/windows_adjoin.rb index bbaec7eaa6..02975d5d4e 100644 --- a/spec/unit/resource/windows_adjoin.rb +++ b/spec/unit/resource/windows_adjoin.rb @@ -28,6 +28,10 @@ describe Chef::Resource::WindowsAdJoin do expect(resource.domain_name).to eql("example.com") end + it "only accepts FQDNs for the domain_name property" do + expect { resource.domain_name "example" }.to raise_error(ArgumentError) + end + it "sets the default action as :join" do expect(resource.action).to eql([:join]) end |