summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-06-05 10:41:50 -0700
committerTim Smith <tsmith84@gmail.com>2020-06-05 10:41:50 -0700
commita9f64349802c724e2c4e639a6bc4730dd31a09c7 (patch)
treeec660798d4cc2744740c2c2d0682b56b5785cee3
parenta83a20d9f8cde101101a237580cb96d67782d17b (diff)
downloadchef-resource_docs.tar.gz
Add more resource docs + improve yaml generationresource_docs
Skip defaults that are empty strings. There's a few of these floating around. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/windows_ad_join.rb29
-rw-r--r--lib/chef/resource/windows_auto_run.rb11
-rw-r--r--lib/chef/resource/windows_certificate.rb26
-rwxr-xr-xtasks/docs.rb2
4 files changed, 67 insertions, 1 deletions
diff --git a/lib/chef/resource/windows_ad_join.rb b/lib/chef/resource/windows_ad_join.rb
index b0b6824f88..b1584d93d8 100644
--- a/lib/chef/resource/windows_ad_join.rb
+++ b/lib/chef/resource/windows_ad_join.rb
@@ -25,6 +25,35 @@ class Chef
description "Use the **windows_ad_join** resource to join a Windows Active Directory domain."
introduced "14.0"
+ examples <<~DOC
+ **Join a domain**
+
+ ```ruby
+ windows_ad_join 'ad.example.org' do
+ domain_user 'nick'
+ domain_password 'p@ssw0rd1'
+ end
+ ```
+
+ **Join a domain, as `win-workstation`**
+
+ ```ruby
+ windows_ad_join 'ad.example.org' do
+ domain_user 'nick'
+ domain_password 'p@ssw0rd1'
+ new_hostname 'win-workstation'
+ end
+ ```
+
+ **Leave the current domain and re-join the `local` workgroup**
+
+ ```ruby
+ windows_ad_join 'Leave domain' do
+ action :leave
+ workgroup 'local'
+ end
+ ```
+ DOC
property :domain_name, String,
description: "An optional property to set the FQDN of the Active Directory domain to join if it differs from the resource block's name.",
diff --git a/lib/chef/resource/windows_auto_run.rb b/lib/chef/resource/windows_auto_run.rb
index 1b3de8a68c..11f383b9d3 100644
--- a/lib/chef/resource/windows_auto_run.rb
+++ b/lib/chef/resource/windows_auto_run.rb
@@ -25,6 +25,17 @@ class Chef
description "Use the **windows_auto_run** resource to set applications to run at login."
introduced "14.0"
+ examples <<~DOC
+ **Run BGInfo at login**:
+
+ ```ruby
+ windows_auto_run 'BGINFO' do
+ program 'C:/Sysinternals/bginfo.exe'
+ args '\'C:/Sysinternals/Config.bgi\' /NOLICPROMPT /TIMER:0'
+ action :create
+ end
+ ```
+ DOC
property :program_name, String,
description: "The name of the program to run at login if it differs from the resource block's name.",
diff --git a/lib/chef/resource/windows_certificate.rb b/lib/chef/resource/windows_certificate.rb
index c6e32d9fa5..967ef2f811 100644
--- a/lib/chef/resource/windows_certificate.rb
+++ b/lib/chef/resource/windows_certificate.rb
@@ -30,6 +30,32 @@ class Chef
description "Use the **windows_certificate** resource to install a certificate into the Windows certificate store from a file. The resource grants read-only access to the private key for designated accounts. Due to current limitations in WinRM, installing certificates remotely may not work if the operation requires a user profile. Operations on the local machine store should still work."
introduced "14.7"
+ examples <<~DOC
+ **Add PFX cert to local machine personal store and grant accounts read-only access to private key**
+
+ ```ruby
+ windows_certificate 'c:/test/mycert.pfx' do
+ pfx_password 'password'
+ private_key_acl ["acme\fred", "pc\jane"]
+ end
+ ```
+
+ **Add cert to trusted intermediate store**
+
+ ```ruby
+ windows_certificate 'c:/test/mycert.cer' do
+ store_name 'CA'
+ end
+ ```
+
+ **Remove all certificates matching the subject**
+
+ ```ruby
+ windows_certificate 'me.acme.com' do
+ action :delete
+ end
+ ```
+ DOC
property :source, String,
description: "The source file (for create and acl_add), thumbprint (for delete and acl_add) or subject (for delete) if it differs from the resource block's name.",
diff --git a/tasks/docs.rb b/tasks/docs.rb
index c53b4aa58e..954bfa6059 100755
--- a/tasks/docs.rb
+++ b/tasks/docs.rb
@@ -141,7 +141,7 @@ namespace :docs_site do
def friendly_default_value(property)
return "The resource block's name" if property["name_property"]
- return nil if property["default"].nil?
+ return nil if property["default"].nil? || property["default"] == ""
# this way we properly print out a string of a hash or an array instead of just the values
property["default"].to_s