summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2021-09-28 16:17:00 -0700
committerTim Smith <tsmith@chef.io>2021-09-28 16:17:00 -0700
commit787c2ae702ae78b926bbd5d4bb7fa84ba1943d49 (patch)
tree5fecc35dd94eb54228ec4d210b8bbb3a215761c8
parent218175c219a9661509c6376f67639deba182308b (diff)
downloadchef-heredoc_indent.tar.gz
Improve heredoc readbility with indentsheredoc_indent
This makes the examples much easier to read. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/_chef_client_trusted_certificate.rb42
-rw-r--r--kitchen-tests/test/integration/end-to-end/habitat_user_toml/default_spec.rb8
-rw-r--r--kitchen-tests/test/integration/end-to-end/habitat_win_service/default_spec.rb14
-rw-r--r--kitchen-tests/test/integration/end-to-end/habitat_win_sup/default_spec.rb4
-rw-r--r--kitchen-tests/test/integration/end-to-end/habitat_win_sup_toml_config/default_spec.rb4
-rw-r--r--lib/chef/resource/alternatives.rb80
-rw-r--r--lib/chef/resource/apt_package.rb40
-rw-r--r--lib/chef/resource/apt_preference.rb44
-rw-r--r--lib/chef/resource/bash.rb232
-rw-r--r--lib/chef/resource/bff_package.rb30
-rw-r--r--lib/chef/resource/breakpoint.rb88
-rw-r--r--lib/chef/resource/cab_package.rb44
-rw-r--r--lib/chef/resource/chef_client_config.rb122
-rw-r--r--lib/chef/resource/chef_client_cron.rb34
-rw-r--r--lib/chef/resource/chef_client_scheduled_task.rb60
-rw-r--r--lib/chef/resource/chef_client_systemd_timer.rb32
-rw-r--r--lib/chef/resource/chef_client_trusted_certificate.rb56
-rw-r--r--lib/chef/resource/chef_handler.rb214
-rw-r--r--lib/chef/resource/chocolatey_config.rb26
-rw-r--r--lib/chef/resource/habitat/habitat_package.rb142
-rw-r--r--lib/chef/resource/habitat/habitat_sup.rb116
-rw-r--r--lib/chef/resource/habitat_config.rb24
-rw-r--r--lib/chef/resource/habitat_install.rb34
-rw-r--r--lib/chef/resource/habitat_user_toml.rb22
-rw-r--r--lib/chef/resource/homebrew_package.rb40
-rw-r--r--lib/chef/resource/ifconfig.rb68
-rw-r--r--lib/chef/resource/inspec_input.rb79
-rw-r--r--lib/chef/resource/inspec_waiver.rb130
-rw-r--r--lib/chef/resource/inspec_waiver_file_entry.rb50
-rw-r--r--lib/chef/resource/locale.rb12
-rw-r--r--lib/chef/resource/mdadm.rb66
-rw-r--r--lib/chef/resource/ohai.rb64
-rw-r--r--lib/chef/resource/ohai_hint.rb48
-rw-r--r--lib/chef/resource/openssl_x509_crl.rb30
-rw-r--r--lib/chef/resource/osx_profile.rb108
-rw-r--r--lib/chef/resource/registry_key.rb154
-rw-r--r--lib/chef/resource/remote_file.rb142
-rw-r--r--lib/chef/resource/scm/git.rb158
-rw-r--r--lib/chef/resource/scm/subversion.rb18
-rw-r--r--lib/chef/resource/ssh_known_hosts_entry.rb20
-rw-r--r--lib/chef/resource/sudo.rb40
-rw-r--r--lib/chef/resource/swap_file.rb24
-rw-r--r--lib/chef/resource/sysctl.rb84
-rw-r--r--lib/chef/resource/systemd_unit.rb68
-rw-r--r--lib/chef/resource/timezone.rb32
-rw-r--r--lib/chef/resource/user_ulimit.rb40
-rw-r--r--lib/chef/resource/windows_ad_join.rb44
-rw-r--r--lib/chef/resource/windows_audit_policy.rb52
-rw-r--r--lib/chef/resource/windows_auto_run.rb16
-rw-r--r--lib/chef/resource/windows_certificate.rb38
-rw-r--r--lib/chef/resource/windows_defender.rb44
-rw-r--r--lib/chef/resource/windows_defender_exclusion.rb34
-rw-r--r--lib/chef/resource/windows_env.rb12
-rw-r--r--lib/chef/resource/windows_feature.rb84
-rw-r--r--lib/chef/resource/windows_feature_dism.rb16
-rw-r--r--lib/chef/resource/windows_feature_powershell.rb40
-rw-r--r--lib/chef/resource/windows_firewall_profile.rb56
-rw-r--r--lib/chef/resource/windows_firewall_rule.rb94
-rw-r--r--lib/chef/resource/windows_font.rb12
-rw-r--r--lib/chef/resource/windows_package.rb116
-rw-r--r--lib/chef/resource/windows_pagefile.rb58
-rw-r--r--lib/chef/resource/windows_path.rb24
-rw-r--r--lib/chef/resource/windows_printer.rb56
-rw-r--r--lib/chef/resource/windows_printer_port.rb42
-rw-r--r--lib/chef/resource/windows_security_policy.rb42
-rw-r--r--lib/chef/resource/windows_service.rb210
-rw-r--r--lib/chef/resource/windows_share.rb32
-rw-r--r--lib/chef/resource/windows_shortcut.rb14
-rw-r--r--lib/chef/resource/windows_task.rb190
-rw-r--r--lib/chef/resource/windows_uac.rb28
-rw-r--r--lib/chef/resource/windows_update_settings.rb28
-rw-r--r--lib/chef/resource/windows_user_privilege.rb78
-rw-r--r--lib/chef/resource/windows_workgroup.rb22
-rw-r--r--lib/chef/resource/yum_repository.rb36
74 files changed, 2252 insertions, 2253 deletions
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/_chef_client_trusted_certificate.rb b/kitchen-tests/cookbooks/end_to_end/recipes/_chef_client_trusted_certificate.rb
index 486d5f36c6..7b097c021f 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/_chef_client_trusted_certificate.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/_chef_client_trusted_certificate.rb
@@ -1,26 +1,26 @@
chef_client_trusted_certificate "self-signed.badssl.com" do
certificate <<~CERT
- -----BEGIN CERTIFICATE-----
- MIIDeTCCAmGgAwIBAgIJAPziuikCTox4MA0GCSqGSIb3DQEBCwUAMGIxCzAJBgNV
- BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNp
- c2NvMQ8wDQYDVQQKDAZCYWRTU0wxFTATBgNVBAMMDCouYmFkc3NsLmNvbTAeFw0x
- OTEwMDkyMzQxNTJaFw0yMTEwMDgyMzQxNTJaMGIxCzAJBgNVBAYTAlVTMRMwEQYD
- VQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQ8wDQYDVQQK
- DAZCYWRTU0wxFTATBgNVBAMMDCouYmFkc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEB
- BQADggEPADCCAQoCggEBAMIE7PiM7gTCs9hQ1XBYzJMY61yoaEmwIrX5lZ6xKyx2
- PmzAS2BMTOqytMAPgLaw+XLJhgL5XEFdEyt/ccRLvOmULlA3pmccYYz2QULFRtMW
- hyefdOsKnRFSJiFzbIRMeVXk0WvoBj1IFVKtsyjbqv9u/2CVSndrOfEk0TG23U3A
- xPxTuW1CrbV8/q71FdIzSOciccfCFHpsKOo3St/qbLVytH5aohbcabFXRNsKEqve
- ww9HdFxBIuGa+RuT5q0iBikusbpJHAwnnqP7i/dAcgCskgjZjFeEU4EFy+b+a1SY
- QCeFxxC7c3DvaRhBB0VVfPlkPz0sw6l865MaTIbRyoUCAwEAAaMyMDAwCQYDVR0T
- BAIwADAjBgNVHREEHDAaggwqLmJhZHNzbC5jb22CCmJhZHNzbC5jb20wDQYJKoZI
- hvcNAQELBQADggEBAGlwCdbPxflZfYOaukZGCaxYK6gpincX4Lla4Ui2WdeQxE95
- w7fChXvP3YkE3UYUE7mupZ0eg4ZILr/A0e7JQDsgIu/SRTUE0domCKgPZ8v99k3A
- vka4LpLK51jHJJK7EFgo3ca2nldd97GM0MU41xHFk8qaK1tWJkfrrfcGwDJ4GQPI
- iLlm6i0yHq1Qg1RypAXJy5dTlRXlCLd8ufWhhiwW0W75Va5AEnJuqpQrKwl3KQVe
- wGj67WWRgLfSr+4QG1mNvCZb2CkjZWmxkGPuoP40/y7Yu5OFqxP5tAjj4YixCYTW
- EVA0pmzIzgBg+JIe3PdRy27T0asgQW/F4TY61Yk=
- -----END CERTIFICATE-----
+ -----BEGIN CERTIFICATE-----
+ MIIDeTCCAmGgAwIBAgIJAPziuikCTox4MA0GCSqGSIb3DQEBCwUAMGIxCzAJBgNV
+ BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNp
+ c2NvMQ8wDQYDVQQKDAZCYWRTU0wxFTATBgNVBAMMDCouYmFkc3NsLmNvbTAeFw0x
+ OTEwMDkyMzQxNTJaFw0yMTEwMDgyMzQxNTJaMGIxCzAJBgNVBAYTAlVTMRMwEQYD
+ VQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQ8wDQYDVQQK
+ DAZCYWRTU0wxFTATBgNVBAMMDCouYmFkc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEB
+ BQADggEPADCCAQoCggEBAMIE7PiM7gTCs9hQ1XBYzJMY61yoaEmwIrX5lZ6xKyx2
+ PmzAS2BMTOqytMAPgLaw+XLJhgL5XEFdEyt/ccRLvOmULlA3pmccYYz2QULFRtMW
+ hyefdOsKnRFSJiFzbIRMeVXk0WvoBj1IFVKtsyjbqv9u/2CVSndrOfEk0TG23U3A
+ xPxTuW1CrbV8/q71FdIzSOciccfCFHpsKOo3St/qbLVytH5aohbcabFXRNsKEqve
+ ww9HdFxBIuGa+RuT5q0iBikusbpJHAwnnqP7i/dAcgCskgjZjFeEU4EFy+b+a1SY
+ QCeFxxC7c3DvaRhBB0VVfPlkPz0sw6l865MaTIbRyoUCAwEAAaMyMDAwCQYDVR0T
+ BAIwADAjBgNVHREEHDAaggwqLmJhZHNzbC5jb22CCmJhZHNzbC5jb20wDQYJKoZI
+ hvcNAQELBQADggEBAGlwCdbPxflZfYOaukZGCaxYK6gpincX4Lla4Ui2WdeQxE95
+ w7fChXvP3YkE3UYUE7mupZ0eg4ZILr/A0e7JQDsgIu/SRTUE0domCKgPZ8v99k3A
+ vka4LpLK51jHJJK7EFgo3ca2nldd97GM0MU41xHFk8qaK1tWJkfrrfcGwDJ4GQPI
+ iLlm6i0yHq1Qg1RypAXJy5dTlRXlCLd8ufWhhiwW0W75Va5AEnJuqpQrKwl3KQVe
+ wGj67WWRgLfSr+4QG1mNvCZb2CkjZWmxkGPuoP40/y7Yu5OFqxP5tAjj4YixCYTW
+ EVA0pmzIzgBg+JIe3PdRy27T0asgQW/F4TY61Yk=
+ -----END CERTIFICATE-----
CERT
end
diff --git a/kitchen-tests/test/integration/end-to-end/habitat_user_toml/default_spec.rb b/kitchen-tests/test/integration/end-to-end/habitat_user_toml/default_spec.rb
index 9df21c49e6..a720f37e10 100644
--- a/kitchen-tests/test/integration/end-to-end/habitat_user_toml/default_spec.rb
+++ b/kitchen-tests/test/integration/end-to-end/habitat_user_toml/default_spec.rb
@@ -14,10 +14,10 @@ describe command("hab -V") do
its("exit_status") { should eq 0 }
end
-nginx_content = <<-EOF
-worker_processes = 2
-[http]
-keepalive_timeout = 120
+nginx_content = <<~EOF
+ worker_processes = 2
+ [http]
+ keepalive_timeout = 120
EOF
describe file("/hab/user/nginx/config/user.toml") do
diff --git a/kitchen-tests/test/integration/end-to-end/habitat_win_service/default_spec.rb b/kitchen-tests/test/integration/end-to-end/habitat_win_service/default_spec.rb
index f66e5e79ac..f2638ad3a9 100644
--- a/kitchen-tests/test/integration/end-to-end/habitat_win_service/default_spec.rb
+++ b/kitchen-tests/test/integration/end-to-end/habitat_win_service/default_spec.rb
@@ -10,13 +10,13 @@ describe file('C:\hab\sup\default\specs\splunkforwarder.spec') do
it { should_not exist }
end
-servicecheck = <<-EOH
-$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
-$headers.Add("Content-Type", "application/json")
-$headers.Add("Authorization", "Bearer secret")
-$uri = "http://localhost:9631/services"
-$reply = (Invoke-RestMethod -Headers $headers -uri $uri) | Convertto-Json
-$reply
+servicecheck = <<~EOH
+ $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
+ $headers.Add("Content-Type", "application/json")
+ $headers.Add("Authorization", "Bearer secret")
+ $uri = "http://localhost:9631/services"
+ $reply = (Invoke-RestMethod -Headers $headers -uri $uri) | Convertto-Json
+ $reply
EOH
describe json(command: servicecheck) do
diff --git a/kitchen-tests/test/integration/end-to-end/habitat_win_sup/default_spec.rb b/kitchen-tests/test/integration/end-to-end/habitat_win_sup/default_spec.rb
index d1aa757cfc..64e7a04ab8 100644
--- a/kitchen-tests/test/integration/end-to-end/habitat_win_sup/default_spec.rb
+++ b/kitchen-tests/test/integration/end-to-end/habitat_win_sup/default_spec.rb
@@ -6,8 +6,8 @@ describe powershell("(get-service habitat).Status") do
its(:stdout) { should match(/Running/) }
end
-restart_script = <<-EOH
-restart-service habitat
+restart_script = <<~EOH
+ restart-service habitat
EOH
describe powershell(restart_script) do
diff --git a/kitchen-tests/test/integration/end-to-end/habitat_win_sup_toml_config/default_spec.rb b/kitchen-tests/test/integration/end-to-end/habitat_win_sup_toml_config/default_spec.rb
index 70a68ccf06..7e93ceaa9c 100644
--- a/kitchen-tests/test/integration/end-to-end/habitat_win_sup_toml_config/default_spec.rb
+++ b/kitchen-tests/test/integration/end-to-end/habitat_win_sup_toml_config/default_spec.rb
@@ -6,8 +6,8 @@ describe powershell("(get-service habitat).Status") do
its(:stdout) { should match(/Running/) }
end
-restart_script = <<-EOH
-restart-service habitat
+restart_script = <<~EOH
+ restart-service habitat
EOH
describe powershell(restart_script) do
diff --git a/lib/chef/resource/alternatives.rb b/lib/chef/resource/alternatives.rb
index 59939543ab..229bdc82db 100644
--- a/lib/chef/resource/alternatives.rb
+++ b/lib/chef/resource/alternatives.rb
@@ -29,54 +29,54 @@ class Chef
description "Use the **alternatives** resource to configure command alternatives in Linux using the alternatives or update-alternatives packages."
introduced "16.0"
examples <<~DOC
- **Install an alternative**:
-
- ```ruby
- alternatives 'python install 2' do
- link_name 'python'
- path '/usr/bin/python2.7'
- priority 100
- action :install
- end
- ```
+ **Install an alternative**:
+
+ ```ruby
+ alternatives 'python install 2' do
+ link_name 'python'
+ path '/usr/bin/python2.7'
+ priority 100
+ action :install
+ end
+ ```
- **Set an alternative**:
+ **Set an alternative**:
- ```ruby
- alternatives 'python set version 3' do
- link_name 'python'
- path '/usr/bin/python3'
- action :set
- end
- ```
+ ```ruby
+ alternatives 'python set version 3' do
+ link_name 'python'
+ path '/usr/bin/python3'
+ action :set
+ end
+ ```
- **Set the automatic alternative state**:
+ **Set the automatic alternative state**:
- ```ruby
- alternatives 'python auto' do
- link_name 'python'
- action :auto
- end
- ```
+ ```ruby
+ alternatives 'python auto' do
+ link_name 'python'
+ action :auto
+ end
+ ```
- **Refresh an alternative**:
+ **Refresh an alternative**:
- ```ruby
- alternatives 'python refresh' do
- link_name 'python'
- action :refresh
- end
- ```
+ ```ruby
+ alternatives 'python refresh' do
+ link_name 'python'
+ action :refresh
+ end
+ ```
- **Remove an alternative**:
+ **Remove an alternative**:
- ```ruby
- alternatives 'python remove' do
- link_name 'python'
- path '/usr/bin/python3'
- action :remove
- end
- ```
+ ```ruby
+ alternatives 'python remove' do
+ link_name 'python'
+ path '/usr/bin/python3'
+ action :remove
+ end
+ ```
DOC
property :link_name, String,
diff --git a/lib/chef/resource/apt_package.rb b/lib/chef/resource/apt_package.rb
index 331d411373..d79693ba57 100644
--- a/lib/chef/resource/apt_package.rb
+++ b/lib/chef/resource/apt_package.rb
@@ -26,33 +26,33 @@ class Chef
provides :apt_package, target_mode: true
provides :package, platform_family: "debian", target_mode: true
examples <<~DOC
- **Install a package using package manager**:
+ **Install a package using package manager**:
- ```ruby
- apt_package 'name of package' do
- action :install
- end
- ```
+ ```ruby
+ apt_package 'name of package' do
+ action :install
+ end
+ ```
- **Install a package without specifying the default action**:
+ **Install a package without specifying the default action**:
- ```ruby
- apt_package 'name of package'
- ```
+ ```ruby
+ apt_package 'name of package'
+ ```
- **Install multiple packages at once**:
+ **Install multiple packages at once**:
- ```ruby
- apt_package %(package1 package2 package3)
- ```
+ ```ruby
+ apt_package %(package1 package2 package3)
+ ```
- **Install without using recommend packages as a dependency**:
+ **Install without using recommend packages as a dependency**:
- ```ruby
- package 'apache2' do
- options '--no-install-recommends'
- end
- ```
+ ```ruby
+ package 'apache2' do
+ options '--no-install-recommends'
+ end
+ ```
DOC
description "Use the **apt_package** resource to manage packages on Debian and Ubuntu platforms."
diff --git a/lib/chef/resource/apt_preference.rb b/lib/chef/resource/apt_preference.rb
index 09e56b1edf..adafd5326b 100644
--- a/lib/chef/resource/apt_preference.rb
+++ b/lib/chef/resource/apt_preference.rb
@@ -28,34 +28,34 @@ class Chef
description "Use the **apt_preference** resource to create APT [preference files](https://wiki.debian.org/AptPreferences). Preference files are used to control which package versions and sources are prioritized during installation."
introduced "13.3"
examples <<~DOC
- **Pin libmysqlclient16 to a version 5.1.49-3**:
+ **Pin libmysqlclient16 to a version 5.1.49-3**:
- ```ruby
- apt_preference 'libmysqlclient16' do
- pin 'version 5.1.49-3'
- pin_priority '700'
- end
- ```
+ ```ruby
+ apt_preference 'libmysqlclient16' do
+ pin 'version 5.1.49-3'
+ pin_priority '700'
+ end
+ ```
- Note: The `pin_priority` of `700` ensures that this version will be preferred over any other available versions.
+ Note: The `pin_priority` of `700` ensures that this version will be preferred over any other available versions.
- **Unpin a libmysqlclient16**:
+ **Unpin a libmysqlclient16**:
- ```ruby
- apt_preference 'libmysqlclient16' do
- action :remove
- end
- ```
+ ```ruby
+ apt_preference 'libmysqlclient16' do
+ action :remove
+ end
+ ```
- **Pin all packages to prefer the packages.dotdeb.org repository**:
+ **Pin all packages to prefer the packages.dotdeb.org repository**:
- ```ruby
- apt_preference 'dotdeb' do
- glob '*'
- pin 'origin packages.dotdeb.org'
- pin_priority '700'
- end
- ```
+ ```ruby
+ apt_preference 'dotdeb' do
+ glob '*'
+ pin 'origin packages.dotdeb.org'
+ pin_priority '700'
+ end
+ ```
DOC
property :package_name, String,
diff --git a/lib/chef/resource/bash.rb b/lib/chef/resource/bash.rb
index 9ed6dc68d5..d210a10b8a 100644
--- a/lib/chef/resource/bash.rb
+++ b/lib/chef/resource/bash.rb
@@ -27,122 +27,122 @@ class Chef
description "Use the **bash** resource to execute scripts using the Bash interpreter. This resource may also use any of the actions and properties that are available to the **execute** resource. Commands that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the environment in which they are run. Use `not_if` and `only_if` to guard this resource for idempotence."
examples <<~'DOC'
- **Compile an application**
-
- ```ruby
- bash 'install_something' do
- user 'root'
- cwd '/tmp'
- code <<-EOH
- wget http://www.example.com/tarball.tar.gz
- tar -zxf tarball.tar.gz
- cd tarball
- ./configure
- make
- make install
- EOH
- end
- ```
-
- **Install a file from a remote location**
-
- The following is an example of how to install the foo123 module for Nginx. This module adds shell-style functionality to an Nginx configuration file and does the following:
-
- - Declares three variables
- - Gets the Nginx file from a remote location
- - Installs the file using Bash to the path specified by the `src_filepath` variable
-
- ```ruby
- src_filename = "foo123-nginx-module-v#{node['nginx']['foo123']['version']}.tar.gz"
- src_filepath = "#{Chef::Config['file_cache_path']}/#{src_filename}"
- extract_path = "#{Chef::Config['file_cache_path']}/nginx_foo123_module/#{node['nginx']['foo123']['checksum']}"
-
- remote_file 'src_filepath' do
- source node['nginx']['foo123']['url']
- checksum node['nginx']['foo123']['checksum']
- owner 'root'
- group 'root'
- mode '0755'
- end
-
- bash 'extract_module' do
- cwd ::File.dirname(src_filepath)
- code <<-EOH
- mkdir -p #{extract_path}
- tar xzf #{src_filename} -C #{extract_path}
- mv #{extract_path}/*/* #{extract_path}/
- EOH
- not_if { ::File.exist?(extract_path) }
- end
- ```
-
- **Install an application from git**
-
- ```ruby
- git "#{Chef::Config[:file_cache_path]}/ruby-build" do
- repository 'git://github.com/rbenv/ruby-build.git'
- revision 'master'
- action :sync
- end
-
- bash 'install_ruby_build' do
- cwd "#{Chef::Config[:file_cache_path]}/ruby-build"
- user 'rbenv'
- group 'rbenv'
- code <<-EOH
- ./install.sh
- EOH
- environment 'PREFIX' => '/usr/local'
- end
- ```
-
- **Using Attributes in Bash Code**
-
- The following recipe shows how an attributes file can be used to store certain settings. An attributes file is located in the `attributes/`` directory in the same cookbook as the recipe which calls the attributes file. In this example, the attributes file specifies certain settings for Python that are then used across all nodes against which this recipe will run.
-
- Python packages have versions, installation directories, URLs, and checksum files. An attributes file that exists to support this type of recipe would include settings like the following:
-
- ```ruby
- default['python']['version'] = '2.7.1'
-
- if python['install_method'] == 'package'
- default['python']['prefix_dir'] = '/usr'
- else
- default['python']['prefix_dir'] = '/usr/local'
- end
-
- default['python']['url'] = 'http://www.python.org/ftp/python'
- default['python']['checksum'] = '80e387...85fd61'
- ```
-
- and then the methods in the recipe may refer to these values. A recipe that is used to install Python will need to do the following:
-
- - Identify each package to be installed (implied in this example, not shown)
- - Define variables for the package `version` and the `install_path`
- - Get the package from a remote location, but only if the package does not already exist on the target system
- - Use the **bash** resource to install the package on the node, but only when the package is not already installed
-
- ```ruby
- version = node['python']['version']
- install_path = "#{node['python']['prefix_dir']}/lib/python#{version.split(/(^\d+\.\d+)/)[1]}"
-
- remote_file "#{Chef::Config[:file_cache_path]}/Python-#{version}.tar.bz2" do
- source "#{node['python']['url']}/#{version}/Python-#{version}.tar.bz2"
- checksum node['python']['checksum']
- mode '0755'
- not_if { ::File.exist?(install_path) }
- end
-
- bash 'build-and-install-python' do
- cwd Chef::Config[:file_cache_path]
- code <<-EOF
- tar -jxvf Python-#{version}.tar.bz2
- (cd Python-#{version} && ./configure #{configure_options})
- (cd Python-#{version} && make && make install)
- EOF
- not_if { ::File.exist?(install_path) }
- end
- ```
+ **Compile an application**
+
+ ```ruby
+ bash 'install_something' do
+ user 'root'
+ cwd '/tmp'
+ code <<-EOH
+ wget http://www.example.com/tarball.tar.gz
+ tar -zxf tarball.tar.gz
+ cd tarball
+ ./configure
+ make
+ make install
+ EOH
+ end
+ ```
+
+ **Install a file from a remote location**
+
+ The following is an example of how to install the foo123 module for Nginx. This module adds shell-style functionality to an Nginx configuration file and does the following:
+
+ - Declares three variables
+ - Gets the Nginx file from a remote location
+ - Installs the file using Bash to the path specified by the `src_filepath` variable
+
+ ```ruby
+ src_filename = "foo123-nginx-module-v#{node['nginx']['foo123']['version']}.tar.gz"
+ src_filepath = "#{Chef::Config['file_cache_path']}/#{src_filename}"
+ extract_path = "#{Chef::Config['file_cache_path']}/nginx_foo123_module/#{node['nginx']['foo123']['checksum']}"
+
+ remote_file 'src_filepath' do
+ source node['nginx']['foo123']['url']
+ checksum node['nginx']['foo123']['checksum']
+ owner 'root'
+ group 'root'
+ mode '0755'
+ end
+
+ bash 'extract_module' do
+ cwd ::File.dirname(src_filepath)
+ code <<-EOH
+ mkdir -p #{extract_path}
+ tar xzf #{src_filename} -C #{extract_path}
+ mv #{extract_path}/*/* #{extract_path}/
+ EOH
+ not_if { ::File.exist?(extract_path) }
+ end
+ ```
+
+ **Install an application from git**
+
+ ```ruby
+ git "#{Chef::Config[:file_cache_path]}/ruby-build" do
+ repository 'git://github.com/rbenv/ruby-build.git'
+ revision 'master'
+ action :sync
+ end
+
+ bash 'install_ruby_build' do
+ cwd "#{Chef::Config[:file_cache_path]}/ruby-build"
+ user 'rbenv'
+ group 'rbenv'
+ code <<-EOH
+ ./install.sh
+ EOH
+ environment 'PREFIX' => '/usr/local'
+ end
+ ```
+
+ **Using Attributes in Bash Code**
+
+ The following recipe shows how an attributes file can be used to store certain settings. An attributes file is located in the `attributes/`` directory in the same cookbook as the recipe which calls the attributes file. In this example, the attributes file specifies certain settings for Python that are then used across all nodes against which this recipe will run.
+
+ Python packages have versions, installation directories, URLs, and checksum files. An attributes file that exists to support this type of recipe would include settings like the following:
+
+ ```ruby
+ default['python']['version'] = '2.7.1'
+
+ if python['install_method'] == 'package'
+ default['python']['prefix_dir'] = '/usr'
+ else
+ default['python']['prefix_dir'] = '/usr/local'
+ end
+
+ default['python']['url'] = 'http://www.python.org/ftp/python'
+ default['python']['checksum'] = '80e387...85fd61'
+ ```
+
+ and then the methods in the recipe may refer to these values. A recipe that is used to install Python will need to do the following:
+
+ - Identify each package to be installed (implied in this example, not shown)
+ - Define variables for the package `version` and the `install_path`
+ - Get the package from a remote location, but only if the package does not already exist on the target system
+ - Use the **bash** resource to install the package on the node, but only when the package is not already installed
+
+ ```ruby
+ version = node['python']['version']
+ install_path = "#{node['python']['prefix_dir']}/lib/python#{version.split(/(^\d+\.\d+)/)[1]}"
+
+ remote_file "#{Chef::Config[:file_cache_path]}/Python-#{version}.tar.bz2" do
+ source "#{node['python']['url']}/#{version}/Python-#{version}.tar.bz2"
+ checksum node['python']['checksum']
+ mode '0755'
+ not_if { ::File.exist?(install_path) }
+ end
+
+ bash 'build-and-install-python' do
+ cwd Chef::Config[:file_cache_path]
+ code <<-EOF
+ tar -jxvf Python-#{version}.tar.bz2
+ (cd Python-#{version} && ./configure #{configure_options})
+ (cd Python-#{version} && make && make install)
+ EOF
+ not_if { ::File.exist?(install_path) }
+ end
+ ```
DOC
def initialize(name, run_context = nil)
diff --git a/lib/chef/resource/bff_package.rb b/lib/chef/resource/bff_package.rb
index ffe5dfac1b..b0ac15fed8 100644
--- a/lib/chef/resource/bff_package.rb
+++ b/lib/chef/resource/bff_package.rb
@@ -29,25 +29,25 @@ class Chef
description "Use the **bff_package** resource to manage packages for the AIX platform using the installp utility. When a package is installed from a local file, it must be added to the node using the **remote_file** or **cookbook_file** resources."
introduced "12.0"
examples <<~DOC
- The **bff_package** resource is the default package provider on the AIX platform. The base **package** resource may be used, and then when the platform is AIX, #{ChefUtils::Dist::Infra::PRODUCT} will identify the correct package provider. The following examples show how to install part of the IBM XL C/C++ compiler.
+ The **bff_package** resource is the default package provider on the AIX platform. The base **package** resource may be used, and then when the platform is AIX, #{ChefUtils::Dist::Infra::PRODUCT} will identify the correct package provider. The following examples show how to install part of the IBM XL C/C++ compiler.
- **Installing using the base package resource**
+ **Installing using the base package resource**
- ```ruby
- package 'xlccmp.13.1.0' do
- source '/var/tmp/IBM_XL_C_13.1.0/usr/sys/inst.images/xlccmp.13.1.0'
- action :install
- end
- ```
+ ```ruby
+ package 'xlccmp.13.1.0' do
+ source '/var/tmp/IBM_XL_C_13.1.0/usr/sys/inst.images/xlccmp.13.1.0'
+ action :install
+ end
+ ```
- **Installing using the bff_package resource**
+ **Installing using the bff_package resource**
- ```ruby
- bff_package 'xlccmp.13.1.0' do
- source '/var/tmp/IBM_XL_C_13.1.0/usr/sys/inst.images/xlccmp.13.1.0'
- action :install
- end
- ```
+ ```ruby
+ bff_package 'xlccmp.13.1.0' do
+ source '/var/tmp/IBM_XL_C_13.1.0/usr/sys/inst.images/xlccmp.13.1.0'
+ action :install
+ end
+ ```
DOC
property :package_name, String,
diff --git a/lib/chef/resource/breakpoint.rb b/lib/chef/resource/breakpoint.rb
index 360c064ff0..9b53fe98b2 100644
--- a/lib/chef/resource/breakpoint.rb
+++ b/lib/chef/resource/breakpoint.rb
@@ -29,61 +29,61 @@ class Chef
description "Use the **breakpoint** resource to add breakpoints to recipes. Run the #{ChefUtils::Dist::Infra::SHELL} in #{ChefUtils::Dist::Infra::PRODUCT} mode, and then use those breakpoints to debug recipes. Breakpoints are ignored by the #{ChefUtils::Dist::Infra::CLIENT} during an actual #{ChefUtils::Dist::Infra::CLIENT} run. That said, breakpoints are typically used to debug recipes only when running them in a non-production environment, after which they are removed from those recipes before the parent cookbook is uploaded to the Chef server."
introduced "12.0"
examples <<~DOC
- **A recipe without a breakpoint**
+ **A recipe without a breakpoint**
- ```ruby
- yum_key node['yum']['elrepo']['key'] do
- url node['yum']['elrepo']['key_url']
- action :add
- end
+ ```ruby
+ yum_key node['yum']['elrepo']['key'] do
+ url node['yum']['elrepo']['key_url']
+ action :add
+ end
- yum_repository 'elrepo' do
- description 'ELRepo.org Community Enterprise Linux Extras Repository'
- key node['yum']['elrepo']['key']
- mirrorlist node['yum']['elrepo']['url']
- includepkgs node['yum']['elrepo']['includepkgs']
- exclude node['yum']['elrepo']['exclude']
- action :create
- end
- ```
+ yum_repository 'elrepo' do
+ description 'ELRepo.org Community Enterprise Linux Extras Repository'
+ key node['yum']['elrepo']['key']
+ mirrorlist node['yum']['elrepo']['url']
+ includepkgs node['yum']['elrepo']['includepkgs']
+ exclude node['yum']['elrepo']['exclude']
+ action :create
+ end
+ ```
- **The same recipe with breakpoints**
+ **The same recipe with breakpoints**
- In the following example, the name of each breakpoint is an arbitrary string.
+ In the following example, the name of each breakpoint is an arbitrary string.
- ```ruby
- breakpoint "before yum_key node['yum']['repo_name']['key']" do
- action :break
- end
+ ```ruby
+ breakpoint "before yum_key node['yum']['repo_name']['key']" do
+ action :break
+ end
- yum_key node['yum']['repo_name']['key'] do
- url node['yum']['repo_name']['key_url']
- action :add
- end
+ yum_key node['yum']['repo_name']['key'] do
+ url node['yum']['repo_name']['key_url']
+ action :add
+ end
- breakpoint "after yum_key node['yum']['repo_name']['key']" do
- action :break
- end
+ breakpoint "after yum_key node['yum']['repo_name']['key']" do
+ action :break
+ end
- breakpoint "before yum_repository 'repo_name'" do
- action :break
- end
+ breakpoint "before yum_repository 'repo_name'" do
+ action :break
+ end
- yum_repository 'repo_name' do
- description 'description'
- key node['yum']['repo_name']['key']
- mirrorlist node['yum']['repo_name']['url']
- includepkgs node['yum']['repo_name']['includepkgs']
- exclude node['yum']['repo_name']['exclude']
- action :create
- end
+ yum_repository 'repo_name' do
+ description 'description'
+ key node['yum']['repo_name']['key']
+ mirrorlist node['yum']['repo_name']['url']
+ includepkgs node['yum']['repo_name']['includepkgs']
+ exclude node['yum']['repo_name']['exclude']
+ action :create
+ end
- breakpoint "after yum_repository 'repo_name'" do
- action :break
- end
- ```
+ breakpoint "after yum_repository 'repo_name'" do
+ action :break
+ end
+ ```
- In the previous examples, the names are used to indicate if the breakpoint is before or after a resource and also to specify which resource it is before or after.
+ In the previous examples, the names are used to indicate if the breakpoint is before or after a resource and also to specify which resource it is before or after.
DOC
default_action :break
diff --git a/lib/chef/resource/cab_package.rb b/lib/chef/resource/cab_package.rb
index 904fe81701..6dc52ade1e 100644
--- a/lib/chef/resource/cab_package.rb
+++ b/lib/chef/resource/cab_package.rb
@@ -30,33 +30,33 @@ class Chef
description "Use the **cab_package** resource to install or remove Microsoft Windows cabinet (.cab) packages."
introduced "12.15"
examples <<~'DOC'
- **Using local path in source**
+ **Using local path in source**
- ```ruby
- cab_package 'Install .NET 3.5 sp1 via KB958488' do
- source 'C:\Users\xyz\AppData\Local\Temp\Windows6.1-KB958488-x64.cab'
- action :install
- end
+ ```ruby
+ cab_package 'Install .NET 3.5 sp1 via KB958488' do
+ source 'C:\Users\xyz\AppData\Local\Temp\Windows6.1-KB958488-x64.cab'
+ action :install
+ end
- cab_package 'Remove .NET 3.5 sp1 via KB958488' do
- source 'C:\Users\xyz\AppData\Local\Temp\Windows6.1-KB958488-x64.cab'
- action :remove
- end
- ```
+ cab_package 'Remove .NET 3.5 sp1 via KB958488' do
+ source 'C:\Users\xyz\AppData\Local\Temp\Windows6.1-KB958488-x64.cab'
+ action :remove
+ end
+ ```
- **Using URL in source**
+ **Using URL in source**
- ```ruby
- cab_package 'Install .NET 3.5 sp1 via KB958488' do
- source 'https://s3.amazonaws.com/my_bucket/Windows6.1-KB958488-x64.cab'
- action :install
- end
+ ```ruby
+ cab_package 'Install .NET 3.5 sp1 via KB958488' do
+ source 'https://s3.amazonaws.com/my_bucket/Windows6.1-KB958488-x64.cab'
+ action :install
+ end
- cab_package 'Remove .NET 3.5 sp1 via KB958488' do
- source 'https://s3.amazonaws.com/my_bucket/Temp\Windows6.1-KB958488-x64.cab'
- action :remove
- end
- ```
+ cab_package 'Remove .NET 3.5 sp1 via KB958488' do
+ source 'https://s3.amazonaws.com/my_bucket/Temp\Windows6.1-KB958488-x64.cab'
+ action :remove
+ end
+ ```
DOC
allowed_actions :install, :remove
diff --git a/lib/chef/resource/chef_client_config.rb b/lib/chef/resource/chef_client_config.rb
index bd4ccbc478..6e4dbb330c 100644
--- a/lib/chef/resource/chef_client_config.rb
+++ b/lib/chef/resource/chef_client_config.rb
@@ -27,66 +27,66 @@ class Chef
description "Use the **chef_client_config** resource to create a client.rb file in the #{ChefUtils::Dist::Infra::PRODUCT} configuration directory. See the [client.rb docs](https://docs.chef.io/config_rb_client/) for more details on options available in the client.rb configuration file."
introduced "16.6"
examples <<~DOC
- **Bare minimum #{ChefUtils::Dist::Infra::PRODUCT} client.rb**:
+ **Bare minimum #{ChefUtils::Dist::Infra::PRODUCT} client.rb**:
- The absolute minimum configuration necessary for a node to communicate with the #{ChefUtils::Dist::Server::PRODUCT} is the URL of the #{ChefUtils::Dist::Server::PRODUCT}. All other configuration options either have values at the server side (Policyfiles, Roles, Environments, etc) or have default values determined at client startup.
+ The absolute minimum configuration necessary for a node to communicate with the #{ChefUtils::Dist::Server::PRODUCT} is the URL of the #{ChefUtils::Dist::Server::PRODUCT}. All other configuration options either have values at the server side (Policyfiles, Roles, Environments, etc) or have default values determined at client startup.
- ```ruby
- chef_client_config 'Create client.rb' do
- chef_server_url 'https://chef.example.dmz'
- end
- ```
-
- **More complex #{ChefUtils::Dist::Infra::PRODUCT} client.rb**:
-
- ```ruby
- chef_client_config 'Create client.rb' do
- chef_server_url 'https://chef.example.dmz'
- log_level :info
- log_location :syslog
- http_proxy 'proxy.example.dmz'
- https_proxy 'proxy.example.dmz'
- no_proxy %w(internal.example.dmz)
- end
- ```
-
- **Adding additional config content to the client.rb**:
-
- This resource aims to provide common configuration options. Some configuration options are missing and some users may want to use arbitrary Ruby code within their configuration. For this we offer an `additional_config` property that can be used to add any configuration or code to the bottom of the `client.rb` file. Also keep in mind that within the configuration directory is a `client.d` directory where you can put additional `.rb` files containing configuration options. These can be created using `file` or `template` resources within your cookbooks as necessary.
-
- ```ruby
- chef_client_config 'Create client.rb' do
- chef_server_url 'https://chef.example.dmz'
- additional_config <<~CONFIG
- # Extra config code to safely load a gem into the client run.
- # Since the config is Ruby you can run any Ruby code you want via the client.rb.
- # It's a great way to break things, so be careful
- begin
- require 'aws-sdk'
- rescue LoadError
- Chef::Log.warn "Failed to load aws-sdk."
- end
- CONFIG
- end
- ```
-
- **Setup two report handlers in the client.rb**:
-
- ```ruby
- chef_client_config 'Create client.rb' do
- chef_server_url 'https://chef.example.dmz'
- report_handlers [
- {
- 'class' => 'ReportHandler1Class',
- 'arguments' => ["'FirstArgument'", "'SecondArgument'"],
- },
- {
- 'class' => 'ReportHandler2Class',
- 'arguments' => ["'FirstArgument'", "'SecondArgument'"],
- },
- ]
- end
- ```
+ ```ruby
+ chef_client_config 'Create client.rb' do
+ chef_server_url 'https://chef.example.dmz'
+ end
+ ```
+
+ **More complex #{ChefUtils::Dist::Infra::PRODUCT} client.rb**:
+
+ ```ruby
+ chef_client_config 'Create client.rb' do
+ chef_server_url 'https://chef.example.dmz'
+ log_level :info
+ log_location :syslog
+ http_proxy 'proxy.example.dmz'
+ https_proxy 'proxy.example.dmz'
+ no_proxy %w(internal.example.dmz)
+ end
+ ```
+
+ **Adding additional config content to the client.rb**:
+
+ This resource aims to provide common configuration options. Some configuration options are missing and some users may want to use arbitrary Ruby code within their configuration. For this we offer an `additional_config` property that can be used to add any configuration or code to the bottom of the `client.rb` file. Also keep in mind that within the configuration directory is a `client.d` directory where you can put additional `.rb` files containing configuration options. These can be created using `file` or `template` resources within your cookbooks as necessary.
+
+ ```ruby
+ chef_client_config 'Create client.rb' do
+ chef_server_url 'https://chef.example.dmz'
+ additional_config <<~CONFIG
+ # Extra config code to safely load a gem into the client run.
+ # Since the config is Ruby you can run any Ruby code you want via the client.rb.
+ # It's a great way to break things, so be careful
+ begin
+ require 'aws-sdk'
+ rescue LoadError
+ Chef::Log.warn "Failed to load aws-sdk."
+ end
+ CONFIG
+ end
+ ```
+
+ **Setup two report handlers in the client.rb**:
+
+ ```ruby
+ chef_client_config 'Create client.rb' do
+ chef_server_url 'https://chef.example.dmz'
+ report_handlers [
+ {
+ 'class' => 'ReportHandler1Class',
+ 'arguments' => ["'FirstArgument'", "'SecondArgument'"],
+ },
+ {
+ 'class' => 'ReportHandler2Class',
+ 'arguments' => ["'FirstArgument'", "'SecondArgument'"],
+ },
+ ]
+ end
+ ```
DOC
# @todo policy_file or policy_group being set requires the other to be set so enforce that.
@@ -132,10 +132,10 @@ class Chef
equal_to: %i{verify_none verify_peer},
coerce: proc { |x| string_to_symbol(x) },
description: <<~DESC
- Set the verify mode for HTTPS requests.
+ Set the verify mode for HTTPS requests.
- * Use :verify_none for no validation of SSL certificates.
- * Use :verify_peer for validation of all SSL certificates, including the #{ChefUtils::Dist::Server::PRODUCT} connections, S3 connections, and any HTTPS remote_file resource URLs used in #{ChefUtils::Dist::Infra::PRODUCT} runs. This is the recommended setting.
+ * Use :verify_none for no validation of SSL certificates.
+ * Use :verify_peer for validation of all SSL certificates, including the #{ChefUtils::Dist::Server::PRODUCT} connections, S3 connections, and any HTTPS remote_file resource URLs used in #{ChefUtils::Dist::Infra::PRODUCT} runs. This is the recommended setting.
DESC
property :formatters, Array,
diff --git a/lib/chef/resource/chef_client_cron.rb b/lib/chef/resource/chef_client_cron.rb
index 726fd58795..4dccd8cf10 100644
--- a/lib/chef/resource/chef_client_cron.rb
+++ b/lib/chef/resource/chef_client_cron.rb
@@ -29,28 +29,28 @@ class Chef
description "Use the **chef_client_cron** resource to setup the #{ChefUtils::Dist::Infra::PRODUCT} to run as a cron job. This resource will also create the specified log directory if it doesn't already exist."
introduced "16.0"
examples <<~DOC
- **Setup #{ChefUtils::Dist::Infra::PRODUCT} to run using the default 30 minute cadence**:
+ **Setup #{ChefUtils::Dist::Infra::PRODUCT} to run using the default 30 minute cadence**:
- ```ruby
- chef_client_cron 'Run #{ChefUtils::Dist::Infra::PRODUCT} as a cron job'
- ```
+ ```ruby
+ chef_client_cron 'Run #{ChefUtils::Dist::Infra::PRODUCT} as a cron job'
+ ```
- **Run #{ChefUtils::Dist::Infra::PRODUCT} twice a day**:
+ **Run #{ChefUtils::Dist::Infra::PRODUCT} twice a day**:
- ```ruby
- chef_client_cron 'Run #{ChefUtils::Dist::Infra::PRODUCT} every 12 hours' do
- minute 0
- hour '0,12'
- end
- ```
+ ```ruby
+ chef_client_cron 'Run #{ChefUtils::Dist::Infra::PRODUCT} every 12 hours' do
+ minute 0
+ hour '0,12'
+ end
+ ```
- **Run #{ChefUtils::Dist::Infra::PRODUCT} with extra options passed to the client**:
+ **Run #{ChefUtils::Dist::Infra::PRODUCT} with extra options passed to the client**:
- ```ruby
- chef_client_cron 'Run an override recipe' do
- daemon_options ['--override-runlist mycorp_base::default']
- end
- ```
+ ```ruby
+ chef_client_cron 'Run an override recipe' do
+ daemon_options ['--override-runlist mycorp_base::default']
+ end
+ ```
DOC
extend Chef::ResourceHelpers::CronValidations
diff --git a/lib/chef/resource/chef_client_scheduled_task.rb b/lib/chef/resource/chef_client_scheduled_task.rb
index 31ceb82238..0f7915e280 100644
--- a/lib/chef/resource/chef_client_scheduled_task.rb
+++ b/lib/chef/resource/chef_client_scheduled_task.rb
@@ -27,45 +27,45 @@ class Chef
description "Use the **chef_client_scheduled_task** resource to setup the #{ChefUtils::Dist::Infra::PRODUCT} to run as a Windows scheduled task. This resource will also create the specified log directory if it doesn't already exist."
introduced "16.0"
examples <<~DOC
- **Setup #{ChefUtils::Dist::Infra::PRODUCT} to run using the default 30 minute cadence**:
+ **Setup #{ChefUtils::Dist::Infra::PRODUCT} to run using the default 30 minute cadence**:
- ```ruby
- chef_client_scheduled_task 'Run #{ChefUtils::Dist::Infra::PRODUCT} as a scheduled task'
- ```
+ ```ruby
+ chef_client_scheduled_task 'Run #{ChefUtils::Dist::Infra::PRODUCT} as a scheduled task'
+ ```
- **Run #{ChefUtils::Dist::Infra::PRODUCT} on system start**:
+ **Run #{ChefUtils::Dist::Infra::PRODUCT} on system start**:
- ```ruby
- chef_client_scheduled_task '#{ChefUtils::Dist::Infra::PRODUCT} on start' do
- frequency 'onstart'
- end
- ```
+ ```ruby
+ chef_client_scheduled_task '#{ChefUtils::Dist::Infra::PRODUCT} on start' do
+ frequency 'onstart'
+ end
+ ```
- **Run #{ChefUtils::Dist::Infra::PRODUCT} with extra options passed to the client**:
+ **Run #{ChefUtils::Dist::Infra::PRODUCT} with extra options passed to the client**:
- ```ruby
- chef_client_scheduled_task 'Run an override recipe' do
- daemon_options ['--override-runlist mycorp_base::default']
- end
- ```
+ ```ruby
+ chef_client_scheduled_task 'Run an override recipe' do
+ daemon_options ['--override-runlist mycorp_base::default']
+ end
+ ```
- **Run #{ChefUtils::Dist::Infra::PRODUCT} daily at 01:00 am, specifying a named run-list**:
+ **Run #{ChefUtils::Dist::Infra::PRODUCT} daily at 01:00 am, specifying a named run-list**:
- ```ruby
- chef_client_scheduled_task 'Run chef-client named run-list daily' do
- frequency 'daily'
- start_time '01:00'
- daemon_options ['-n audit_only']
- end
- ```
+ ```ruby
+ chef_client_scheduled_task 'Run chef-client named run-list daily' do
+ frequency 'daily'
+ start_time '01:00'
+ daemon_options ['-n audit_only']
+ end
+ ```
- **Run #{ChefUtils::Dist::Infra::PRODUCT} with a persistent delay on every run calculated once, similar to how chef_client_cron resource works**:
+ **Run #{ChefUtils::Dist::Infra::PRODUCT} with a persistent delay on every run calculated once, similar to how chef_client_cron resource works**:
- ```ruby
- chef_client_scheduled_task 'Run chef-client with persistent splay' do
- use_consistent_splay true
- end
- ```
+ ```ruby
+ chef_client_scheduled_task 'Run chef-client with persistent splay' do
+ use_consistent_splay true
+ end
+ ```
DOC
resource_name :chef_client_scheduled_task
diff --git a/lib/chef/resource/chef_client_systemd_timer.rb b/lib/chef/resource/chef_client_systemd_timer.rb
index 0df5852514..46880f9224 100644
--- a/lib/chef/resource/chef_client_systemd_timer.rb
+++ b/lib/chef/resource/chef_client_systemd_timer.rb
@@ -27,27 +27,27 @@ class Chef
description "Use the **chef_client_systemd_timer** resource to setup the #{ChefUtils::Dist::Infra::PRODUCT} to run as a systemd timer."
introduced "16.0"
examples <<~DOC
- **Setup #{ChefUtils::Dist::Infra::PRODUCT} to run using the default 30 minute cadence**:
+ **Setup #{ChefUtils::Dist::Infra::PRODUCT} to run using the default 30 minute cadence**:
- ```ruby
- chef_client_systemd_timer 'Run #{ChefUtils::Dist::Infra::PRODUCT} as a systemd timer'
- ```
+ ```ruby
+ chef_client_systemd_timer 'Run #{ChefUtils::Dist::Infra::PRODUCT} as a systemd timer'
+ ```
- **Run #{ChefUtils::Dist::Infra::PRODUCT} every 1 hour**:
+ **Run #{ChefUtils::Dist::Infra::PRODUCT} every 1 hour**:
- ```ruby
- chef_client_systemd_timer 'Run #{ChefUtils::Dist::Infra::PRODUCT} every 1 hour' do
- interval '1hr'
- end
- ```
+ ```ruby
+ chef_client_systemd_timer 'Run #{ChefUtils::Dist::Infra::PRODUCT} every 1 hour' do
+ interval '1hr'
+ end
+ ```
- **Run #{ChefUtils::Dist::Infra::PRODUCT} with extra options passed to the client**:
+ **Run #{ChefUtils::Dist::Infra::PRODUCT} with extra options passed to the client**:
- ```ruby
- chef_client_systemd_timer 'Run an override recipe' do
- daemon_options ['--override-runlist mycorp_base::default']
- end
- ```
+ ```ruby
+ chef_client_systemd_timer 'Run an override recipe' do
+ daemon_options ['--override-runlist mycorp_base::default']
+ end
+ ```
DOC
property :job_name, String,
diff --git a/lib/chef/resource/chef_client_trusted_certificate.rb b/lib/chef/resource/chef_client_trusted_certificate.rb
index 7c9562010d..a1983bd912 100644
--- a/lib/chef/resource/chef_client_trusted_certificate.rb
+++ b/lib/chef/resource/chef_client_trusted_certificate.rb
@@ -27,35 +27,35 @@ class Chef
description "Use the **chef_client_trusted_certificate** resource to add certificates to #{ChefUtils::Dist::Infra::PRODUCT}'s trusted certificate directory. This allows the #{ChefUtils::Dist::Infra::PRODUCT} to communicate with internal encrypted resources without errors."
introduced "16.5"
examples <<~DOC
- **Trust a self signed certificate**:
+ **Trust a self signed certificate**:
- ```ruby
- chef_client_trusted_certificate 'self-signed.badssl.com' do
- certificate <<~CERT
- -----BEGIN CERTIFICATE-----
- MIIDeTCCAmGgAwIBAgIJAPziuikCTox4MA0GCSqGSIb3DQEBCwUAMGIxCzAJBgNV
- BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNp
- c2NvMQ8wDQYDVQQKDAZCYWRTU0wxFTATBgNVBAMMDCouYmFkc3NsLmNvbTAeFw0x
- OTEwMDkyMzQxNTJaFw0yMTEwMDgyMzQxNTJaMGIxCzAJBgNVBAYTAlVTMRMwEQYD
- VQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQ8wDQYDVQQK
- DAZCYWRTU0wxFTATBgNVBAMMDCouYmFkc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEB
- BQADggEPADCCAQoCggEBAMIE7PiM7gTCs9hQ1XBYzJMY61yoaEmwIrX5lZ6xKyx2
- PmzAS2BMTOqytMAPgLaw+XLJhgL5XEFdEyt/ccRLvOmULlA3pmccYYz2QULFRtMW
- hyefdOsKnRFSJiFzbIRMeVXk0WvoBj1IFVKtsyjbqv9u/2CVSndrOfEk0TG23U3A
- xPxTuW1CrbV8/q71FdIzSOciccfCFHpsKOo3St/qbLVytH5aohbcabFXRNsKEqve
- ww9HdFxBIuGa+RuT5q0iBikusbpJHAwnnqP7i/dAcgCskgjZjFeEU4EFy+b+a1SY
- QCeFxxC7c3DvaRhBB0VVfPlkPz0sw6l865MaTIbRyoUCAwEAAaMyMDAwCQYDVR0T
- BAIwADAjBgNVHREEHDAaggwqLmJhZHNzbC5jb22CCmJhZHNzbC5jb20wDQYJKoZI
- hvcNAQELBQADggEBAGlwCdbPxflZfYOaukZGCaxYK6gpincX4Lla4Ui2WdeQxE95
- w7fChXvP3YkE3UYUE7mupZ0eg4ZILr/A0e7JQDsgIu/SRTUE0domCKgPZ8v99k3A
- vka4LpLK51jHJJK7EFgo3ca2nldd97GM0MU41xHFk8qaK1tWJkfrrfcGwDJ4GQPI
- iLlm6i0yHq1Qg1RypAXJy5dTlRXlCLd8ufWhhiwW0W75Va5AEnJuqpQrKwl3KQVe
- wGj67WWRgLfSr+4QG1mNvCZb2CkjZWmxkGPuoP40/y7Yu5OFqxP5tAjj4YixCYTW
- EVA0pmzIzgBg+JIe3PdRy27T0asgQW/F4TY61Yk=
- -----END CERTIFICATE-----
- CERT
- end
- ```
+ ```ruby
+ chef_client_trusted_certificate 'self-signed.badssl.com' do
+ certificate <<~CERT
+ -----BEGIN CERTIFICATE-----
+ MIIDeTCCAmGgAwIBAgIJAPziuikCTox4MA0GCSqGSIb3DQEBCwUAMGIxCzAJBgNV
+ BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNp
+ c2NvMQ8wDQYDVQQKDAZCYWRTU0wxFTATBgNVBAMMDCouYmFkc3NsLmNvbTAeFw0x
+ OTEwMDkyMzQxNTJaFw0yMTEwMDgyMzQxNTJaMGIxCzAJBgNVBAYTAlVTMRMwEQYD
+ VQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQ8wDQYDVQQK
+ DAZCYWRTU0wxFTATBgNVBAMMDCouYmFkc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEB
+ BQADggEPADCCAQoCggEBAMIE7PiM7gTCs9hQ1XBYzJMY61yoaEmwIrX5lZ6xKyx2
+ PmzAS2BMTOqytMAPgLaw+XLJhgL5XEFdEyt/ccRLvOmULlA3pmccYYz2QULFRtMW
+ hyefdOsKnRFSJiFzbIRMeVXk0WvoBj1IFVKtsyjbqv9u/2CVSndrOfEk0TG23U3A
+ xPxTuW1CrbV8/q71FdIzSOciccfCFHpsKOo3St/qbLVytH5aohbcabFXRNsKEqve
+ ww9HdFxBIuGa+RuT5q0iBikusbpJHAwnnqP7i/dAcgCskgjZjFeEU4EFy+b+a1SY
+ QCeFxxC7c3DvaRhBB0VVfPlkPz0sw6l865MaTIbRyoUCAwEAAaMyMDAwCQYDVR0T
+ BAIwADAjBgNVHREEHDAaggwqLmJhZHNzbC5jb22CCmJhZHNzbC5jb20wDQYJKoZI
+ hvcNAQELBQADggEBAGlwCdbPxflZfYOaukZGCaxYK6gpincX4Lla4Ui2WdeQxE95
+ w7fChXvP3YkE3UYUE7mupZ0eg4ZILr/A0e7JQDsgIu/SRTUE0domCKgPZ8v99k3A
+ vka4LpLK51jHJJK7EFgo3ca2nldd97GM0MU41xHFk8qaK1tWJkfrrfcGwDJ4GQPI
+ iLlm6i0yHq1Qg1RypAXJy5dTlRXlCLd8ufWhhiwW0W75Va5AEnJuqpQrKwl3KQVe
+ wGj67WWRgLfSr+4QG1mNvCZb2CkjZWmxkGPuoP40/y7Yu5OFqxP5tAjj4YixCYTW
+ EVA0pmzIzgBg+JIe3PdRy27T0asgQW/F4TY61Yk=
+ -----END CERTIFICATE-----
+ CERT
+ end
+ ```
DOC
property :cert_name, String, name_property: true,
diff --git a/lib/chef/resource/chef_handler.rb b/lib/chef/resource/chef_handler.rb
index 099f95a52e..209bccbba8 100644
--- a/lib/chef/resource/chef_handler.rb
+++ b/lib/chef/resource/chef_handler.rb
@@ -28,149 +28,149 @@ class Chef
description "Use the **chef_handler** resource to enable handlers during a #{ChefUtils::Dist::Infra::PRODUCT} run. The resource allows arguments to be passed to #{ChefUtils::Dist::Infra::PRODUCT}, which then applies the conditions defined by the custom handler to the node attribute data collected during a #{ChefUtils::Dist::Infra::PRODUCT} run, and then processes the handler based on that data.\nThe **chef_handler** resource is typically defined early in a node's run-list (often being the first item). This ensures that all of the handlers will be available for the entire #{ChefUtils::Dist::Infra::PRODUCT} run."
introduced "14.0"
examples <<~'DOC'
- **Enable the 'MyHandler' handler**
+ **Enable the 'MyHandler' handler**
- The following example shows how to enable a fictional 'MyHandler' handler which is located on disk at `/etc/chef/my_handler.rb`. The handler will be configured to run with Chef Infra Client and will be passed values to the handler's initializer method:
+ The following example shows how to enable a fictional 'MyHandler' handler which is located on disk at `/etc/chef/my_handler.rb`. The handler will be configured to run with Chef Infra Client and will be passed values to the handler's initializer method:
- ```ruby
- chef_handler 'MyHandler' do
- source '/etc/chef/my_handler.rb' # the file should already be at this path
- arguments path: '/var/chef/reports'
- action :enable
- end
- ```
+ ```ruby
+ chef_handler 'MyHandler' do
+ source '/etc/chef/my_handler.rb' # the file should already be at this path
+ arguments path: '/var/chef/reports'
+ action :enable
+ end
+ ```
- **Enable handlers during the compile phase**
+ **Enable handlers during the compile phase**
- ```ruby
- chef_handler 'Chef::Handler::JsonFile' do
- source 'chef/handler/json_file'
- arguments path: '/var/chef/reports'
- action :enable
- compile_time true
- end
- ```
+ ```ruby
+ chef_handler 'Chef::Handler::JsonFile' do
+ source 'chef/handler/json_file'
+ arguments path: '/var/chef/reports'
+ action :enable
+ compile_time true
+ end
+ ```
- **Handle only exceptions**
+ **Handle only exceptions**
- ```ruby
- chef_handler 'Chef::Handler::JsonFile' do
- source 'chef/handler/json_file'
- arguments path: '/var/chef/reports'
- type exception: true
- action :enable
- end
- ```
+ ```ruby
+ chef_handler 'Chef::Handler::JsonFile' do
+ source 'chef/handler/json_file'
+ arguments path: '/var/chef/reports'
+ type exception: true
+ action :enable
+ end
+ ```
- **Cookbook Versions (a custom handler)**
+ **Cookbook Versions (a custom handler)**
- [@juliandunn](https://github.com/juliandunn) created a custom report handler that logs all of the cookbooks and cookbook versions that were used during a Chef Infra Client run, and then reports after the run is complete.
+ [@juliandunn](https://github.com/juliandunn) created a custom report handler that logs all of the cookbooks and cookbook versions that were used during a Chef Infra Client run, and then reports after the run is complete.
- cookbook_versions.rb:
+ cookbook_versions.rb:
- The following custom handler defines how cookbooks and cookbook versions that are used during a Chef Infra Client run will be compiled into a report using the `Chef::Log` class in Chef Infra Client:
+ The following custom handler defines how cookbooks and cookbook versions that are used during a Chef Infra Client run will be compiled into a report using the `Chef::Log` class in Chef Infra Client:
- ```ruby
- require 'chef/log'
+ ```ruby
+ require 'chef/log'
- module Chef
- class CookbookVersionsHandler < Chef::Handler
- def report
- cookbooks = run_context.cookbook_collection
- Chef::Log.info('Cookbooks and versions run: #{cookbooks.map {|x| x.name.to_s + ' ' + x.version }}')
+ module Chef
+ class CookbookVersionsHandler < Chef::Handler
+ def report
+ cookbooks = run_context.cookbook_collection
+ Chef::Log.info('Cookbooks and versions run: #{cookbooks.map {|x| x.name.to_s + ' ' + x.version }}')
+ end
end
end
- end
- ```
+ ```
- default.rb:
+ default.rb:
- The following recipe is added to the run-list for every node on which a list of cookbooks and versions will be generated as report output after every Chef Infra Client run.
+ The following recipe is added to the run-list for every node on which a list of cookbooks and versions will be generated as report output after every Chef Infra Client run.
- ```ruby
- cookbook_file '/etc/chef/cookbook_versions.rb' do
- source 'cookbook_versions.rb'
- action :create
- end
+ ```ruby
+ cookbook_file '/etc/chef/cookbook_versions.rb' do
+ source 'cookbook_versions.rb'
+ action :create
+ end
- chef_handler 'Chef::CookbookVersionsHandler' do
- source '/etc/chef/cookbook_versions.rb'
- type report: true
- action :enable
- end
- ```
+ chef_handler 'Chef::CookbookVersionsHandler' do
+ source '/etc/chef/cookbook_versions.rb'
+ type report: true
+ action :enable
+ end
+ ```
- This recipe will generate report output similar to the following:
+ This recipe will generate report output similar to the following:
- ```
- [2013-11-26T03:11:06+00:00] INFO: Chef Infra Client Run complete in 0.300029878 seconds
- [2013-11-26T03:11:06+00:00] INFO: Running report handlers
- [2013-11-26T03:11:06+00:00] INFO: Cookbooks and versions run: ["cookbook_versions_handler 1.0.0"]
- [2013-11-26T03:11:06+00:00] INFO: Report handlers complete
- ```
+ ```
+ [2013-11-26T03:11:06+00:00] INFO: Chef Infra Client Run complete in 0.300029878 seconds
+ [2013-11-26T03:11:06+00:00] INFO: Running report handlers
+ [2013-11-26T03:11:06+00:00] INFO: Cookbooks and versions run: ["cookbook_versions_handler 1.0.0"]
+ [2013-11-26T03:11:06+00:00] INFO: Report handlers complete
+ ```
- **JsonFile Handler**
+ **JsonFile Handler**
- The JsonFile handler is available from the `chef_handler` cookbook and can be used with exceptions and reports. It serializes run status data to a JSON file. This handler may be enabled in one of the following ways.
+ The JsonFile handler is available from the `chef_handler` cookbook and can be used with exceptions and reports. It serializes run status data to a JSON file. This handler may be enabled in one of the following ways.
- By adding the following lines of Ruby code to either the client.rb file or the solo.rb file, depending on how Chef Infra Client is being run:
+ By adding the following lines of Ruby code to either the client.rb file or the solo.rb file, depending on how Chef Infra Client is being run:
- ```ruby
- require 'chef/handler/json_file'
- report_handlers << Chef::Handler::JsonFile.new(path: '/var/chef/reports')
- exception_handlers << Chef::Handler::JsonFile.new(path: '/var/chef/reports')
- ```
+ ```ruby
+ require 'chef/handler/json_file'
+ report_handlers << Chef::Handler::JsonFile.new(path: '/var/chef/reports')
+ exception_handlers << Chef::Handler::JsonFile.new(path: '/var/chef/reports')
+ ```
- By using the `chef_handler` resource in a recipe, similar to the following:
+ By using the `chef_handler` resource in a recipe, similar to the following:
- ```ruby
- chef_handler 'Chef::Handler::JsonFile' do
- source 'chef/handler/json_file'
- arguments path: '/var/chef/reports'
- action :enable
- end
- ```
+ ```ruby
+ chef_handler 'Chef::Handler::JsonFile' do
+ source 'chef/handler/json_file'
+ arguments path: '/var/chef/reports'
+ action :enable
+ end
+ ```
- After it has run, the run status data can be loaded and inspected via Interactive Ruby (IRb):
+ After it has run, the run status data can be loaded and inspected via Interactive Ruby (IRb):
- ```
- irb(main):002:0> require 'json' => true
- irb(main):003:0> require 'chef' => true
- irb(main):004:0> r = JSON.parse(IO.read('/var/chef/reports/chef-run-report-20110322060731.json')) => ... output truncated
- irb(main):005:0> r.keys => ['end_time', 'node', 'updated_resources', 'exception', 'all_resources', 'success', 'elapsed_time', 'start_time', 'backtrace']
- irb(main):006:0> r['elapsed_time'] => 0.00246
- ```
+ ```
+ irb(main):002:0> require 'json' => true
+ irb(main):003:0> require 'chef' => true
+ irb(main):004:0> r = JSON.parse(IO.read('/var/chef/reports/chef-run-report-20110322060731.json')) => ... output truncated
+ irb(main):005:0> r.keys => ['end_time', 'node', 'updated_resources', 'exception', 'all_resources', 'success', 'elapsed_time', 'start_time', 'backtrace']
+ irb(main):006:0> r['elapsed_time'] => 0.00246
+ ```
- Register the JsonFile handler
+ Register the JsonFile handler
- ```ruby
- chef_handler 'Chef::Handler::JsonFile' do
- source 'chef/handler/json_file'
- arguments path: '/var/chef/reports'
- action :enable
- end
- ```
+ ```ruby
+ chef_handler 'Chef::Handler::JsonFile' do
+ source 'chef/handler/json_file'
+ arguments path: '/var/chef/reports'
+ action :enable
+ end
+ ```
- **ErrorReport Handler**
+ **ErrorReport Handler**
- The ErrorReport handler is built into Chef Infra Client and can be used for both exceptions and reports. It serializes error report data to a JSON file. This handler may be enabled in one of the following ways.
+ The ErrorReport handler is built into Chef Infra Client and can be used for both exceptions and reports. It serializes error report data to a JSON file. This handler may be enabled in one of the following ways.
- By adding the following lines of Ruby code to either the client.rb file or the solo.rb file, depending on how Chef Infra Client is being run:
+ By adding the following lines of Ruby code to either the client.rb file or the solo.rb file, depending on how Chef Infra Client is being run:
- ```ruby
- require 'chef/handler/error_report'
- report_handlers << Chef::Handler::ErrorReport.new
- exception_handlers << Chef::Handler::ErrorReport.new
- ```
+ ```ruby
+ require 'chef/handler/error_report'
+ report_handlers << Chef::Handler::ErrorReport.new
+ exception_handlers << Chef::Handler::ErrorReport.new
+ ```
- By using the `chef_handler` resource in a recipe, similar to the following:
+ By using the `chef_handler` resource in a recipe, similar to the following:
- ```ruby
- chef_handler 'Chef::Handler::ErrorReport' do
- source 'chef/handler/error_report'
- action :enable
- end
- ```
+ ```ruby
+ chef_handler 'Chef::Handler::ErrorReport' do
+ source 'chef/handler/error_report'
+ action :enable
+ end
+ ```
DOC
property :class_name, String,
diff --git a/lib/chef/resource/chocolatey_config.rb b/lib/chef/resource/chocolatey_config.rb
index 6114dbe18c..8f337e91af 100644
--- a/lib/chef/resource/chocolatey_config.rb
+++ b/lib/chef/resource/chocolatey_config.rb
@@ -24,22 +24,22 @@ class Chef
description "Use the **chocolatey_config** resource to add or remove Chocolatey configuration keys."
introduced "14.3"
examples <<~DOC
- **Set the Chocolatey cacheLocation config**:
+ **Set the Chocolatey cacheLocation config**:
- ```ruby
- chocolatey_config 'Set cacheLocation config' do
- config_key 'cacheLocation'
- value 'C:\\temp\\choco'
- end
- ```
+ ```ruby
+ chocolatey_config 'Set cacheLocation config' do
+ config_key 'cacheLocation'
+ value 'C:\\temp\\choco'
+ end
+ ```
- **Unset a Chocolatey config**:
+ **Unset a Chocolatey config**:
- ```ruby
- chocolatey_config 'BogusConfig' do
- action :unset
- end
- ```
+ ```ruby
+ chocolatey_config 'BogusConfig' do
+ action :unset
+ end
+ ```
DOC
property :config_key, String, name_property: true,
diff --git a/lib/chef/resource/habitat/habitat_package.rb b/lib/chef/resource/habitat/habitat_package.rb
index 74221f5d71..08392b30d2 100644
--- a/lib/chef/resource/habitat/habitat_package.rb
+++ b/lib/chef/resource/habitat/habitat_package.rb
@@ -28,77 +28,77 @@ class Chef
description "Use the **habitat_package** to install or remove Chef Habitat packages from Habitat Builder."
introduced "17.3"
examples <<~DOC
- **Install core/redis**
-
- ```ruby
- habitat_package 'core/redis'
- ```
-
- **Install specific version of a package from the unstable channel**
-
- ```ruby
- habitat_package 'core/redis' do
- version '3.2.3'
- channel 'unstable'
- end
- ```
-
- **Install a package with specific version and revision**
-
- ```ruby
- habitat_package 'core/redis' do
- version '3.2.3/20160920131015'
- end
- ```
-
- **Install a package and force linking it's binary files to the system path**
-
- ```ruby
- habitat_package 'core/nginx' do
- binlink :force
- end
- ```
-
- **Install a package and link it's binary files to the system path**
-
- ```ruby
- habitat_package 'core/nginx' do
- options '--binlink'
- end
- ```
-
- **Remove package and all of it's versions**
-
- ```ruby
- habitat_package 'core/nginx'
- action :remove
- end
- ```
-
- **Remove specified version of a package**
-
- ```ruby
- habitat_package 'core/nginx/3.2.3'
- action :remove
- end
- ```
-
- **Remove package but retain some versions Note: Only available as of Habitat 1.5.86**
-
- ```ruby
- habitat_package 'core/nginx'
- keep_latest '2'
- action :remove
- end
- ```
-
- ```ruby
- **Remove package but keep dependencies**
- habitat_package 'core/nginx'
- no_deps false
- action :remove
- end
- ```
+ **Install core/redis**
+
+ ```ruby
+ habitat_package 'core/redis'
+ ```
+
+ **Install specific version of a package from the unstable channel**
+
+ ```ruby
+ habitat_package 'core/redis' do
+ version '3.2.3'
+ channel 'unstable'
+ end
+ ```
+
+ **Install a package with specific version and revision**
+
+ ```ruby
+ habitat_package 'core/redis' do
+ version '3.2.3/20160920131015'
+ end
+ ```
+
+ **Install a package and force linking it's binary files to the system path**
+
+ ```ruby
+ habitat_package 'core/nginx' do
+ binlink :force
+ end
+ ```
+
+ **Install a package and link it's binary files to the system path**
+
+ ```ruby
+ habitat_package 'core/nginx' do
+ options '--binlink'
+ end
+ ```
+
+ **Remove package and all of it's versions**
+
+ ```ruby
+ habitat_package 'core/nginx'
+ action :remove
+ end
+ ```
+
+ **Remove specified version of a package**
+
+ ```ruby
+ habitat_package 'core/nginx/3.2.3'
+ action :remove
+ end
+ ```
+
+ **Remove package but retain some versions Note: Only available as of Habitat 1.5.86**
+
+ ```ruby
+ habitat_package 'core/nginx'
+ keep_latest '2'
+ action :remove
+ end
+ ```
+
+ ```ruby
+ **Remove package but keep dependencies**
+ habitat_package 'core/nginx'
+ no_deps false
+ action :remove
+ end
+ ```
DOC
property :bldr_url, String, default: "https://bldr.habitat.sh",
diff --git a/lib/chef/resource/habitat/habitat_sup.rb b/lib/chef/resource/habitat/habitat_sup.rb
index 2fdfcd270f..f0281e87fb 100644
--- a/lib/chef/resource/habitat/habitat_sup.rb
+++ b/lib/chef/resource/habitat/habitat_sup.rb
@@ -29,75 +29,75 @@ class Chef
description "Use the **habitat_sup** resource to runs a Chef Habitat supervisor for one or more Chef Habitat services. The resource is commonly used in conjunction with `habitat_service` which will manage the services loaded and started within the supervisor."
introduced "17.3"
examples <<~DOC
- **Set up with just the defaults**
+ **Set up with just the defaults**
- ```ruby
- habitat_sup 'default'
- ```
+ ```ruby
+ habitat_sup 'default'
+ ```
- **Update listen ports and use Supervisor toml config**
+ **Update listen ports and use Supervisor toml config**
- ```ruby
- habitat_sup 'test-options' do
- listen_http '0.0.0.0:9999'
- listen_gossip '0.0.0.0:9998'
- toml_config true
- end
- ```
+ ```ruby
+ habitat_sup 'test-options' do
+ listen_http '0.0.0.0:9999'
+ listen_gossip '0.0.0.0:9998'
+ toml_config true
+ end
+ ```
- **Use with an on-prem Habitat Builder. Note: Access to public builder may not be available due to your company policies**
+ **Use with an on-prem Habitat Builder. Note: Access to public builder may not be available due to your company policies**
- ```ruby
- habitat_sup 'default' do
- bldr_url 'https://bldr.private.net'
- end
- ```
+ ```ruby
+ habitat_sup 'default' do
+ bldr_url 'https://bldr.private.net'
+ end
+ ```
- **Using update_condition**
+ **Using update_condition**
- ```ruby
- habitat_sup 'default' do
- bldr_url 'https://bldr.private.net'
- habitat_channel 'dev'
- update_condition 'track-channel'
- end
- ```
-
- **Provide event_stream_* information**
-
- ```ruby
- habitat_sup 'default' do
- license 'accept'
- event_stream_application 'myapp'
- event_stream_environment 'production'
- event_stream_site 'MySite'
- event_stream_url 'automate.private.net:4222'
- event_stream_token 'myawesomea2clitoken='
- event_stream_cert '/hab/cache/ssl/mycert.crt'
- end
- ```
+ ```ruby
+ habitat_sup 'default' do
+ bldr_url 'https://bldr.private.net'
+ habitat_channel 'dev'
+ update_condition 'track-channel'
+ end
+ ```
+
+ **Provide event_stream_* information**
+
+ ```ruby
+ habitat_sup 'default' do
+ license 'accept'
+ event_stream_application 'myapp'
+ event_stream_environment 'production'
+ event_stream_site 'MySite'
+ event_stream_url 'automate.private.net:4222'
+ event_stream_token 'myawesomea2clitoken='
+ event_stream_cert '/hab/cache/ssl/mycert.crt'
+ end
+ ```
- **Provide specific versions**
+ **Provide specific versions**
- ```ruby
- habitat_sup 'default' do
- bldr_url 'https://bldr.private.net'
- sup_version '1.5.50'
- launcher_version '13458'
- service_version '0.6.0' # WINDOWS ONLY
- end
- ```
+ ```ruby
+ habitat_sup 'default' do
+ bldr_url 'https://bldr.private.net'
+ sup_version '1.5.50'
+ launcher_version '13458'
+ service_version '0.6.0' # WINDOWS ONLY
+ end
+ ```
- **Set latest version of packages to retain**
+ **Set latest version of packages to retain**
- habitat_sup 'default' do
- bldr_url 'https://bldr.private.net'
- sup_version '1.5.86'
- launcher_version '13458'
- service_version '0.6.0' # WINDOWS ONLY
- keep_latest '2'
- end
- ```
+ habitat_sup 'default' do
+ bldr_url 'https://bldr.private.net'
+ sup_version '1.5.86'
+ launcher_version '13458'
+ service_version '0.6.0' # WINDOWS ONLY
+ keep_latest '2'
+ end
+ ```
DOC
property :bldr_url, String,
diff --git a/lib/chef/resource/habitat_config.rb b/lib/chef/resource/habitat_config.rb
index 9f4ac89370..0fb3009aa0 100644
--- a/lib/chef/resource/habitat_config.rb
+++ b/lib/chef/resource/habitat_config.rb
@@ -27,18 +27,18 @@ class Chef
description "Use the **habitat_config** resource to apply a configuration to a Chef Habitat service."
introduced "17.3"
examples <<~DOC
- **Configure your nginx defaults**
-
- ```ruby
- habitat_config 'nginx.default' do
- config({
- worker_count: 2,
- http: {
- keepalive_timeout: 120
- }
- })
- end
- ```
+ **Configure your nginx defaults**
+
+ ```ruby
+ habitat_config 'nginx.default' do
+ config({
+ worker_count: 2,
+ http: {
+ keepalive_timeout: 120
+ }
+ })
+ end
+ ```
DOC
property :config, Mash, required: true, coerce: proc { |m| m.is_a?(Hash) ? Mash.new(m) : m },
diff --git a/lib/chef/resource/habitat_install.rb b/lib/chef/resource/habitat_install.rb
index 86d979a35a..841b8150a8 100644
--- a/lib/chef/resource/habitat_install.rb
+++ b/lib/chef/resource/habitat_install.rb
@@ -25,28 +25,28 @@ class Chef
description "Use the **habitat_install** resource to install Chef Habitat."
introduced "17.3"
examples <<~DOC
- **Installation Without a Resource Name**
+ **Installation Without a Resource Name**
- ```ruby
- habitat_install
- ```
+ ```ruby
+ habitat_install
+ ```
- **Installation specifying a habitat builder URL**
+ **Installation specifying a habitat builder URL**
- ```ruby
- habitat_install 'install habitat' do
- bldr_url 'http://localhost'
- end
- ```
+ ```ruby
+ habitat_install 'install habitat' do
+ bldr_url 'http://localhost'
+ end
+ ```
- **Installation specifying version and habitat builder URL**
+ **Installation specifying version and habitat builder URL**
- ```ruby
- habitat_install 'install habitat' do
- bldr_url 'http://localhost'
- hab_version '1.5.50'
- end
- ```
+ ```ruby
+ habitat_install 'install habitat' do
+ bldr_url 'http://localhost'
+ hab_version '1.5.50'
+ end
+ ```
DOC
property :name, String, default: "install habitat",
diff --git a/lib/chef/resource/habitat_user_toml.rb b/lib/chef/resource/habitat_user_toml.rb
index 723bfdc427..39a9c113f4 100644
--- a/lib/chef/resource/habitat_user_toml.rb
+++ b/lib/chef/resource/habitat_user_toml.rb
@@ -22,18 +22,18 @@ class Chef
description "Use the **habitat_user_toml** to template a `user.toml` for Chef Habitat services. Configurations set in the `user.toml` override the `default.toml` for a given package, which makes it an alternative to applying service group level configuration."
introduced "17.3"
examples <<~DOC
- **Configure user specific settings to nginx**
+ **Configure user specific settings to nginx**
- ```ruby
- habitat_user_toml 'nginx' do
- config({
- worker_count: 2,
- http: {
- keepalive_timeout: 120
- }
- })
- end
- ```
+ ```ruby
+ habitat_user_toml 'nginx' do
+ config({
+ worker_count: 2,
+ http: {
+ keepalive_timeout: 120
+ }
+ })
+ end
+ ```
DOC
property :config, Mash, required: true, coerce: proc { |m| m.is_a?(Hash) ? Mash.new(m) : m },
diff --git a/lib/chef/resource/homebrew_package.rb b/lib/chef/resource/homebrew_package.rb
index 040eff9f59..7a7e1e8bf3 100644
--- a/lib/chef/resource/homebrew_package.rb
+++ b/lib/chef/resource/homebrew_package.rb
@@ -32,33 +32,33 @@ class Chef
description "Use the **homebrew_package** resource to manage packages for the macOS platform. Note: Starting with #{ChefUtils::Dist::Infra::PRODUCT} 16 the homebrew resource now accepts an array of packages for installing multiple packages at once."
introduced "12.0"
examples <<~DOC
- **Install a package**:
+ **Install a package**:
- ```ruby
- homebrew_package 'git'
- ```
+ ```ruby
+ homebrew_package 'git'
+ ```
- **Install multiple packages at once**:
+ **Install multiple packages at once**:
- ```ruby
- homebrew_package %w(git fish ruby)
- ```
+ ```ruby
+ homebrew_package %w(git fish ruby)
+ ```
- **Specify the Homebrew user with a UUID**
+ **Specify the Homebrew user with a UUID**
- ```ruby
- homebrew_package 'git' do
- homebrew_user 1001
- end
- ```
+ ```ruby
+ homebrew_package 'git' do
+ homebrew_user 1001
+ end
+ ```
- **Specify the Homebrew user with a string**:
+ **Specify the Homebrew user with a string**:
- ```ruby
- homebrew_package 'vim' do
- homebrew_user 'user1'
- end
- ```
+ ```ruby
+ homebrew_package 'vim' do
+ homebrew_user 'user1'
+ end
+ ```
DOC
property :homebrew_user, [ String, Integer ],
diff --git a/lib/chef/resource/ifconfig.rb b/lib/chef/resource/ifconfig.rb
index 2c5262fa97..85c0af5c02 100644
--- a/lib/chef/resource/ifconfig.rb
+++ b/lib/chef/resource/ifconfig.rb
@@ -28,51 +28,51 @@ class Chef
description "Use the **ifconfig** resource to manage interfaces on Unix and Linux systems. Note: This resource requires the ifconfig binary to be present on the system and may require additional packages to be installed first. On Ubuntu 18.04 or later you will need to install the `ifupdown` package, which disables the built in Netplan functionality. Warning: This resource will not work with Fedora release 33 or later."
examples <<~DOC
- **Configure a network interface with a static IP**
+ **Configure a network interface with a static IP**
- ```ruby
- ifconfig '33.33.33.80' do
- device 'eth1'
- end
- ```
+ ```ruby
+ ifconfig '33.33.33.80' do
+ device 'eth1'
+ end
+ ```
- will create the following interface configuration:
+ will create the following interface configuration:
- ```
- iface eth1 inet static
- address 33.33.33.80
- ```
+ ```
+ iface eth1 inet static
+ address 33.33.33.80
+ ```
- **Configure an interface to use DHCP**
+ **Configure an interface to use DHCP**
- ```ruby
- ifconfig 'Set eth1 to DHCP' do
- device 'eth1'
- bootproto 'dhcp'
- end
- ```
+ ```ruby
+ ifconfig 'Set eth1 to DHCP' do
+ device 'eth1'
+ bootproto 'dhcp'
+ end
+ ```
- will create the following interface configuration:
+ will create the following interface configuration:
- ```
- iface eth1 inet dhcp
- ```
+ ```
+ iface eth1 inet dhcp
+ ```
- **Update a static IP address with a boot protocol**
+ **Update a static IP address with a boot protocol**
- ```ruby
- ifconfig "33.33.33.80" do
- bootproto "dhcp"
- device "eth1"
- end
- ```
+ ```ruby
+ ifconfig "33.33.33.80" do
+ bootproto "dhcp"
+ device "eth1"
+ end
+ ```
- will update the interface configuration from static to dhcp:
+ will update the interface configuration from static to dhcp:
- ```
- iface eth1 inet dhcp
- address 33.33.33.80
- ```
+ ```
+ iface eth1 inet dhcp
+ address 33.33.33.80
+ ```
DOC
state_attrs :inet_addr, :mask
diff --git a/lib/chef/resource/inspec_input.rb b/lib/chef/resource/inspec_input.rb
index 8eac12d92a..1ee44f9f04 100644
--- a/lib/chef/resource/inspec_input.rb
+++ b/lib/chef/resource/inspec_input.rb
@@ -25,57 +25,56 @@ class Chef
description "Use the **inspec_input** resource to add an input to the Compliance Phase."
introduced "17.5"
examples <<~DOC
+ **Activate the default input in the openssh cookbook's compliance segment**:
- **Activate the default input in the openssh cookbook's compliance segment**:
-
- ```ruby
- inspec_input 'openssh' do
- action :add
- end
- ```
+ ```ruby
+ inspec_input 'openssh' do
+ action :add
+ end
+ ```
- **Activate all inputs in the openssh cookbook's compliance segment**:
+ **Activate all inputs in the openssh cookbook's compliance segment**:
- ```ruby
- inspec_input 'openssh::.*' do
- action :add
- end
- ```
+ ```ruby
+ inspec_input 'openssh::.*' do
+ action :add
+ end
+ ```
- **Add an InSpec input to the Compliance Phase from a hash**:
+ **Add an InSpec input to the Compliance Phase from a hash**:
- ```ruby
- inspec_input { ssh_custom_path: '/whatever2' }
- ```
+ ```ruby
+ inspec_input { ssh_custom_path: '/whatever2' }
+ ```
- **Add an InSpec input to the Compliance Phase using the 'name' property to identify the input**:
+ **Add an InSpec input to the Compliance Phase using the 'name' property to identify the input**:
- ```ruby
- inspec_input "setting my input" do
- source( { ssh_custom_path: '/whatever2' })
- end
- ```
+ ```ruby
+ inspec_input "setting my input" do
+ source( { ssh_custom_path: '/whatever2' })
+ end
+ ```
- **Add an InSpec input to the Compliance Phase using a TOML, JSON or YAML file**:
+ **Add an InSpec input to the Compliance Phase using a TOML, JSON or YAML file**:
- ```ruby
- inspec_input "/path/to/my/input.yml"
- ```
+ ```ruby
+ inspec_input "/path/to/my/input.yml"
+ ```
- **Add an InSpec input to the Compliance Phase using a TOML, JSON or YAML file, using the 'name' property**:
+ **Add an InSpec input to the Compliance Phase using a TOML, JSON or YAML file, using the 'name' property**:
- ```ruby
- inspec_input "setting my input" do
- source "/path/to/my/input.yml"
- end
- ```
-
- Note that the inspec_input resource does not update and will not fire notifications (similar to the log resource). This is done to preserve the ability to use
- the resource while not causing the updated resource count to be larger than zero. Since the resource does not update the state of the node being managed this
- behavior is still consistent with the configuration management model. Events should be used to observe configuration changes for the compliance phase. It is
- possible to use the `notify_group` resource to chain notifications of the two resources, but notifications are the wrong model to use and pure ruby conditionals
- should be used instead. Compliance configuration should be independent of other resources and should only be made conditional based on state/attributes not
- on other resources.
+ ```ruby
+ inspec_input "setting my input" do
+ source "/path/to/my/input.yml"
+ end
+ ```
+
+ Note that the inspec_input resource does not update and will not fire notifications (similar to the log resource). This is done to preserve the ability to use
+ the resource while not causing the updated resource count to be larger than zero. Since the resource does not update the state of the node being managed this
+ behavior is still consistent with the configuration management model. Events should be used to observe configuration changes for the compliance phase. It is
+ possible to use the `notify_group` resource to chain notifications of the two resources, but notifications are the wrong model to use and pure ruby conditionals
+ should be used instead. Compliance configuration should be independent of other resources and should only be made conditional based on state/attributes not
+ on other resources.
DOC
property :name, [ Hash, String ]
diff --git a/lib/chef/resource/inspec_waiver.rb b/lib/chef/resource/inspec_waiver.rb
index 1643375755..c2ab11388d 100644
--- a/lib/chef/resource/inspec_waiver.rb
+++ b/lib/chef/resource/inspec_waiver.rb
@@ -25,88 +25,88 @@ class Chef
description "Use the **inspec_waiver** resource to add a waiver to the Compliance Phase."
introduced "17.5"
examples <<~DOC
- **Activate the default waiver in the openssh cookbook's compliance segment**:
+ **Activate the default waiver in the openssh cookbook's compliance segment**:
- ```ruby
- inspec_waiver 'openssh' do
- action :add
- end
- ```
+ ```ruby
+ inspec_waiver 'openssh' do
+ action :add
+ end
+ ```
- **Activate all waivers in the openssh cookbook's compliance segment**:
+ **Activate all waivers in the openssh cookbook's compliance segment**:
- ```ruby
- inspec_waiver 'openssh::.*' do
- action :add
- end
- ```
+ ```ruby
+ inspec_waiver 'openssh::.*' do
+ action :add
+ end
+ ```
- **Add an InSpec waiver to the Compliance Phase**:
+ **Add an InSpec waiver to the Compliance Phase**:
- ```ruby
- inspec_waiver 'Add waiver entry for control' do
- control 'my_inspec_control_01'
- run_test false
- justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
- expiration '2022-01-01'
- action :add
- end
- ```
+ ```ruby
+ inspec_waiver 'Add waiver entry for control' do
+ control 'my_inspec_control_01'
+ run_test false
+ justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
+ expiration '2022-01-01'
+ action :add
+ end
+ ```
- **Add an InSpec waiver to the Compliance Phase using the 'name' property to identify the control**:
+ **Add an InSpec waiver to the Compliance Phase using the 'name' property to identify the control**:
- ```ruby
- inspec_waiver 'my_inspec_control_01' do
- justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
- action :add
- end
- ```
+ ```ruby
+ inspec_waiver 'my_inspec_control_01' do
+ justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
+ action :add
+ end
+ ```
- **Add an InSpec waiver to the Compliance Phase using an arbitrary YAML, JSON or TOML file**:
+ **Add an InSpec waiver to the Compliance Phase using an arbitrary YAML, JSON or TOML file**:
- ```ruby
- # files ending in .yml or .yaml that exist are parsed as YAML
- inspec_waiver "/path/to/my/waiver.yml"
+ ```ruby
+ # files ending in .yml or .yaml that exist are parsed as YAML
+ inspec_waiver "/path/to/my/waiver.yml"
- inspec_waiver "my-waiver-name" do
- source "/path/to/my/waiver.yml"
- end
+ inspec_waiver "my-waiver-name" do
+ source "/path/to/my/waiver.yml"
+ end
- # files ending in .json that exist are parsed as JSON
- inspec_waiver "/path/to/my/waiver.json"
+ # files ending in .json that exist are parsed as JSON
+ inspec_waiver "/path/to/my/waiver.json"
- inspec_waiver "my-waiver-name" do
- source "/path/to/my/waiver.json"
- end
+ inspec_waiver "my-waiver-name" do
+ source "/path/to/my/waiver.json"
+ end
- # files ending in .toml that exist are parsed as TOML
- inspec_waiver "/path/to/my/waiver.toml"
+ # files ending in .toml that exist are parsed as TOML
+ inspec_waiver "/path/to/my/waiver.toml"
- inspec_waiver "my-waiver-name" do
- source "/path/to/my/waiver.toml"
- end
- ```
+ inspec_waiver "my-waiver-name" do
+ source "/path/to/my/waiver.toml"
+ end
+ ```
- **Add an InSpec waiver to the Compliance Phase using a hash**:
+ **Add an InSpec waiver to the Compliance Phase using a hash**:
- ```ruby
- my_hash = { "ssh-01" => {
- "expiration_date" => "2033-07-31",
- "run" => false,
- "justification" => "because"
- } }
+ ```ruby
+ my_hash = { "ssh-01" => {
+ "expiration_date" => "2033-07-31",
+ "run" => false,
+ "justification" => "because"
+ } }
- inspec_waiver "my-waiver-name" do
- source my_hash
- end
- ```
-
- Note that the inspec_waiver resource does not update and will not fire notifications (similar to the log resource). This is done to preserve the ability to use
- the resource while not causing the updated resource count to be larger than zero. Since the resource does not update the state of the node being managed this
- behavior is still consistent with the configuration management model. Events should be used to observe configuration changes for the compliance phase. It is
- possible to use the `notify_group` resource to chain notifications of the two resources, but notifications are the wrong model to use and pure ruby conditionals
- should be used instead. Compliance configuration should be independent of other resources and should only be made conditional based on state/attributes not
- on other resources.
+ inspec_waiver "my-waiver-name" do
+ source my_hash
+ end
+ ```
+
+ Note that the inspec_waiver resource does not update and will not fire notifications (similar to the log resource). This is done to preserve the ability to use
+ the resource while not causing the updated resource count to be larger than zero. Since the resource does not update the state of the node being managed this
+ behavior is still consistent with the configuration management model. Events should be used to observe configuration changes for the compliance phase. It is
+ possible to use the `notify_group` resource to chain notifications of the two resources, but notifications are the wrong model to use and pure ruby conditionals
+ should be used instead. Compliance configuration should be independent of other resources and should only be made conditional based on state/attributes not
+ on other resources.
DOC
property :control, String,
diff --git a/lib/chef/resource/inspec_waiver_file_entry.rb b/lib/chef/resource/inspec_waiver_file_entry.rb
index 5f81be73da..8442ad3ada 100644
--- a/lib/chef/resource/inspec_waiver_file_entry.rb
+++ b/lib/chef/resource/inspec_waiver_file_entry.rb
@@ -29,35 +29,35 @@ class Chef
description "Use the **inspec_waiver_file_entry** resource to add or remove entries from an InSpec waiver file. This can be used in conjunction with the Compliance Phase."
introduced "17.1"
examples <<~DOC
- **Add an InSpec waiver entry to a given waiver file**:
-
- ```ruby
- inspec_waiver_file_entry 'Add waiver entry for control' do
- file_path 'C:\\chef\\inspec_waiver_file.yml'
- control 'my_inspec_control_01'
- run_test false
- justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
- expiration '2022-01-01'
- action :add
- end
- ```
+ **Add an InSpec waiver entry to a given waiver file**:
+
+ ```ruby
+ inspec_waiver_file_entry 'Add waiver entry for control' do
+ file_path 'C:\\chef\\inspec_waiver_file.yml'
+ control 'my_inspec_control_01'
+ run_test false
+ justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
+ expiration '2022-01-01'
+ action :add
+ end
+ ```
- **Add an InSpec waiver entry to a given waiver file using the 'name' property to identify the control**:
+ **Add an InSpec waiver entry to a given waiver file using the 'name' property to identify the control**:
- ```ruby
- inspec_waiver_file_entry 'my_inspec_control_01' do
- justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
- action :add
- end
- ```
+ ```ruby
+ inspec_waiver_file_entry 'my_inspec_control_01' do
+ justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
+ action :add
+ end
+ ```
- **Remove an InSpec waiver entry to a given waiver file**:
+ **Remove an InSpec waiver entry to a given waiver file**:
- ```ruby
- inspec_waiver_file_entry "my_inspec_control_01" do
- action :remove
- end
- ```
+ ```ruby
+ inspec_waiver_file_entry "my_inspec_control_01" do
+ action :remove
+ end
+ ```
DOC
property :control, String,
diff --git a/lib/chef/resource/locale.rb b/lib/chef/resource/locale.rb
index 90377ef93a..504d8bfaed 100644
--- a/lib/chef/resource/locale.rb
+++ b/lib/chef/resource/locale.rb
@@ -28,13 +28,13 @@ class Chef
introduced "14.5"
examples <<~DOC
- Set the lang to 'en_US.UTF-8'
+ Set the lang to 'en_US.UTF-8'
- ```ruby
- locale 'set system locale' do
- lang 'en_US.UTF-8'
- end
- ```
+ ```ruby
+ locale 'set system locale' do
+ lang 'en_US.UTF-8'
+ end
+ ```
DOC
LC_VARIABLES ||= %w{LC_ADDRESS LC_COLLATE LC_CTYPE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME}.freeze
diff --git a/lib/chef/resource/mdadm.rb b/lib/chef/resource/mdadm.rb
index 86dbb0c42a..a10e248439 100644
--- a/lib/chef/resource/mdadm.rb
+++ b/lib/chef/resource/mdadm.rb
@@ -32,49 +32,49 @@ class Chef
" and then by using the mount provider to create a file systems table (fstab) entry."
examples <<~DOC
- **Create and assemble a RAID 0 array**
+ **Create and assemble a RAID 0 array**
- The mdadm command can be used to create RAID arrays. For example, a RAID 0 array named /dev/md0 with 10 devices would have a command similar to the following:
+ The mdadm command can be used to create RAID arrays. For example, a RAID 0 array named /dev/md0 with 10 devices would have a command similar to the following:
- ```
- mdadm --create /dev/md0 --level=0 --raid-devices=10 /dev/s01.../dev/s10
- ```
+ ```
+ mdadm --create /dev/md0 --level=0 --raid-devices=10 /dev/s01.../dev/s10
+ ```
- where /dev/s01 .. /dev/s10 represents 10 devices (01, 02, 03, and so on). This same command, when expressed as a recipe using the mdadm resource, would be similar to:
+ where /dev/s01 .. /dev/s10 represents 10 devices (01, 02, 03, and so on). This same command, when expressed as a recipe using the mdadm resource, would be similar to:
- ```ruby
- mdadm '/dev/md0' do
- devices [ '/dev/s01', ... '/dev/s10' ]
- level 0
- action :create
- end
- ```
+ ```ruby
+ mdadm '/dev/md0' do
+ devices [ '/dev/s01', ... '/dev/s10' ]
+ level 0
+ action :create
+ end
+ ```
- (again, where /dev/s01 .. /dev/s10 represents devices /dev/s01, /dev/s02, /dev/s03, and so on).
+ (again, where /dev/s01 .. /dev/s10 represents devices /dev/s01, /dev/s02, /dev/s03, and so on).
- **Create and assemble a RAID 1 array**
+ **Create and assemble a RAID 1 array**
- ```ruby
- mdadm '/dev/md0' do
- devices [ '/dev/sda', '/dev/sdb' ]
- level 1
- action [ :create, :assemble ]
- end
- ```
+ ```ruby
+ mdadm '/dev/md0' do
+ devices [ '/dev/sda', '/dev/sdb' ]
+ level 1
+ action [ :create, :assemble ]
+ end
+ ```
- **Create and assemble a RAID 5 array**
+ **Create and assemble a RAID 5 array**
- The mdadm command can be used to create RAID arrays. For example, a RAID 5 array named /dev/sd0 with 4, and a superblock type of 0.90 would be similar to:
+ The mdadm command can be used to create RAID arrays. For example, a RAID 5 array named /dev/sd0 with 4, and a superblock type of 0.90 would be similar to:
- ```ruby
- mdadm '/dev/sd0' do
- devices [ '/dev/s1', '/dev/s2', '/dev/s3', '/dev/s4' ]
- level 5
- metadata '0.90'
- chunk 32
- action :create
- end
- ```
+ ```ruby
+ mdadm '/dev/sd0' do
+ devices [ '/dev/s1', '/dev/s2', '/dev/s3', '/dev/s4' ]
+ level 5
+ metadata '0.90'
+ chunk 32
+ action :create
+ end
+ ```
DOC
default_action :create
diff --git a/lib/chef/resource/ohai.rb b/lib/chef/resource/ohai.rb
index 560a15353a..4d10ca2163 100644
--- a/lib/chef/resource/ohai.rb
+++ b/lib/chef/resource/ohai.rb
@@ -32,46 +32,46 @@ class Chef
description "Use the **ohai** resource to reload the Ohai configuration on a node. This allows recipes that change system attributes (like a recipe that adds a user) to refer to those attributes later on during the #{ChefUtils::Dist::Infra::PRODUCT} run."
examples <<~DOC
- Reload All Ohai Plugins
+ Reload All Ohai Plugins
- ```ruby
- ohai 'reload' do
- action :reload
- end
- ```
+ ```ruby
+ ohai 'reload' do
+ action :reload
+ end
+ ```
- Reload A Single Ohai Plugin
+ Reload A Single Ohai Plugin
- ```ruby
- ohai 'reload' do
- plugin 'ipaddress'
- action :reload
- end
- ```
+ ```ruby
+ ohai 'reload' do
+ plugin 'ipaddress'
+ action :reload
+ end
+ ```
- Reload Ohai after a new user is created
+ Reload Ohai after a new user is created
- ```ruby
- ohai 'reload_passwd' do
- action :nothing
- plugin 'etc'
- end
+ ```ruby
+ ohai 'reload_passwd' do
+ action :nothing
+ plugin 'etc'
+ end
- user 'daemon_user' do
- home '/dev/null'
- shell '/sbin/nologin'
- system true
- notifies :reload, 'ohai[reload_passwd]', :immediately
- end
+ user 'daemon_user' do
+ home '/dev/null'
+ shell '/sbin/nologin'
+ system true
+ notifies :reload, 'ohai[reload_passwd]', :immediately
+ end
- ruby_block 'just an example' do
- block do
- # These variables will now have the new values
- puts node['etc']['passwd']['daemon_user']['uid']
- puts node['etc']['passwd']['daemon_user']['gid']
+ ruby_block 'just an example' do
+ block do
+ # These variables will now have the new values
+ puts node['etc']['passwd']['daemon_user']['uid']
+ puts node['etc']['passwd']['daemon_user']['gid']
+ end
end
- end
- ```
+ ```
DOC
property :plugin, String,
diff --git a/lib/chef/resource/ohai_hint.rb b/lib/chef/resource/ohai_hint.rb
index 63ddc595c5..897cd1b2c5 100644
--- a/lib/chef/resource/ohai_hint.rb
+++ b/lib/chef/resource/ohai_hint.rb
@@ -27,37 +27,37 @@ class Chef
description "Use the **ohai_hint** resource to aid in configuration detection by passing hint data to Ohai."
introduced "14.0"
examples <<~DOC
- **Create a hint file**
+ **Create a hint file**
- ```ruby
- ohai_hint 'example' do
- content a: 'test_content'
- end
- ```
+ ```ruby
+ ohai_hint 'example' do
+ content a: 'test_content'
+ end
+ ```
- **Create a hint file with a name that does not match the resource name**
+ **Create a hint file with a name that does not match the resource name**
- ```ruby
- ohai_hint 'example' do
- hint_name 'custom'
- end
- ```
+ ```ruby
+ ohai_hint 'example' do
+ hint_name 'custom'
+ end
+ ```
- **Create a hint file that is not loaded at compile time**
+ **Create a hint file that is not loaded at compile time**
- ```ruby
- ohai_hint 'example' do
- compile_time false
- end
- ```
+ ```ruby
+ ohai_hint 'example' do
+ compile_time false
+ end
+ ```
- **Delete a hint file**
+ **Delete a hint file**
- ```ruby
- ohai_hint 'example' do
- action :delete
- end
- ```
+ ```ruby
+ ohai_hint 'example' do
+ action :delete
+ end
+ ```
DOC
property :hint_name, String,
diff --git a/lib/chef/resource/openssl_x509_crl.rb b/lib/chef/resource/openssl_x509_crl.rb
index ecf9778f25..14cbf0b1d0 100644
--- a/lib/chef/resource/openssl_x509_crl.rb
+++ b/lib/chef/resource/openssl_x509_crl.rb
@@ -31,24 +31,24 @@ class Chef
description "Use the **openssl_x509_crl** resource to generate PEM-formatted x509 certificate revocation list (CRL) files."
introduced "14.4"
examples <<~DOC
- **Create a certificate revocation file**
+ **Create a certificate revocation file**
- ```ruby
- openssl_x509_crl '/etc/ssl_test/my_ca.crl' do
- ca_cert_file '/etc/ssl_test/my_ca.crt'
- ca_key_file '/etc/ssl_test/my_ca.key'
- end
- ```
+ ```ruby
+ openssl_x509_crl '/etc/ssl_test/my_ca.crl' do
+ ca_cert_file '/etc/ssl_test/my_ca.crt'
+ ca_key_file '/etc/ssl_test/my_ca.key'
+ end
+ ```
- **Create a certificate revocation file for a particular serial**
+ **Create a certificate revocation file for a particular serial**
- ```ruby
- openssl_x509_crl '/etc/ssl_test/my_ca.crl' do
- ca_cert_file '/etc/ssl_test/my_ca.crt'
- ca_key_file '/etc/ssl_test/my_ca.key'
- serial_to_revoke C7BCB6602A2E4251EF4E2827A228CB52BC0CEA2F
- end
- ```
+ ```ruby
+ openssl_x509_crl '/etc/ssl_test/my_ca.crl' do
+ ca_cert_file '/etc/ssl_test/my_ca.crt'
+ ca_key_file '/etc/ssl_test/my_ca.key'
+ serial_to_revoke C7BCB6602A2E4251EF4E2827A228CB52BC0CEA2F
+ end
+ ```
DOC
property :path, String,
diff --git a/lib/chef/resource/osx_profile.rb b/lib/chef/resource/osx_profile.rb
index ebeb8e34ca..c88eaf09da 100644
--- a/lib/chef/resource/osx_profile.rb
+++ b/lib/chef/resource/osx_profile.rb
@@ -33,68 +33,68 @@ class Chef
description "Use the **osx_profile** resource to manage configuration profiles (`.mobileconfig` files) on the macOS platform. The **osx_profile** resource installs profiles by using the uuidgen library to generate a unique `ProfileUUID`, and then using the `profiles` command to install the profile on the system."
introduced "12.7"
examples <<~DOC
- **Install a profile from a cookbook file**
-
- ```ruby
- osx_profile 'com.company.screensaver.mobileconfig'
- ```
-
- **Install profile from a hash**
-
- ```ruby
- profile_hash = {
- 'PayloadIdentifier' => 'com.company.screensaver',
- 'PayloadRemovalDisallowed' => false,
- 'PayloadScope' => 'System',
- 'PayloadType' => 'Configuration',
- 'PayloadUUID' => '1781fbec-3325-565f-9022-8aa28135c3cc',
- 'PayloadOrganization' => 'Chef',
- 'PayloadVersion' => 1,
- 'PayloadDisplayName' => 'Screensaver Settings',
- 'PayloadContent' => [
- {
- 'PayloadType' => 'com.apple.ManagedClient.preferences',
- 'PayloadVersion' => 1,
- 'PayloadIdentifier' => 'com.company.screensaver',
- 'PayloadUUID' => '73fc30e0-1e57-0131-c32d-000c2944c108',
- 'PayloadEnabled' => true,
- 'PayloadDisplayName' => 'com.apple.screensaver',
- 'PayloadContent' => {
- 'com.apple.screensaver' => {
- 'Forced' => [
- {
- 'mcx_preference_settings' => {
- 'idleTime' => 0,
+ **Install a profile from a cookbook file**
+
+ ```ruby
+ osx_profile 'com.company.screensaver.mobileconfig'
+ ```
+
+ **Install profile from a hash**
+
+ ```ruby
+ profile_hash = {
+ 'PayloadIdentifier' => 'com.company.screensaver',
+ 'PayloadRemovalDisallowed' => false,
+ 'PayloadScope' => 'System',
+ 'PayloadType' => 'Configuration',
+ 'PayloadUUID' => '1781fbec-3325-565f-9022-8aa28135c3cc',
+ 'PayloadOrganization' => 'Chef',
+ 'PayloadVersion' => 1,
+ 'PayloadDisplayName' => 'Screensaver Settings',
+ 'PayloadContent' => [
+ {
+ 'PayloadType' => 'com.apple.ManagedClient.preferences',
+ 'PayloadVersion' => 1,
+ 'PayloadIdentifier' => 'com.company.screensaver',
+ 'PayloadUUID' => '73fc30e0-1e57-0131-c32d-000c2944c108',
+ 'PayloadEnabled' => true,
+ 'PayloadDisplayName' => 'com.apple.screensaver',
+ 'PayloadContent' => {
+ 'com.apple.screensaver' => {
+ 'Forced' => [
+ {
+ 'mcx_preference_settings' => {
+ 'idleTime' => 0,
+ },
},
- },
- ],
+ ],
+ },
},
},
- },
- ],
- }
+ ],
+ }
- osx_profile 'Install screensaver profile' do
- profile profile_hash
- end
- ```
+ osx_profile 'Install screensaver profile' do
+ profile profile_hash
+ end
+ ```
- **Remove profile using identifier in resource name**
+ **Remove profile using identifier in resource name**
- ```ruby
- osx_profile 'com.company.screensaver' do
- action :remove
- end
- ```
+ ```ruby
+ osx_profile 'com.company.screensaver' do
+ action :remove
+ end
+ ```
- **Remove profile by identifier and user friendly resource name**
+ **Remove profile by identifier and user friendly resource name**
- ```ruby
- osx_profile 'Remove screensaver profile' do
- identifier 'com.company.screensaver'
- action :remove
- end
- ```
+ ```ruby
+ osx_profile 'Remove screensaver profile' do
+ identifier 'com.company.screensaver'
+ action :remove
+ end
+ ```
DOC
property :profile_name, String,
diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb
index a643ad3344..b78a0c92d2 100644
--- a/lib/chef/resource/registry_key.rb
+++ b/lib/chef/resource/registry_key.rb
@@ -29,94 +29,94 @@ class Chef
description "Use the **registry_key** resource to create and delete registry keys in Microsoft Windows. Note: 64-bit versions of Microsoft Windows have a 32-bit compatibility layer in the registry that reflects and redirects certain keys (and their values) into specific locations (or logical views) of the registry hive.\n\n#{ChefUtils::Dist::Infra::PRODUCT} can access any reflected or redirected registry key. The machine architecture of the system on which #{ChefUtils::Dist::Infra::PRODUCT} is running is used as the default (non-redirected) location. Access to the SysWow64 location is redirected must be specified. Typically, this is only necessary to ensure compatibility with 32-bit applications that are running on a 64-bit operating system.\n\nFor more information, see: [Registry Reflection](https://docs.microsoft.com/en-us/windows/win32/winprog64/registry-reflection)."
examples <<~'DOC'
- **Create a registry key**
-
- ```ruby
- registry_key 'HKEY_LOCAL_MACHINE\\path-to-key\\Policies\\System' do
- values [{
- name: 'EnableLUA',
- type: :dword,
- data: 0
- }]
- action :create
- end
- ```
-
- **Create a registry key with binary data: "\x01\x02\x03"**:
-
- ```ruby
- registry_key 'HKEY_CURRENT_USER\ChefTest' do
- values [{
- :name => "test",
- :type => :binary,
- :data => [0, 1, 2].map(&:chr).join
- }]
- action :create
- end
- ```
+ **Create a registry key**
+
+ ```ruby
+ registry_key 'HKEY_LOCAL_MACHINE\\path-to-key\\Policies\\System' do
+ values [{
+ name: 'EnableLUA',
+ type: :dword,
+ data: 0
+ }]
+ action :create
+ end
+ ```
- **Create 32-bit key in redirected wow6432 tree**
+ **Create a registry key with binary data: "\x01\x02\x03"**:
- In 64-bit versions of Microsoft Windows, HKEY_LOCAL_MACHINE\SOFTWARE\Example is a re-directed key. In the following examples, because HKEY_LOCAL_MACHINE\SOFTWARE\Example is a 32-bit key, the output will be “Found 32-bit key” if they are run on a version of Microsoft Windows that is 64-bit:
+ ```ruby
+ registry_key 'HKEY_CURRENT_USER\ChefTest' do
+ values [{
+ :name => "test",
+ :type => :binary,
+ :data => [0, 1, 2].map(&:chr).join
+ }]
+ action :create
+ end
+ ```
- ```ruby
- registry_key 'HKEY_LOCAL_MACHINE\SOFTWARE\Example' do
- architecture :i386
- recursive true
- action :create
- end
- ```
-
- **Set proxy settings to be the same as those used by #{ChefUtils::Dist::Infra::PRODUCT}**
-
- ```ruby
- proxy = URI.parse(Chef::Config[:http_proxy])
- registry_key 'HKCU\Software\Microsoft\path\to\key\Internet Settings' do
- values [{name: 'ProxyEnable', type: :reg_dword, data: 1},
- {name: 'ProxyServer', data: "#{proxy.host}:#{proxy.port}"},
- {name: 'ProxyOverride', type: :reg_string, data: <local>},
- ]
- action :create
- end
- ```
+ **Create 32-bit key in redirected wow6432 tree**
- **Set the name of a registry key to "(Default)"**
+ In 64-bit versions of Microsoft Windows, HKEY_LOCAL_MACHINE\SOFTWARE\Example is a re-directed key. In the following examples, because HKEY_LOCAL_MACHINE\SOFTWARE\Example is a 32-bit key, the output will be “Found 32-bit key” if they are run on a version of Microsoft Windows that is 64-bit:
- ```ruby
- registry_key 'Set (Default) value' do
- key 'HKLM\Software\Test\Key\Path'
- values [
- {name: '', type: :string, data: 'test'},
- ]
- action :create
- end
- ```
+ ```ruby
+ registry_key 'HKEY_LOCAL_MACHINE\SOFTWARE\Example' do
+ architecture :i386
+ recursive true
+ action :create
+ end
+ ```
+
+ **Set proxy settings to be the same as those used by #{ChefUtils::Dist::Infra::PRODUCT}**
+
+ ```ruby
+ proxy = URI.parse(Chef::Config[:http_proxy])
+ registry_key 'HKCU\Software\Microsoft\path\to\key\Internet Settings' do
+ values [{name: 'ProxyEnable', type: :reg_dword, data: 1},
+ {name: 'ProxyServer', data: "#{proxy.host}:#{proxy.port}"},
+ {name: 'ProxyOverride', type: :reg_string, data: <local>},
+ ]
+ action :create
+ end
+ ```
- **Delete a registry key value**
+ **Set the name of a registry key to "(Default)"**
- ```ruby
- registry_key 'HKEY_LOCAL_MACHINE\SOFTWARE\path\to\key\AU' do
- values [{
- name: 'NoAutoRebootWithLoggedOnUsers',
- type: :dword,
- data: ''
- }]
- action :delete
- end
- ```
+ ```ruby
+ registry_key 'Set (Default) value' do
+ key 'HKLM\Software\Test\Key\Path'
+ values [
+ {name: '', type: :string, data: 'test'},
+ ]
+ action :create
+ end
+ ```
+
+ **Delete a registry key value**
+
+ ```ruby
+ registry_key 'HKEY_LOCAL_MACHINE\SOFTWARE\path\to\key\AU' do
+ values [{
+ name: 'NoAutoRebootWithLoggedOnUsers',
+ type: :dword,
+ data: ''
+ }]
+ action :delete
+ end
+ ```
- Note: If data: is not specified, you get an error: Missing data key in RegistryKey values hash
+ Note: If data: is not specified, you get an error: Missing data key in RegistryKey values hash
- **Delete a registry key and its subkeys, recursively**
+ **Delete a registry key and its subkeys, recursively**
- ```ruby
- registry_key 'HKCU\SOFTWARE\Policies\path\to\key\Themes' do
- recursive true
- action :delete_key
- end
- ```
+ ```ruby
+ registry_key 'HKCU\SOFTWARE\Policies\path\to\key\Themes' do
+ recursive true
+ action :delete_key
+ end
+ ```
- Note: Be careful when using the :delete_key action with the recursive attribute. This will delete the registry key, all of its values and all of the names, types, and data associated with them. This cannot be undone by #{ChefUtils::Dist::Infra::PRODUCT}.
+ Note: Be careful when using the :delete_key action with the recursive attribute. This will delete the registry key, all of its values and all of the names, types, and data associated with them. This cannot be undone by #{ChefUtils::Dist::Infra::PRODUCT}.
DOC
default_action :create
diff --git a/lib/chef/resource/remote_file.rb b/lib/chef/resource/remote_file.rb
index bd81b78f73..78614faeb4 100644
--- a/lib/chef/resource/remote_file.rb
+++ b/lib/chef/resource/remote_file.rb
@@ -35,75 +35,75 @@ class Chef
description "Use the **remote_file** resource to transfer a file from a remote location using file specificity. This resource is similar to the **file** resource. Note: Fetching files from the `files/` directory in a cookbook should be done with the **cookbook_file** resource."
examples <<~'DOC'
- **Download a file without checking the checksum**:
+ **Download a file without checking the checksum**:
- ```ruby
- remote_file '/tmp/remote.txt' do
- source 'https://example.org/remote.txt'
- end
- ```
+ ```ruby
+ remote_file '/tmp/remote.txt' do
+ source 'https://example.org/remote.txt'
+ end
+ ```
- **Download a file with a checksum to validate**:
+ **Download a file with a checksum to validate**:
- ```ruby
- remote_file '/tmp/test_file' do
- source 'http://www.example.com/tempfiles/test_file'
- mode '0755'
- checksum '3a7dac00b1' # A SHA256 (or portion thereof) of the file.
- end
- ```
+ ```ruby
+ remote_file '/tmp/test_file' do
+ source 'http://www.example.com/tempfiles/test_file'
+ mode '0755'
+ checksum '3a7dac00b1' # A SHA256 (or portion thereof) of the file.
+ end
+ ```
- **Download a file only if it's not already present**:
+ **Download a file only if it's not already present**:
- ```ruby
- remote_file '/tmp/remote.txt' do
- source 'https://example.org/remote.txt'
- checksum '3a7dac00b1' # A SHA256 (or portion thereof) of the file.
- action :create_if_missing
- end
- ```
+ ```ruby
+ remote_file '/tmp/remote.txt' do
+ source 'https://example.org/remote.txt'
+ checksum '3a7dac00b1' # A SHA256 (or portion thereof) of the file.
+ action :create_if_missing
+ end
+ ```
- **Using HTTP Basic Authentication in Headers**:
+ **Using HTTP Basic Authentication in Headers**:
- ```ruby
- remote_file '/tmp/remote.txt' do
- source 'https://example.org/remote.txt'
- headers('Authorization' => "Basic #{Base64.encode64("USERNAME_VALUE:PASSWORD_VALUE").delete("\n")}")
- checksum '3a7dac00b1' # A SHA256 (or portion thereof) of the file.
- action :create_if_missing
- end
- ```
+ ```ruby
+ remote_file '/tmp/remote.txt' do
+ source 'https://example.org/remote.txt'
+ headers('Authorization' => "Basic #{Base64.encode64("USERNAME_VALUE:PASSWORD_VALUE").delete("\n")}")
+ checksum '3a7dac00b1' # A SHA256 (or portion thereof) of the file.
+ action :create_if_missing
+ end
+ ```
- **Downloading a file to the Chef file cache dir for execution**:
+ **Downloading a file to the Chef file cache dir for execution**:
- ```ruby
- remote_file '#{Chef::Config['file_cache_path']}/install.sh' do
- source 'https://example.org/install.sh'
- action :create_if_missing
- end
+ ```ruby
+ remote_file '#{Chef::Config['file_cache_path']}/install.sh' do
+ source 'https://example.org/install.sh'
+ action :create_if_missing
+ end
- execute '#{Chef::Config['file_cache_path']}/install.sh'
- ```
-
- **Specify advanced HTTP connection options including Net::HTTP (nethttp) options:**
-
- ```ruby
- remote_file '/tmp/remote.txt' do
- source 'https://example.org/remote.txt'
- http_options({
- http_retry_delay: 0,
- http_retry_count: 0,
- keepalives: false,
- nethttp: {
- continue_timeout: 5,
- max_retries: 5,
- read_timeout: 5,
- write_timeout: 5,
- ssl_timeout: 5,
- },
- })
- end
- ```
+ execute '#{Chef::Config['file_cache_path']}/install.sh'
+ ```
+
+ **Specify advanced HTTP connection options including Net::HTTP (nethttp) options:**
+
+ ```ruby
+ remote_file '/tmp/remote.txt' do
+ source 'https://example.org/remote.txt'
+ http_options({
+ http_retry_delay: 0,
+ http_retry_count: 0,
+ keepalives: false,
+ nethttp: {
+ continue_timeout: 5,
+ max_retries: 5,
+ read_timeout: 5,
+ write_timeout: 5,
+ ssl_timeout: 5,
+ },
+ })
+ end
+ ```
DOC
def initialize(name, run_context = nil)
@@ -169,23 +169,23 @@ class Chef
property :headers, Hash, default: {},
description: <<~'DOCS'
- A Hash of custom headers. For example:
+ A Hash of custom headers. For example:
- ```ruby
- headers({ "Cookie" => "user=some_user; pass=p@ssw0rd!" })
- ```
+ ```ruby
+ headers({ "Cookie" => "user=some_user; pass=p@ssw0rd!" })
+ ```
- or:
+ or:
- ```ruby
- headers({ "Referer" => "#{header}" })
- ```
+ ```ruby
+ headers({ "Referer" => "#{header}" })
+ ```
- or:
+ or:
- ```ruby
- headers( "Authorization"=>"Basic #{ Base64.encode64("#{username}:#{password}").gsub("\n", "") }" )
- ```
+ ```ruby
+ headers( "Authorization"=>"Basic #{ Base64.encode64("#{username}:#{password}").gsub("\n", "") }" )
+ ```
DOCS
property :show_progress, [ TrueClass, FalseClass ],
diff --git a/lib/chef/resource/scm/git.rb b/lib/chef/resource/scm/git.rb
index af49704ee6..fc5fb412c6 100644
--- a/lib/chef/resource/scm/git.rb
+++ b/lib/chef/resource/scm/git.rb
@@ -29,85 +29,85 @@ class Chef
description "Use the **git** resource to manage source control resources that exist in a git repository. git version 1.6.5 (or higher) is required to use all of the functionality in the git resource."
examples <<~DOC
- **Use the git mirror**
-
- ```ruby
- git '/opt/my_sources/couch' do
- repository 'git://git.apache.org/couchdb.git'
- revision 'master'
- action :sync
- end
- ```
-
- **Use different branches**
-
- To use different branches, depending on the environment of the node:
-
- ```ruby
- branch_name = if node.chef_environment == 'QA'
- 'staging'
- else
- 'master'
- end
-
- git '/home/user/deployment' do
- repository 'git@github.com:git_site/deployment.git'
- revision branch_name
- action :sync
- user 'user'
- group 'test'
- end
- ```
-
- Where the `branch_name` variable is set to staging or master, depending on the environment of the node. Once this is determined, the `branch_name` variable is used to set the revision for the repository. If the git status command is used after running the example above, it will return the branch name as `deploy`, as this is the default value. Run Chef Infra Client in debug mode to verify that the correct branches are being checked out:
-
- ```
- sudo chef-client -l debug
- ```
-
- **Install an application from git using bash**
-
- The following example shows how Bash can be used to install a plug-in for rbenv named ruby-build, which is located in git version source control. First, the application is synchronized, and then Bash changes its working directory to the location in which ruby-build is located, and then runs a command.
-
- ```ruby
- git "#{Chef::Config[:file_cache_path]}/ruby-build" do
- repository 'git://github.com/rbenv/ruby-build.git'
- revision 'master'
- action :sync
- end
-
- bash 'install_ruby_build' do
- cwd "#{Chef::Config[:file_cache_path]}/ruby-build"
- user 'rbenv'
- group 'rbenv'
- code <<-EOH
- ./install.sh
- EOH
- environment 'PREFIX' => '/usr/local'
- end
- ```
-
- **Notify a resource post-checkout**
-
- ```ruby
- git "#{Chef::Config[:file_cache_path]}/my_app" do
- repository node['my_app']['git_repository']
- revision node['my_app']['git_revision']
- action :sync
- notifies :run, 'bash[compile_my_app]', :immediately
- end
- ```
-
- **Pass in environment variables**
-
- ```ruby
- git '/opt/my_sources/couch' do
- repository 'git://git.apache.org/couchdb.git'
- revision 'master'
- environment 'VAR' => 'whatever'
- action :sync
- end
- ```
+ **Use the git mirror**
+
+ ```ruby
+ git '/opt/my_sources/couch' do
+ repository 'git://git.apache.org/couchdb.git'
+ revision 'master'
+ action :sync
+ end
+ ```
+
+ **Use different branches**
+
+ To use different branches, depending on the environment of the node:
+
+ ```ruby
+ branch_name = if node.chef_environment == 'QA'
+ 'staging'
+ else
+ 'master'
+ end
+
+ git '/home/user/deployment' do
+ repository 'git@github.com:git_site/deployment.git'
+ revision branch_name
+ action :sync
+ user 'user'
+ group 'test'
+ end
+ ```
+
+ Where the `branch_name` variable is set to staging or master, depending on the environment of the node. Once this is determined, the `branch_name` variable is used to set the revision for the repository. If the git status command is used after running the example above, it will return the branch name as `deploy`, as this is the default value. Run Chef Infra Client in debug mode to verify that the correct branches are being checked out:
+
+ ```
+ sudo chef-client -l debug
+ ```
+
+ **Install an application from git using bash**
+
+ The following example shows how Bash can be used to install a plug-in for rbenv named ruby-build, which is located in git version source control. First, the application is synchronized, and then Bash changes its working directory to the location in which ruby-build is located, and then runs a command.
+
+ ```ruby
+ git "#{Chef::Config[:file_cache_path]}/ruby-build" do
+ repository 'git://github.com/rbenv/ruby-build.git'
+ revision 'master'
+ action :sync
+ end
+
+ bash 'install_ruby_build' do
+ cwd "#{Chef::Config[:file_cache_path]}/ruby-build"
+ user 'rbenv'
+ group 'rbenv'
+ code <<-EOH
+ ./install.sh
+ EOH
+ environment 'PREFIX' => '/usr/local'
+ end
+ ```
+
+ **Notify a resource post-checkout**
+
+ ```ruby
+ git "#{Chef::Config[:file_cache_path]}/my_app" do
+ repository node['my_app']['git_repository']
+ revision node['my_app']['git_revision']
+ action :sync
+ notifies :run, 'bash[compile_my_app]', :immediately
+ end
+ ```
+
+ **Pass in environment variables**
+
+ ```ruby
+ git '/opt/my_sources/couch' do
+ repository 'git://git.apache.org/couchdb.git'
+ revision 'master'
+ environment 'VAR' => 'whatever'
+ action :sync
+ end
+ ```
DOC
property :additional_remotes, Hash,
diff --git a/lib/chef/resource/scm/subversion.rb b/lib/chef/resource/scm/subversion.rb
index 7216aa53dd..4d20b4e34a 100644
--- a/lib/chef/resource/scm/subversion.rb
+++ b/lib/chef/resource/scm/subversion.rb
@@ -30,16 +30,16 @@ class Chef
description "Use the **subversion** resource to manage source control resources that exist in a Subversion repository. Warning: The subversion resource has known bugs and may not work as expected. For more information see Chef GitHub issues, particularly [#4050](https://github.com/chef/chef/issues/4050) and [#4257](https://github.com/chef/chef/issues/4257)."
examples <<~DOC
- **Get the latest version of an application**
+ **Get the latest version of an application**
- ```ruby
- subversion 'CouchDB Edge' do
- repository 'http://svn.apache.org/repos/asf/couchdb/trunk'
- revision 'HEAD'
- destination '/opt/my_sources/couch'
- action :sync
- end
- ```
+ ```ruby
+ subversion 'CouchDB Edge' do
+ repository 'http://svn.apache.org/repos/asf/couchdb/trunk'
+ revision 'HEAD'
+ destination '/opt/my_sources/couch'
+ action :sync
+ end
+ ```
DOC
allowed_actions :force_export
diff --git a/lib/chef/resource/ssh_known_hosts_entry.rb b/lib/chef/resource/ssh_known_hosts_entry.rb
index a8d45f4c12..464de936ec 100644
--- a/lib/chef/resource/ssh_known_hosts_entry.rb
+++ b/lib/chef/resource/ssh_known_hosts_entry.rb
@@ -30,19 +30,19 @@ class Chef
description "Use the **ssh_known_hosts_entry** resource to add an entry for the specified host in /etc/ssh/ssh_known_hosts or a user's known hosts file if specified."
introduced "14.3"
examples <<~DOC
- **Add a single entry for github.com with the key auto detected**
+ **Add a single entry for github.com with the key auto detected**
- ```ruby
- ssh_known_hosts_entry 'github.com'
- ```
+ ```ruby
+ ssh_known_hosts_entry 'github.com'
+ ```
- **Add a single entry with your own provided key**
+ **Add a single entry with your own provided key**
- ```ruby
- ssh_known_hosts_entry 'github.com' do
- key 'node.example.com ssh-rsa ...'
- end
- ```
+ ```ruby
+ ssh_known_hosts_entry 'github.com' do
+ key 'node.example.com ssh-rsa ...'
+ end
+ ```
DOC
property :host, String,
diff --git a/lib/chef/resource/sudo.rb b/lib/chef/resource/sudo.rb
index d028af80bf..b882eea76f 100644
--- a/lib/chef/resource/sudo.rb
+++ b/lib/chef/resource/sudo.rb
@@ -35,31 +35,31 @@ class Chef
" and RHEL (6+) all support this feature."
introduced "14.0"
examples <<~DOC
- **Grant a user sudo privileges for any command**
+ **Grant a user sudo privileges for any command**
- ```ruby
- sudo 'admin' do
- user 'admin'
- end
- ```
+ ```ruby
+ sudo 'admin' do
+ user 'admin'
+ end
+ ```
- **Grant a user and groups sudo privileges for any command**
+ **Grant a user and groups sudo privileges for any command**
- ```ruby
- sudo 'admins' do
- users 'bob'
- groups 'sysadmins, superusers'
- end
- ```
+ ```ruby
+ sudo 'admins' do
+ users 'bob'
+ groups 'sysadmins, superusers'
+ end
+ ```
- **Grant passwordless sudo privileges for specific commands**
+ **Grant passwordless sudo privileges for specific commands**
- ```ruby
- sudo 'passwordless-access' do
- commands ['/bin/systemctl restart httpd', '/bin/systemctl restart mysql']
- nopasswd true
- end
- ```
+ ```ruby
+ sudo 'passwordless-access' do
+ commands ['/bin/systemctl restart httpd', '/bin/systemctl restart mysql']
+ nopasswd true
+ end
+ ```
DOC
# According to the sudo man pages sudo will ignore files in an include dir that have a `.` or `~`
diff --git a/lib/chef/resource/swap_file.rb b/lib/chef/resource/swap_file.rb
index bd2c7bf632..a0aebcbabd 100644
--- a/lib/chef/resource/swap_file.rb
+++ b/lib/chef/resource/swap_file.rb
@@ -27,21 +27,21 @@ class Chef
description "Use the **swap_file** resource to create or delete swap files on Linux systems, and optionally to manage the swappiness configuration for a host."
introduced "14.0"
examples <<~DOC
- **Create a swap file**
+ **Create a swap file**
- ```ruby
- swap_file '/dev/sda1' do
- size 1024
- end
- ```
+ ```ruby
+ swap_file '/dev/sda1' do
+ size 1024
+ end
+ ```
- **Remove a swap file**
+ **Remove a swap file**
- ```ruby
- swap_file '/dev/sda1' do
- action :remove
- end
- ```
+ ```ruby
+ swap_file '/dev/sda1' do
+ action :remove
+ end
+ ```
DOC
property :path, String,
diff --git a/lib/chef/resource/sysctl.rb b/lib/chef/resource/sysctl.rb
index 8604590d46..69032761a6 100644
--- a/lib/chef/resource/sysctl.rb
+++ b/lib/chef/resource/sysctl.rb
@@ -27,63 +27,63 @@ class Chef
description "Use the **sysctl** resource to set or remove kernel parameters using the `sysctl` command line tool and configuration files in the system's `sysctl.d` directory. Configuration files managed by this resource are named `99-chef-KEYNAME.conf`."
examples <<~DOC
- **Set vm.swappiness**:
+ **Set vm.swappiness**:
- ```ruby
- sysctl 'vm.swappiness' do
- value 19
- end
- ```
+ ```ruby
+ sysctl 'vm.swappiness' do
+ value 19
+ end
+ ```
- **Remove kernel.msgmax**:
+ **Remove kernel.msgmax**:
- **Note**: This only removes the sysctl.d config for kernel.msgmax. The value will be set back to the kernel default value.
+ **Note**: This only removes the sysctl.d config for kernel.msgmax. The value will be set back to the kernel default value.
- ```ruby
- sysctl 'kernel.msgmax' do
- action :remove
- end
- ```
+ ```ruby
+ sysctl 'kernel.msgmax' do
+ action :remove
+ end
+ ```
- **Adding Comments to sysctl configuration files**:
+ **Adding Comments to sysctl configuration files**:
- ```ruby
- sysctl 'vm.swappiness' do
- value 19
- comment "define how aggressively the kernel will swap memory pages."
- end
- ```
+ ```ruby
+ sysctl 'vm.swappiness' do
+ value 19
+ comment "define how aggressively the kernel will swap memory pages."
+ end
+ ```
- This produces /etc/sysctl.d/99-chef-vm.swappiness.conf as follows:
+ This produces /etc/sysctl.d/99-chef-vm.swappiness.conf as follows:
- ```
- # define how aggressively the kernel will swap memory pages.
- vm.swappiness = 1
- ```
+ ```
+ # define how aggressively the kernel will swap memory pages.
+ vm.swappiness = 1
+ ```
- **Converting sysctl settings from shell scripts**:
+ **Converting sysctl settings from shell scripts**:
- Example of existing settings:
+ Example of existing settings:
- ```bash
- fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500 kernel.sem = 250 32000 100 128
- ```
+ ```bash
+ fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500 kernel.sem = 250 32000 100 128
+ ```
- Converted to sysctl resources:
+ Converted to sysctl resources:
- ```ruby
- sysctl 'fs.aio-max-nr' do
- value '1048576'
- end
+ ```ruby
+ sysctl 'fs.aio-max-nr' do
+ value '1048576'
+ end
- sysctl 'net.ipv4.ip_local_port_range' do
- value '9000 65500'
- end
+ sysctl 'net.ipv4.ip_local_port_range' do
+ value '9000 65500'
+ end
- sysctl 'kernel.sem' do
- value '250 32000 100 128'
- end
- ```
+ sysctl 'kernel.sem' do
+ value '250 32000 100 128'
+ end
+ ```
DOC
introduced "14.0"
diff --git a/lib/chef/resource/systemd_unit.rb b/lib/chef/resource/systemd_unit.rb
index 61294d833d..c802ab71dc 100644
--- a/lib/chef/resource/systemd_unit.rb
+++ b/lib/chef/resource/systemd_unit.rb
@@ -30,45 +30,45 @@ class Chef
description "Use the **systemd_unit** resource to create, manage, and run [systemd units](https://www.freedesktop.org/software/systemd/man/systemd.html#Concepts)."
introduced "12.11"
examples <<~DOC
- **Create systemd service unit file from a Hash**
-
- ```ruby
- systemd_unit 'etcd.service' do
- content({ Unit: {
- Description: 'Etcd',
- Documentation: ['https://coreos.com/etcd', 'man:etcd(1)'],
- After: 'network.target',
- },
- Service: {
- Type: 'notify',
- ExecStart: '/usr/local/etcd',
- Restart: 'always',
- },
- Install: {
- WantedBy: 'multi-user.target',
- } })
- action [:create, :enable]
- end
- ```
+ **Create systemd service unit file from a Hash**
+
+ ```ruby
+ systemd_unit 'etcd.service' do
+ content({ Unit: {
+ Description: 'Etcd',
+ Documentation: ['https://coreos.com/etcd', 'man:etcd(1)'],
+ After: 'network.target',
+ },
+ Service: {
+ Type: 'notify',
+ ExecStart: '/usr/local/etcd',
+ Restart: 'always',
+ },
+ Install: {
+ WantedBy: 'multi-user.target',
+ } })
+ action [:create, :enable]
+ end
+ ```
- **Create systemd service unit file from a String**
+ **Create systemd service unit file from a String**
- ```ruby
- systemd_unit 'sysstat-collect.timer' do
- content <<~EOU
- [Unit]
- Description=Run system activity accounting tool every 10 minutes
+ ```ruby
+ systemd_unit 'sysstat-collect.timer' do
+ content <<~EOU
+ [Unit]
+ Description=Run system activity accounting tool every 10 minutes
- [Timer]
- OnCalendar=*:00/10
+ [Timer]
+ OnCalendar=*:00/10
- [Install]
- WantedBy=sysstat.service
- EOU
+ [Install]
+ WantedBy=sysstat.service
+ EOU
- action [:create, :enable]
- end
- ```
+ action [:create, :enable]
+ end
+ ```
DOC
default_action :nothing
diff --git a/lib/chef/resource/timezone.rb b/lib/chef/resource/timezone.rb
index f879c9577a..94100d1271 100644
--- a/lib/chef/resource/timezone.rb
+++ b/lib/chef/resource/timezone.rb
@@ -29,27 +29,27 @@ class Chef
description "Use the **timezone** resource to change the system timezone on Windows, Linux, and macOS hosts. Timezones are specified in tz database format, with a complete list of available TZ values for Linux and macOS here: <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>. On Windows systems run `tzutil /l` for a complete list of valid timezones."
introduced "14.6"
examples <<~DOC
- **Set the timezone to UTC**
+ **Set the timezone to UTC**
- ```ruby
- timezone 'UTC'
- ```
+ ```ruby
+ timezone 'UTC'
+ ```
- **Set the timezone to America/Los_Angeles with a friendly resource name on Linux/macOS**
+ **Set the timezone to America/Los_Angeles with a friendly resource name on Linux/macOS**
- ```ruby
- timezone "Set the host's timezone to America/Los_Angeles" do
- timezone 'America/Los_Angeles'
- end
- ```
+ ```ruby
+ timezone "Set the host's timezone to America/Los_Angeles" do
+ timezone 'America/Los_Angeles'
+ end
+ ```
- **Set the timezone to PST with a friendly resource name on Windows**
+ **Set the timezone to PST with a friendly resource name on Windows**
- ```ruby
- timezone "Set the host's timezone to PST" do
- timezone 'Pacific Standard time'
- end
- ```
+ ```ruby
+ timezone "Set the host's timezone to PST" do
+ timezone 'Pacific Standard time'
+ end
+ ```
DOC
property :timezone, String,
diff --git a/lib/chef/resource/user_ulimit.rb b/lib/chef/resource/user_ulimit.rb
index 594b585dbf..52dddcc5c5 100644
--- a/lib/chef/resource/user_ulimit.rb
+++ b/lib/chef/resource/user_ulimit.rb
@@ -29,31 +29,31 @@ class Chef
description "Use the **user_ulimit** resource to create individual ulimit files that are installed into the `/etc/security/limits.d/` directory."
introduced "16.0"
examples <<~DOC
- **Set filehandle limit for the tomcat user**:
+ **Set filehandle limit for the tomcat user**:
- ```ruby
- user_ulimit 'tomcat' do
- filehandle_limit 8192
- end
- ```
+ ```ruby
+ user_ulimit 'tomcat' do
+ filehandle_limit 8192
+ end
+ ```
- **Specify a username that differs from the name given to the resource block**:
+ **Specify a username that differs from the name given to the resource block**:
- ```ruby
- user_ulimit 'Bump filehandle limits for tomcat user' do
- username 'tomcat'
- filehandle_limit 8192
- end
- ```
+ ```ruby
+ user_ulimit 'Bump filehandle limits for tomcat user' do
+ username 'tomcat'
+ filehandle_limit 8192
+ end
+ ```
- **Set filehandle limit for the tomcat user with a non-default filename**:
+ **Set filehandle limit for the tomcat user with a non-default filename**:
- ```ruby
- user_ulimit 'tomcat' do
- filehandle_limit 8192
- filename 'tomcat_filehandle_limits.conf'
- end
- ```
+ ```ruby
+ user_ulimit 'tomcat' do
+ filehandle_limit 8192
+ filename 'tomcat_filehandle_limits.conf'
+ end
+ ```
DOC
property :username, String, name_property: true
diff --git a/lib/chef/resource/windows_ad_join.rb b/lib/chef/resource/windows_ad_join.rb
index e285e1cf1e..26da5fb725 100644
--- a/lib/chef/resource/windows_ad_join.rb
+++ b/lib/chef/resource/windows_ad_join.rb
@@ -28,33 +28,33 @@ class Chef
description "Use the **windows_ad_join** resource to join a Windows Active Directory domain."
introduced "14.0"
examples <<~DOC
- **Join a domain**
+ **Join a domain**
- ```ruby
- windows_ad_join 'ad.example.org' do
- domain_user 'nick'
- domain_password 'p@ssw0rd1'
- end
- ```
+ ```ruby
+ windows_ad_join 'ad.example.org' do
+ domain_user 'nick'
+ domain_password 'p@ssw0rd1'
+ end
+ ```
- **Join a domain, as `win-workstation`**
+ **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
- ```
+ ```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**
+ **Leave the current domain and re-join the `local` workgroup**
- ```ruby
- windows_ad_join 'Leave domain' do
- action :leave
- workgroup 'local'
- end
- ```
+ ```ruby
+ windows_ad_join 'Leave domain' do
+ action :leave
+ workgroup 'local'
+ end
+ ```
DOC
property :domain_name, String,
diff --git a/lib/chef/resource/windows_audit_policy.rb b/lib/chef/resource/windows_audit_policy.rb
index b1fcbe2e44..2913302ea9 100644
--- a/lib/chef/resource/windows_audit_policy.rb
+++ b/lib/chef/resource/windows_audit_policy.rb
@@ -91,36 +91,36 @@ class Chef
introduced "16.2"
examples <<~DOC
- **Set Logon and Logoff policy to "Success and Failure"**:
-
- ```ruby
- windows_audit_policy "Set Audit Policy for 'Logon and Logoff' actions to 'Success and Failure'" do
- subcategory %w(Logon Logoff)
- success true
- failure true
- action :set
- end
- ```
+ **Set Logon and Logoff policy to "Success and Failure"**:
+
+ ```ruby
+ windows_audit_policy "Set Audit Policy for 'Logon and Logoff' actions to 'Success and Failure'" do
+ subcategory %w(Logon Logoff)
+ success true
+ failure true
+ action :set
+ end
+ ```
- **Set Credential Validation policy to "Success"**:
+ **Set Credential Validation policy to "Success"**:
- ```ruby
- windows_audit_policy "Set Audit Policy for 'Credential Validation' actions to 'Success'" do
- subcategory 'Credential Validation'
- success true
- failure false
- action :set
- end
- ```
+ ```ruby
+ windows_audit_policy "Set Audit Policy for 'Credential Validation' actions to 'Success'" do
+ subcategory 'Credential Validation'
+ success true
+ failure false
+ action :set
+ end
+ ```
- **Enable CrashOnAuditFail option**:
+ **Enable CrashOnAuditFail option**:
- ```ruby
- windows_audit_policy 'Enable CrashOnAuditFail option' do
- crash_on_audit_fail true
- action :set
- end
- ```
+ ```ruby
+ windows_audit_policy 'Enable CrashOnAuditFail option' do
+ crash_on_audit_fail true
+ action :set
+ end
+ ```
DOC
property :subcategory, [String, Array],
diff --git a/lib/chef/resource/windows_auto_run.rb b/lib/chef/resource/windows_auto_run.rb
index 9e46b58b53..aef7b5f382 100644
--- a/lib/chef/resource/windows_auto_run.rb
+++ b/lib/chef/resource/windows_auto_run.rb
@@ -28,15 +28,15 @@ 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**
+ **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
- ```
+ ```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,
diff --git a/lib/chef/resource/windows_certificate.rb b/lib/chef/resource/windows_certificate.rb
index 528b0c53f6..75664bd8f5 100644
--- a/lib/chef/resource/windows_certificate.rb
+++ b/lib/chef/resource/windows_certificate.rb
@@ -36,30 +36,30 @@ 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**
+ **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
- ```
+ ```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**
+ **Add cert to trusted intermediate store**
- ```ruby
- windows_certificate 'c:/test/mycert.cer' do
- store_name 'CA'
- end
- ```
+ ```ruby
+ windows_certificate 'c:/test/mycert.cer' do
+ store_name 'CA'
+ end
+ ```
- **Remove all certificates matching the subject**
+ **Remove all certificates matching the subject**
- ```ruby
- windows_certificate 'me.acme.com' do
- action :delete
- end
- ```
+ ```ruby
+ windows_certificate 'me.acme.com' do
+ action :delete
+ end
+ ```
DOC
property :source, String,
diff --git a/lib/chef/resource/windows_defender.rb b/lib/chef/resource/windows_defender.rb
index bdb599d82f..0b87d4fc2d 100644
--- a/lib/chef/resource/windows_defender.rb
+++ b/lib/chef/resource/windows_defender.rb
@@ -25,30 +25,30 @@ class Chef
description "Use the **windows_defender** resource to enable or disable the Microsoft Windows Defender service."
introduced "17.3"
examples <<~DOC
- **Configure Windows Defender AV settings**:
-
- ```ruby
- windows_defender 'Configure Defender' do
- realtime_protection true
- intrusion_protection_system true
- lock_ui true
- scan_archives true
- scan_scripts true
- scan_email true
- scan_removable_drives true
- scan_network_files false
- scan_mapped_drives false
- action :enable
- end
- ```
+ **Configure Windows Defender AV settings**:
+
+ ```ruby
+ windows_defender 'Configure Defender' do
+ realtime_protection true
+ intrusion_protection_system true
+ lock_ui true
+ scan_archives true
+ scan_scripts true
+ scan_email true
+ scan_removable_drives true
+ scan_network_files false
+ scan_mapped_drives false
+ action :enable
+ end
+ ```
- **Disable Windows Defender AV**:
+ **Disable Windows Defender AV**:
- ```ruby
- windows_defender 'Disable Defender' do
- action :disable
- end
- ```
+ ```ruby
+ windows_defender 'Disable Defender' do
+ action :disable
+ end
+ ```
DOC
# DisableIOAVProtection
diff --git a/lib/chef/resource/windows_defender_exclusion.rb b/lib/chef/resource/windows_defender_exclusion.rb
index 6df7ce38c8..697695933e 100644
--- a/lib/chef/resource/windows_defender_exclusion.rb
+++ b/lib/chef/resource/windows_defender_exclusion.rb
@@ -25,25 +25,25 @@ class Chef
description "Use the **windows_defender_exclusion** resource to exclude paths, processes, or file types from Windows Defender realtime protection scanning."
introduced "17.3"
examples <<~DOC
- **Add excluded items to Windows Defender scans**:
-
- ```ruby
- windows_defender_exclusion 'Add to things to be excluded from scanning' do
- paths 'c:\\foo\\bar, d:\\bar\\baz'
- extensions 'png, foo, ppt, doc'
- process_paths 'c:\\windows\\system32'
- action :add
- end
- ```
+ **Add excluded items to Windows Defender scans**:
+
+ ```ruby
+ windows_defender_exclusion 'Add to things to be excluded from scanning' do
+ paths 'c:\\foo\\bar, d:\\bar\\baz'
+ extensions 'png, foo, ppt, doc'
+ process_paths 'c:\\windows\\system32'
+ action :add
+ end
+ ```
- **Remove excluded items from Windows Defender scans**:
+ **Remove excluded items from Windows Defender scans**:
- ```ruby
- windows_defender_exclusion 'Remove things from the list to be excluded' do
- process_paths 'c:\\windows\\system32'
- action :remove
- end
- ```
+ ```ruby
+ windows_defender_exclusion 'Remove things from the list to be excluded' do
+ process_paths 'c:\\windows\\system32'
+ action :remove
+ end
+ ```
DOC
unified_mode true
diff --git a/lib/chef/resource/windows_env.rb b/lib/chef/resource/windows_env.rb
index c8385ecc1b..bb76f88051 100644
--- a/lib/chef/resource/windows_env.rb
+++ b/lib/chef/resource/windows_env.rb
@@ -31,13 +31,13 @@ class Chef
description "Use the **windows_env** resource to manage environment keys in Microsoft Windows. After an environment key is set, Microsoft Windows must be restarted before the environment key will be available to the Task Scheduler.\n\nThis resource was previously called the **env** resource; its name was updated in #{ChefUtils::Dist::Infra::PRODUCT} 14.0 to reflect the fact that only Windows is supported. Existing cookbooks using `env` will continue to function, but should be updated to use the new name. Note: On UNIX-based systems, the best way to manipulate environment keys is with the `ENV` variable in Ruby; however, this approach does not have the same permanent effect as using the windows_env resource."
examples <<~DOC
- **Set an environment variable**:
+ **Set an environment variable**:
- ```ruby
- windows_env 'ComSpec' do
- value 'C:\\Windows\\system32\\cmd.exe'
- end
- ```
+ ```ruby
+ windows_env 'ComSpec' do
+ value 'C:\\Windows\\system32\\cmd.exe'
+ end
+ ```
DOC
default_action :create
diff --git a/lib/chef/resource/windows_feature.rb b/lib/chef/resource/windows_feature.rb
index ae71b299fe..4717f73814 100644
--- a/lib/chef/resource/windows_feature.rb
+++ b/lib/chef/resource/windows_feature.rb
@@ -28,59 +28,59 @@ class Chef
description "Use the **windows_feature** resource to add, remove or entirely delete Windows features and roles. This resource calls the 'windows_feature_dism' or 'windows_feature_powershell' resources depending on the specified installation method, and defaults to DISM, which is available on both Workstation and Server editions of Windows."
introduced "14.0"
examples <<~DOC
- **Install the DHCP Server feature**:
+ **Install the DHCP Server feature**:
- ```ruby
- windows_feature 'DHCPServer' do
- action :install
- end
- ```
+ ```ruby
+ windows_feature 'DHCPServer' do
+ action :install
+ end
+ ```
- **Install the .Net 3.5.1 feature using repository files on DVD**:
+ **Install the .Net 3.5.1 feature using repository files on DVD**:
- ```ruby
- windows_feature "NetFx3" do
- action :install
- source 'd:\\sources\\sxs'
- end
- ```
+ ```ruby
+ windows_feature "NetFx3" do
+ action :install
+ source 'd:\\sources\\sxs'
+ end
+ ```
- **Remove Telnet Server and Client features**:
+ **Remove Telnet Server and Client features**:
- ```ruby
- windows_feature %w(TelnetServer TelnetClient) do
- action :remove
- end
- ```
+ ```ruby
+ windows_feature %w(TelnetServer TelnetClient) do
+ action :remove
+ end
+ ```
- **Add the SMTP Server feature using the PowerShell provider**:
+ **Add the SMTP Server feature using the PowerShell provider**:
- ```ruby
- windows_feature 'smtp-server' do
- action :install
- all true
- install_method :windows_feature_powershell
- end
- ```
+ ```ruby
+ windows_feature 'smtp-server' do
+ action :install
+ all true
+ install_method :windows_feature_powershell
+ end
+ ```
- **Install multiple features using one resource with the PowerShell provider**:
+ **Install multiple features using one resource with the PowerShell provider**:
- ```ruby
- windows_feature %w(Web-Asp-Net45 Web-Net-Ext45) do
- action :install
- install_method :windows_feature_powershell
- end
- ```
+ ```ruby
+ windows_feature %w(Web-Asp-Net45 Web-Net-Ext45) do
+ action :install
+ install_method :windows_feature_powershell
+ end
+ ```
- **Install the Network Policy and Access Service feature, including the management tools**:
+ **Install the Network Policy and Access Service feature, including the management tools**:
- ```ruby
- windows_feature 'NPAS' do
- action :install
- management_tools true
- install_method :windows_feature_powershell
- end
- ```
+ ```ruby
+ windows_feature 'NPAS' do
+ action :install
+ management_tools true
+ install_method :windows_feature_powershell
+ end
+ ```
DOC
property :feature_name, [Array, String],
diff --git a/lib/chef/resource/windows_feature_dism.rb b/lib/chef/resource/windows_feature_dism.rb
index a2d91eaede..aedfbad9f1 100644
--- a/lib/chef/resource/windows_feature_dism.rb
+++ b/lib/chef/resource/windows_feature_dism.rb
@@ -29,17 +29,17 @@ class Chef
description "Use the **windows_feature_dism** resource to add, remove, or entirely delete Windows features and roles using DISM."
introduced "14.0"
examples <<~DOC
- **Installing the TelnetClient service**:
+ **Installing the TelnetClient service**:
- ```ruby
- windows_feature_dism "TelnetClient"
- ```
+ ```ruby
+ windows_feature_dism "TelnetClient"
+ ```
- **Installing two features by using an array**:
+ **Installing two features by using an array**:
- ```ruby
- windows_feature_dism %w(TelnetClient TFTP)
- ```
+ ```ruby
+ windows_feature_dism %w(TelnetClient TFTP)
+ ```
DOC
property :feature_name, [Array, String],
diff --git a/lib/chef/resource/windows_feature_powershell.rb b/lib/chef/resource/windows_feature_powershell.rb
index e9889eb954..d6b2ff99c6 100644
--- a/lib/chef/resource/windows_feature_powershell.rb
+++ b/lib/chef/resource/windows_feature_powershell.rb
@@ -30,31 +30,31 @@ class Chef
description "Use the **windows_feature_powershell** resource to add, remove, or entirely delete Windows features and roles using PowerShell. This resource offers significant speed benefits over the windows_feature_dism resource, but requires installation of the Remote Server Administration Tools on non-server releases of Windows."
introduced "14.0"
examples <<~DOC
- **Add the SMTP Server feature**:
+ **Add the SMTP Server feature**:
- ```ruby
- windows_feature_powershell "smtp-server" do
- action :install
- all true
- end
- ```
+ ```ruby
+ windows_feature_powershell "smtp-server" do
+ action :install
+ all true
+ end
+ ```
- **Install multiple features using one resource**:
+ **Install multiple features using one resource**:
- ```ruby
- windows_feature_powershell ['Web-Asp-Net45', 'Web-Net-Ext45'] do
- action :install
- end
- ```
+ ```ruby
+ windows_feature_powershell ['Web-Asp-Net45', 'Web-Net-Ext45'] do
+ action :install
+ end
+ ```
- **Install the Network Policy and Access Service feature**:
+ **Install the Network Policy and Access Service feature**:
- ```ruby
- windows_feature_powershell 'NPAS' do
- action :install
- management_tools true
- end
- ```
+ ```ruby
+ windows_feature_powershell 'NPAS' do
+ action :install
+ management_tools true
+ end
+ ```
DOC
property :feature_name, [Array, String],
diff --git a/lib/chef/resource/windows_firewall_profile.rb b/lib/chef/resource/windows_firewall_profile.rb
index 573f4b2cfa..cfcaf4f27f 100644
--- a/lib/chef/resource/windows_firewall_profile.rb
+++ b/lib/chef/resource/windows_firewall_profile.rb
@@ -24,38 +24,38 @@ class Chef
introduced "16.3"
examples <<~DOC
- **Enable and Configure the Private Profile of the Windows Profile**:
-
- ```ruby
- windows_firewall_profile 'Private' do
- default_inbound_action 'Block'
- default_outbound_action 'Allow'
- allow_inbound_rules true
- display_notification false
- action :enable
- end
- ```
+ **Enable and Configure the Private Profile of the Windows Profile**:
+
+ ```ruby
+ windows_firewall_profile 'Private' do
+ default_inbound_action 'Block'
+ default_outbound_action 'Allow'
+ allow_inbound_rules true
+ display_notification false
+ action :enable
+ end
+ ```
- **Enable and Configure the Public Profile of the Windows Firewall**:
+ **Enable and Configure the Public Profile of the Windows Firewall**:
- ```ruby
- windows_firewall_profile 'Public' do
- default_inbound_action 'Block'
- default_outbound_action 'Allow'
- allow_inbound_rules false
- display_notification false
- action :enable
- end
- ```
+ ```ruby
+ windows_firewall_profile 'Public' do
+ default_inbound_action 'Block'
+ default_outbound_action 'Allow'
+ allow_inbound_rules false
+ display_notification false
+ action :enable
+ end
+ ```
- **Disable the Domain Profile of the Windows Firewall**:
+ **Disable the Domain Profile of the Windows Firewall**:
- ```ruby
- windows_firewall_profile 'Disable the Domain Profile of the Windows Firewall' do
- profile 'Domain'
- action :disable
- end
- ```
+ ```ruby
+ windows_firewall_profile 'Disable the Domain Profile of the Windows Firewall' do
+ profile 'Domain'
+ action :disable
+ end
+ ```
DOC
unified_mode true
diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb
index e397a94670..39e8de8867 100644
--- a/lib/chef/resource/windows_firewall_rule.rb
+++ b/lib/chef/resource/windows_firewall_rule.rb
@@ -29,60 +29,60 @@ class Chef
description "Use the **windows_firewall_rule** resource to create, change or remove Windows firewall rules."
introduced "14.7"
examples <<~DOC
- **Allowing port 80 access**:
+ **Allowing port 80 access**:
- ```ruby
- windows_firewall_rule 'IIS' do
- local_port '80'
- protocol 'TCP'
- firewall_action :allow
- end
- ```
-
- **Configuring multiple remote-address ports on a rule**:
-
- ```ruby
- windows_firewall_rule 'MyRule' do
- description 'Testing out remote address arrays'
- enabled false
- local_port 1434
- remote_address %w(10.17.3.101 172.7.7.53)
- protocol 'TCP'
- action :create
- end
- ```
+ ```ruby
+ windows_firewall_rule 'IIS' do
+ local_port '80'
+ protocol 'TCP'
+ firewall_action :allow
+ end
+ ```
+
+ **Configuring multiple remote-address ports on a rule**:
+
+ ```ruby
+ windows_firewall_rule 'MyRule' do
+ description 'Testing out remote address arrays'
+ enabled false
+ local_port 1434
+ remote_address %w(10.17.3.101 172.7.7.53)
+ protocol 'TCP'
+ action :create
+ end
+ ```
- **Allow protocol ICMPv6 with ICMP Type**:
+ **Allow protocol ICMPv6 with ICMP Type**:
- ```ruby
- windows_firewall_rule 'CoreNet-Rule' do
- rule_name 'CoreNet-ICMP6-LR2-In'
- display_name 'Core Networking - Multicast Listener Report v2 (ICMPv6-In)'
- local_port 'RPC'
- protocol 'ICMPv6'
- icmp_type '8'
- end
- ```
+ ```ruby
+ windows_firewall_rule 'CoreNet-Rule' do
+ rule_name 'CoreNet-ICMP6-LR2-In'
+ display_name 'Core Networking - Multicast Listener Report v2 (ICMPv6-In)'
+ local_port 'RPC'
+ protocol 'ICMPv6'
+ icmp_type '8'
+ end
+ ```
- **Blocking WinRM over HTTP on a particular IP**:
+ **Blocking WinRM over HTTP on a particular IP**:
- ```ruby
- windows_firewall_rule 'Disable WinRM over HTTP' do
- local_port '5985'
- protocol 'TCP'
- firewall_action :block
- local_address '192.168.1.1'
- end
- ```
+ ```ruby
+ windows_firewall_rule 'Disable WinRM over HTTP' do
+ local_port '5985'
+ protocol 'TCP'
+ firewall_action :block
+ local_address '192.168.1.1'
+ end
+ ```
- **Deleting an existing rule**
+ **Deleting an existing rule**
- ```ruby
- windows_firewall_rule 'Remove the SSH rule' do
- rule_name 'ssh'
- action :delete
- end
- ```
+ ```ruby
+ windows_firewall_rule 'Remove the SSH rule' do
+ rule_name 'ssh'
+ action :delete
+ end
+ ```
DOC
property :rule_name, String,
diff --git a/lib/chef/resource/windows_font.rb b/lib/chef/resource/windows_font.rb
index 2a8aaa3feb..6d9b4c428b 100644
--- a/lib/chef/resource/windows_font.rb
+++ b/lib/chef/resource/windows_font.rb
@@ -28,13 +28,13 @@ class Chef
description "Use the **windows_font** resource to install font files on Windows. By default, the font is sourced from the cookbook using the resource, but a URI source can be specified as well."
introduced "14.0"
examples <<~DOC
- **Install a font from a https source**:
+ **Install a font from a https source**:
- ```ruby
- windows_font 'Custom.otf' do
- source 'https://example.com/Custom.otf'
- end
- ```
+ ```ruby
+ windows_font 'Custom.otf' do
+ source 'https://example.com/Custom.otf'
+ end
+ ```
DOC
property :font_name, String,
diff --git a/lib/chef/resource/windows_package.rb b/lib/chef/resource/windows_package.rb
index 0072d70656..43923ed789 100644
--- a/lib/chef/resource/windows_package.rb
+++ b/lib/chef/resource/windows_package.rb
@@ -57,64 +57,64 @@ class Chef
introduced "11.12"
examples <<~DOC
- **Install a package**:
-
- ```ruby
- windows_package '7zip' do
- action :install
- source 'C:\\7z920.msi'
- end
- ```
-
- **Specify a URL for the source attribute**:
-
- ```ruby
- windows_package '7zip' do
- source 'http://www.7-zip.org/a/7z938-x64.msi'
- end
- ```
-
- **Specify path and checksum**:
-
- ```ruby
- windows_package '7zip' do
- source 'http://www.7-zip.org/a/7z938-x64.msi'
- checksum '7c8e873991c82ad9cfc123415254ea6101e9a645e12977dcd518979e50fdedf3'
- end
- ```
-
- **Modify remote_file resource attributes**:
-
- The windows_package resource may specify a package at a remote location using the remote_file_attributes property. This uses the remote_file resource to download the contents at the specified URL and passes in a Hash that modifies the properties of the remote_file resource.
-
- ```ruby
- windows_package '7zip' do
- source 'http://www.7-zip.org/a/7z938-x64.msi'
- remote_file_attributes ({
- :path => 'C:\\7zip.msi',
- :checksum => '7c8e873991c82ad9cfc123415254ea6101e9a645e12977dcd518979e50fdedf3'
- })
- end
- ```
-
- **Download a nsis (Nullsoft) package resource**:
-
- ```ruby
- windows_package 'Mercurial 3.6.1 (64-bit)' do
- source 'http://mercurial.selenic.com/release/windows/Mercurial-3.6.1-x64.exe'
- checksum 'febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d'
- end
- ```
-
- **Download a custom package**:
-
- ```ruby
- windows_package 'Microsoft Visual C++ 2005 Redistributable' do
- source 'https://download.microsoft.com/download/6/B/B/6BB661D6-A8AE-4819-B79F-236472F6070C/vcredist_x86.exe'
- installer_type :custom
- options '/Q'
- end
- ```
+ **Install a package**:
+
+ ```ruby
+ windows_package '7zip' do
+ action :install
+ source 'C:\\7z920.msi'
+ end
+ ```
+
+ **Specify a URL for the source attribute**:
+
+ ```ruby
+ windows_package '7zip' do
+ source 'http://www.7-zip.org/a/7z938-x64.msi'
+ end
+ ```
+
+ **Specify path and checksum**:
+
+ ```ruby
+ windows_package '7zip' do
+ source 'http://www.7-zip.org/a/7z938-x64.msi'
+ checksum '7c8e873991c82ad9cfc123415254ea6101e9a645e12977dcd518979e50fdedf3'
+ end
+ ```
+
+ **Modify remote_file resource attributes**:
+
+ The windows_package resource may specify a package at a remote location using the remote_file_attributes property. This uses the remote_file resource to download the contents at the specified URL and passes in a Hash that modifies the properties of the remote_file resource.
+
+ ```ruby
+ windows_package '7zip' do
+ source 'http://www.7-zip.org/a/7z938-x64.msi'
+ remote_file_attributes ({
+ :path => 'C:\\7zip.msi',
+ :checksum => '7c8e873991c82ad9cfc123415254ea6101e9a645e12977dcd518979e50fdedf3'
+ })
+ end
+ ```
+
+ **Download a nsis (Nullsoft) package resource**:
+
+ ```ruby
+ windows_package 'Mercurial 3.6.1 (64-bit)' do
+ source 'http://mercurial.selenic.com/release/windows/Mercurial-3.6.1-x64.exe'
+ checksum 'febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d'
+ end
+ ```
+
+ **Download a custom package**:
+
+ ```ruby
+ windows_package 'Microsoft Visual C++ 2005 Redistributable' do
+ source 'https://download.microsoft.com/download/6/B/B/6BB661D6-A8AE-4819-B79F-236472F6070C/vcredist_x86.exe'
+ installer_type :custom
+ options '/Q'
+ end
+ ```
DOC
allowed_actions :install, :remove
diff --git a/lib/chef/resource/windows_pagefile.rb b/lib/chef/resource/windows_pagefile.rb
index 6fb63f2f3b..f262f9fbb7 100644
--- a/lib/chef/resource/windows_pagefile.rb
+++ b/lib/chef/resource/windows_pagefile.rb
@@ -27,42 +27,42 @@ class Chef
description "Use the **windows_pagefile** resource to configure pagefile settings on Windows."
introduced "14.0"
examples <<~DOC
- **Set the system to manage pagefiles**:
+ **Set the system to manage pagefiles**:
- ```ruby
- windows_pagefile 'Enable automatic management of pagefiles' do
- automatic_managed true
- end
- ```
+ ```ruby
+ windows_pagefile 'Enable automatic management of pagefiles' do
+ automatic_managed true
+ end
+ ```
- **Delete a pagefile**:
+ **Delete a pagefile**:
- ```ruby
- windows_pagefile 'Delete the pagefile' do
- path 'C'
- action :delete
- end
- ```
+ ```ruby
+ windows_pagefile 'Delete the pagefile' do
+ path 'C'
+ action :delete
+ end
+ ```
- **Switch to system managed pagefiles**:
+ **Switch to system managed pagefiles**:
- ```ruby
- windows_pagefile 'Change the pagefile to System Managed' do
- path 'E:\'
- system_managed true
- action :set
- end
- ```
+ ```ruby
+ windows_pagefile 'Change the pagefile to System Managed' do
+ path 'E:\'
+ system_managed true
+ action :set
+ end
+ ```
- **Create a pagefile with an initial and maximum size**:
+ **Create a pagefile with an initial and maximum size**:
- ```ruby
- windows_pagefile 'create the pagefile with these sizes' do
- path 'f:\'
- initial_size 100
- maximum_size 200
- end
- ```
+ ```ruby
+ windows_pagefile 'create the pagefile with these sizes' do
+ path 'f:\'
+ initial_size 100
+ maximum_size 200
+ end
+ ```
DOC
property :path, String,
diff --git a/lib/chef/resource/windows_path.rb b/lib/chef/resource/windows_path.rb
index 625ac01fd0..b0ecd008d3 100644
--- a/lib/chef/resource/windows_path.rb
+++ b/lib/chef/resource/windows_path.rb
@@ -30,21 +30,21 @@ class Chef
description "Use the **windows_path** resource to manage the path environment variable on Microsoft Windows."
introduced "13.4"
examples <<~DOC
- **Add Sysinternals to the system path**:
+ **Add Sysinternals to the system path**:
- ```ruby
- windows_path 'C:\\Sysinternals' do
- action :add
- end
- ```
+ ```ruby
+ windows_path 'C:\\Sysinternals' do
+ action :add
+ end
+ ```
- **Remove 7-Zip from the system path**:
+ **Remove 7-Zip from the system path**:
- ```ruby
- windows_path 'C:\\7-Zip' do
- action :remove
- end
- ```
+ ```ruby
+ windows_path 'C:\\7-Zip' do
+ action :remove
+ end
+ ```
DOC
allowed_actions :add, :remove
diff --git a/lib/chef/resource/windows_printer.rb b/lib/chef/resource/windows_printer.rb
index be9155e83c..6f1c56a0ab 100644
--- a/lib/chef/resource/windows_printer.rb
+++ b/lib/chef/resource/windows_printer.rb
@@ -36,41 +36,41 @@ class Chef
description "Use the **windows_printer** resource to setup Windows printers. This resource will automatically install the driver specified in the `driver_name` property and will automatically create a printer port using either the `ipv4_address` property or the `port_name` property."
introduced "14.0"
examples <<~DOC
- **Create a printer**:
+ **Create a printer**:
- ```ruby
- windows_printer 'HP LaserJet 5th Floor' do
- driver_name 'HP LaserJet 4100 Series PCL6'
- ipv4_address '10.4.64.38'
- end
- ```
+ ```ruby
+ windows_printer 'HP LaserJet 5th Floor' do
+ driver_name 'HP LaserJet 4100 Series PCL6'
+ ipv4_address '10.4.64.38'
+ end
+ ```
- **Delete a printer**:
+ **Delete a printer**:
- Note: this doesn't delete the associated printer port. See windows_printer_port above for how to delete the port.
+ Note: this doesn't delete the associated printer port. See windows_printer_port above for how to delete the port.
- ```ruby
- windows_printer 'HP LaserJet 5th Floor' do
- action :delete
- end
- ```
+ ```ruby
+ windows_printer 'HP LaserJet 5th Floor' do
+ action :delete
+ end
+ ```
- **Create a printer port and a printer that uses that port (new in 17.3)**
+ **Create a printer port and a printer that uses that port (new in 17.3)**
- ```ruby
- windows_printer_port '10.4.64.39' do
- port_name 'My awesome printer port'
- snmp_enabled true
- port_protocol 2
- end
+ ```ruby
+ windows_printer_port '10.4.64.39' do
+ port_name 'My awesome printer port'
+ snmp_enabled true
+ port_protocol 2
+ end
- windows_printer 'HP LaserJet 5th Floor' do
- driver_name 'HP LaserJet 4100 Series PCL6'
- port_name 'My awesome printer port'
- ipv4_address '10.4.64.38'
- create_port false
- end
- ```
+ windows_printer 'HP LaserJet 5th Floor' do
+ driver_name 'HP LaserJet 4100 Series PCL6'
+ port_name 'My awesome printer port'
+ ipv4_address '10.4.64.38'
+ create_port false
+ end
+ ```
DOC
property :device_id, String,
diff --git a/lib/chef/resource/windows_printer_port.rb b/lib/chef/resource/windows_printer_port.rb
index 636ae9dd54..4baf954b1a 100644
--- a/lib/chef/resource/windows_printer_port.rb
+++ b/lib/chef/resource/windows_printer_port.rb
@@ -32,32 +32,32 @@ class Chef
description "Use the **windows_printer_port** resource to create and delete TCP/IPv4 printer ports on Windows."
introduced "14.0"
examples <<~DOC
- **Delete a printer port**
+ **Delete a printer port**
- ```ruby
- windows_printer_port '10.4.64.37' do
- action :delete
- end
- ```
+ ```ruby
+ windows_printer_port '10.4.64.37' do
+ action :delete
+ end
+ ```
- **Delete a port with a custom port_name**
+ **Delete a port with a custom port_name**
- ```ruby
- windows_printer_port '10.4.64.38' do
- port_name 'My awesome port'
- action :delete
- end
- ```
+ ```ruby
+ windows_printer_port '10.4.64.38' do
+ port_name 'My awesome port'
+ action :delete
+ end
+ ```
- **Create a port with more options**
+ **Create a port with more options**
- ```ruby
- windows_printer_port '10.4.64.39' do
- port_name 'My awesome port'
- snmp_enabled true
- port_protocol 2
- end
- ```
+ ```ruby
+ windows_printer_port '10.4.64.39' do
+ port_name 'My awesome port'
+ snmp_enabled true
+ port_protocol 2
+ end
+ ```
DOC
property :ipv4_address, String,
diff --git a/lib/chef/resource/windows_security_policy.rb b/lib/chef/resource/windows_security_policy.rb
index 5c683492a3..1c92d7e0e6 100644
--- a/lib/chef/resource/windows_security_policy.rb
+++ b/lib/chef/resource/windows_security_policy.rb
@@ -52,32 +52,32 @@ class Chef
introduced "16.0"
examples <<~DOC
- **Set Administrator Account to Enabled**:
+ **Set Administrator Account to Enabled**:
- ```ruby
- windows_security_policy 'EnableAdminAccount' do
- secvalue '1'
- action :set
- end
- ```
+ ```ruby
+ windows_security_policy 'EnableAdminAccount' do
+ secvalue '1'
+ action :set
+ end
+ ```
- **Rename Administrator Account**:
+ **Rename Administrator Account**:
- ```ruby
- windows_security_policy 'NewAdministratorName' do
- secvalue 'AwesomeChefGuy'
- action :set
- end
- ```
+ ```ruby
+ windows_security_policy 'NewAdministratorName' do
+ secvalue 'AwesomeChefGuy'
+ action :set
+ end
+ ```
- **Set Guest Account to Disabled**:
+ **Set Guest Account to Disabled**:
- ```ruby
- windows_security_policy 'EnableGuestAccount' do
- secvalue '0'
- action :set
- end
- ```
+ ```ruby
+ windows_security_policy 'EnableGuestAccount' do
+ secvalue '0'
+ action :set
+ end
+ ```
DOC
property :secoption, String, name_property: true, required: true, equal_to: policy_names,
diff --git a/lib/chef/resource/windows_service.rb b/lib/chef/resource/windows_service.rb
index 779c0e22ad..426c821be2 100644
--- a/lib/chef/resource/windows_service.rb
+++ b/lib/chef/resource/windows_service.rb
@@ -40,111 +40,111 @@ class Chef
description "Use the **windows_service** resource to create, delete, or manage a service on the Microsoft Windows platform."
introduced "12.0"
examples <<~DOC
- **Starting Services**
-
- Start a service with a `manual` startup type:
-
- ```ruby
- windows_service 'BITS' do
- action :configure_startup
- startup_type :manual
- end
- ```
-
- **Creating Services**
-
- Create a service named chef-client:
-
- ```ruby
- windows_service 'chef-client' do
- action :create
- binary_path_name "C:\\opscode\\chef\\bin"
- end
- ```
-
- Create a service with `service_name` and `display_name`:
-
- ```ruby
- windows_service 'Setup chef-client as a service' do
- action :create
- display_name 'CHEF-CLIENT'
- service_name 'chef-client'
- binary_path_name "C:\\opscode\\chef\\bin"
- end
- ```
-
- Create a service with the `manual` startup type:
-
- ```ruby
- windows_service 'chef-client' do
- action :create
- binary_path_name "C:\\opscode\\chef\\bin"
- startup_type :manual
- end
- ```
-
- Create a service with the `disabled` startup type:
-
- ```ruby
- windows_service 'chef-client' do
- action :create
- binary_path_name "C:\\opscode\\chef\\bin"
- startup_type :disabled
- end
- ```
-
- Create a service with the `automatic` startup type and delayed start enabled:
-
- ```ruby
- windows_service 'chef-client' do
- action :create
- binary_path_name "C:\\opscode\\chef\\bin"
- startup_type :automatic
- delayed_start true
- end
- ```
-
- Create a service with a description:
-
- ```ruby
- windows_service 'chef-client' do
- action :create
- binary_path_name "C:\\opscode\\chef\\bin"
- startup_type :automatic
- description "Chef client as service"
- end
- ```
-
- **Deleting Services**
-
- Delete a service named chef-client:
-
- ```ruby
- windows_service 'chef-client' do
- action :delete
- end
- ```
-
- Delete a service with the `service_name` property:
-
- ```ruby
- windows_service 'Delete chef client' do
- action :delete
- service_name 'chef-client'
- end
- ```
-
- **Configuring Services**
-
- Change an existing service from automatic to manual startup:
-
- ```ruby
- windows_service 'chef-client' do
- action :configure
- binary_path_name "C:\\opscode\\chef\\bin"
- startup_type :manual
- end
- ```
+ **Starting Services**
+
+ Start a service with a `manual` startup type:
+
+ ```ruby
+ windows_service 'BITS' do
+ action :configure_startup
+ startup_type :manual
+ end
+ ```
+
+ **Creating Services**
+
+ Create a service named chef-client:
+
+ ```ruby
+ windows_service 'chef-client' do
+ action :create
+ binary_path_name "C:\\opscode\\chef\\bin"
+ end
+ ```
+
+ Create a service with `service_name` and `display_name`:
+
+ ```ruby
+ windows_service 'Setup chef-client as a service' do
+ action :create
+ display_name 'CHEF-CLIENT'
+ service_name 'chef-client'
+ binary_path_name "C:\\opscode\\chef\\bin"
+ end
+ ```
+
+ Create a service with the `manual` startup type:
+
+ ```ruby
+ windows_service 'chef-client' do
+ action :create
+ binary_path_name "C:\\opscode\\chef\\bin"
+ startup_type :manual
+ end
+ ```
+
+ Create a service with the `disabled` startup type:
+
+ ```ruby
+ windows_service 'chef-client' do
+ action :create
+ binary_path_name "C:\\opscode\\chef\\bin"
+ startup_type :disabled
+ end
+ ```
+
+ Create a service with the `automatic` startup type and delayed start enabled:
+
+ ```ruby
+ windows_service 'chef-client' do
+ action :create
+ binary_path_name "C:\\opscode\\chef\\bin"
+ startup_type :automatic
+ delayed_start true
+ end
+ ```
+
+ Create a service with a description:
+
+ ```ruby
+ windows_service 'chef-client' do
+ action :create
+ binary_path_name "C:\\opscode\\chef\\bin"
+ startup_type :automatic
+ description "Chef client as service"
+ end
+ ```
+
+ **Deleting Services**
+
+ Delete a service named chef-client:
+
+ ```ruby
+ windows_service 'chef-client' do
+ action :delete
+ end
+ ```
+
+ Delete a service with the `service_name` property:
+
+ ```ruby
+ windows_service 'Delete chef client' do
+ action :delete
+ service_name 'chef-client'
+ end
+ ```
+
+ **Configuring Services**
+
+ Change an existing service from automatic to manual startup:
+
+ ```ruby
+ windows_service 'chef-client' do
+ action :configure
+ binary_path_name "C:\\opscode\\chef\\bin"
+ startup_type :manual
+ end
+ ```
DOC
allowed_actions :configure_startup, :create, :delete, :configure
diff --git a/lib/chef/resource/windows_share.rb b/lib/chef/resource/windows_share.rb
index 32b6b9f4a0..4287d24504 100644
--- a/lib/chef/resource/windows_share.rb
+++ b/lib/chef/resource/windows_share.rb
@@ -32,24 +32,24 @@ class Chef
description "Use the **windows_share** resource to create, modify and remove Windows shares."
introduced "14.7"
examples <<~DOC
- **Create a share**:
-
- ```ruby
- windows_share 'foo' do
- action :create
- path 'C:\\foo'
- full_users ['DOMAIN_A\\some_user', 'DOMAIN_B\\some_other_user']
- read_users ['DOMAIN_C\\Domain users']
- end
- ```
+ **Create a share**:
+
+ ```ruby
+ windows_share 'foo' do
+ action :create
+ path 'C:\\foo'
+ full_users ['DOMAIN_A\\some_user', 'DOMAIN_B\\some_other_user']
+ read_users ['DOMAIN_C\\Domain users']
+ end
+ ```
- **Delete a share**:
+ **Delete a share**:
- ```ruby
- windows_share 'foo' do
- action :delete
- end
- ```
+ ```ruby
+ windows_share 'foo' do
+ action :delete
+ end
+ ```
DOC
# Specifies a name for the SMB share. The name may be composed of any valid file name characters, but must be less than 80 characters long. The names pipe and mailslot are reserved for use by the computer.
diff --git a/lib/chef/resource/windows_shortcut.rb b/lib/chef/resource/windows_shortcut.rb
index d432f41bca..52b6536fc8 100644
--- a/lib/chef/resource/windows_shortcut.rb
+++ b/lib/chef/resource/windows_shortcut.rb
@@ -28,14 +28,14 @@ class Chef
description "Use the **windows_shortcut** resource to create shortcut files on Windows."
introduced "14.0"
examples <<~DOC
- **Create a shortcut with a description**:
+ **Create a shortcut with a description**:
- ```ruby
- windows_shortcut 'C:\\shortcut_dir.lnk' do
- target 'C:\\original_dir'
- description 'Make a shortcut to C:\\original_dir'
- end
- ```
+ ```ruby
+ windows_shortcut 'C:\\shortcut_dir.lnk' do
+ target 'C:\\original_dir'
+ description 'Make a shortcut to C:\\original_dir'
+ end
+ ```
DOC
property :shortcut_name, String,
diff --git a/lib/chef/resource/windows_task.rb b/lib/chef/resource/windows_task.rb
index b1154a1f08..02e4f7fe87 100644
--- a/lib/chef/resource/windows_task.rb
+++ b/lib/chef/resource/windows_task.rb
@@ -34,118 +34,118 @@ class Chef
description "Use the **windows_task** resource to create, delete or run a Windows scheduled task."
introduced "13.0"
examples <<~DOC
- **Create a scheduled task to run every 15 minutes as the Administrator user**:
-
- ```ruby
- windows_task 'chef-client' do
- user 'Administrator'
- password 'password'
- command 'chef-client'
- run_level :highest
- frequency :minute
- frequency_modifier 15
- end
- ```
+ **Create a scheduled task to run every 15 minutes as the Administrator user**:
+
+ ```ruby
+ windows_task 'chef-client' do
+ user 'Administrator'
+ password 'password'
+ command 'chef-client'
+ run_level :highest
+ frequency :minute
+ frequency_modifier 15
+ end
+ ```
- **Create a scheduled task to run every 2 days**:
+ **Create a scheduled task to run every 2 days**:
- ```ruby
- windows_task 'chef-client' do
- command 'chef-client'
- run_level :highest
- frequency :daily
- frequency_modifier 2
- end
- ```
+ ```ruby
+ windows_task 'chef-client' do
+ command 'chef-client'
+ run_level :highest
+ frequency :daily
+ frequency_modifier 2
+ end
+ ```
- **Create a scheduled task to run on specific days of the week**:
+ **Create a scheduled task to run on specific days of the week**:
- ```ruby
- windows_task 'chef-client' do
- command 'chef-client'
- run_level :highest
- frequency :weekly
- day 'Mon, Thu'
- end
- ```
+ ```ruby
+ windows_task 'chef-client' do
+ command 'chef-client'
+ run_level :highest
+ frequency :weekly
+ day 'Mon, Thu'
+ end
+ ```
- **Create a scheduled task to run only once**:
+ **Create a scheduled task to run only once**:
- ```ruby
- windows_task 'chef-client' do
- command 'chef-client'
- run_level :highest
- frequency :once
- start_time '16:10'
- end
- ```
+ ```ruby
+ windows_task 'chef-client' do
+ command 'chef-client'
+ run_level :highest
+ frequency :once
+ start_time '16:10'
+ end
+ ```
- **Create a scheduled task to run on current day every 3 weeks and delay upto 1 min**:
+ **Create a scheduled task to run on current day every 3 weeks and delay upto 1 min**:
- ```ruby
- windows_task 'chef-client' do
- command 'chef-client'
- run_level :highest
- frequency :weekly
- frequency_modifier 3
- random_delay '60'
- end
- ```
+ ```ruby
+ windows_task 'chef-client' do
+ command 'chef-client'
+ run_level :highest
+ frequency :weekly
+ frequency_modifier 3
+ random_delay '60'
+ end
+ ```
- **Create a scheduled task to run weekly starting on Dec 28th 2018**:
+ **Create a scheduled task to run weekly starting on Dec 28th 2018**:
- ```ruby
- windows_task 'chef-client 8' do
- command 'chef-client'
- run_level :highest
- frequency :weekly
- start_day '12/28/2018'
- end
- ```
+ ```ruby
+ windows_task 'chef-client 8' do
+ command 'chef-client'
+ run_level :highest
+ frequency :weekly
+ start_day '12/28/2018'
+ end
+ ```
- **Create a scheduled task to run every Monday, Friday every 2 weeks**:
+ **Create a scheduled task to run every Monday, Friday every 2 weeks**:
- ```ruby
- windows_task 'chef-client' do
- command 'chef-client'
- run_level :highest
- frequency :weekly
- frequency_modifier 2
- day 'Mon, Fri'
- end
- ```
+ ```ruby
+ windows_task 'chef-client' do
+ command 'chef-client'
+ run_level :highest
+ frequency :weekly
+ frequency_modifier 2
+ day 'Mon, Fri'
+ end
+ ```
- **Create a scheduled task to run when computer is idle with idle duration 20 min**:
+ **Create a scheduled task to run when computer is idle with idle duration 20 min**:
- ```ruby
- windows_task 'chef-client' do
- command 'chef-client'
- run_level :highest
- frequency :on_idle
- idle_time 20
- end
- ```
+ ```ruby
+ windows_task 'chef-client' do
+ command 'chef-client'
+ run_level :highest
+ frequency :on_idle
+ idle_time 20
+ end
+ ```
- **Delete a task named "old task"**:
- ```ruby
- windows_task 'old task' do
- action :delete
- end
- ```
+ **Delete a task named "old task"**:
+ ```ruby
+ windows_task 'old task' do
+ action :delete
+ end
+ ```
- **Enable a task named "chef-client"**:
- ```ruby
- windows_task 'chef-client' do
- action :enable
- end
- ```
+ **Enable a task named "chef-client"**:
+ ```ruby
+ windows_task 'chef-client' do
+ action :enable
+ end
+ ```
- **Disable a task named "ProgramDataUpdater" with TaskPath "\\Microsoft\\Windows\\Application Experience\\ProgramDataUpdater"**
- ```ruby
- windows_task '\\Microsoft\\Windows\\Application Experience\\ProgramDataUpdater' do
- action :disable
- end
- ```
+ **Disable a task named "ProgramDataUpdater" with TaskPath "\\Microsoft\\Windows\\Application Experience\\ProgramDataUpdater"**
+ ```ruby
+ windows_task '\\Microsoft\\Windows\\Application Experience\\ProgramDataUpdater' do
+ action :disable
+ end
+ ```
DOC
allowed_actions :create, :delete, :run, :end, :enable, :disable, :change
diff --git a/lib/chef/resource/windows_uac.rb b/lib/chef/resource/windows_uac.rb
index 4f01b542a5..7ecdb01d3b 100644
--- a/lib/chef/resource/windows_uac.rb
+++ b/lib/chef/resource/windows_uac.rb
@@ -27,23 +27,23 @@ class Chef
description 'The *windows_uac* resource configures UAC on Windows hosts by setting registry keys at `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System`'
introduced "15.0"
examples <<~DOC
- **Disable UAC prompts for the admin**:
+ **Disable UAC prompts for the admin**:
- ```ruby
- windows_uac 'Disable UAC prompts for the admin' do
- enable_uac true
- prompt_on_secure_desktop false
- consent_behavior_admins :no_prompt
- end
- ```
+ ```ruby
+ windows_uac 'Disable UAC prompts for the admin' do
+ enable_uac true
+ prompt_on_secure_desktop false
+ consent_behavior_admins :no_prompt
+ end
+ ```
- **Disable UAC entirely**:
+ **Disable UAC entirely**:
- ```ruby
- windows_uac 'Disable UAC entirely' do
- enable_uac false
- end
- ```
+ ```ruby
+ windows_uac 'Disable UAC entirely' do
+ enable_uac false
+ end
+ ```
DOC
# https://docs.microsoft.com/en-us/windows/security/identity-protection/user-account-control/user-account-control-group-policy-and-registry-key-settings#user-account-control-virtualize-file-and-registry-write-failures-to-per-user-locations
diff --git a/lib/chef/resource/windows_update_settings.rb b/lib/chef/resource/windows_update_settings.rb
index 3f8cf95acb..709e541fce 100644
--- a/lib/chef/resource/windows_update_settings.rb
+++ b/lib/chef/resource/windows_update_settings.rb
@@ -30,20 +30,20 @@ class Chef
description "Use the **windows_update_settings** resource to manage the various Windows Update patching options."
introduced "17.3"
examples <<~DOC
- **Set Windows Update settings**:
-
- ```ruby
- windows_update_settings 'Settings to Configure Windows Nodes to automatically receive updates' do
- disable_os_upgrades true
- elevate_non_admins true
- block_windows_update_website true
- automatically_install_minor_updates true
- scheduled_install_day 'Friday'
- scheduled_install_hour 18
- update_other_ms_products true
- action :enable
- end
- ```
+ **Set Windows Update settings**:
+
+ ```ruby
+ windows_update_settings 'Settings to Configure Windows Nodes to automatically receive updates' do
+ disable_os_upgrades true
+ elevate_non_admins true
+ block_windows_update_website true
+ automatically_install_minor_updates true
+ scheduled_install_day 'Friday'
+ scheduled_install_hour 18
+ update_other_ms_products true
+ action :enable
+ end
+ ```
DOC
# required for the alias to pass validation
diff --git a/lib/chef/resource/windows_user_privilege.rb b/lib/chef/resource/windows_user_privilege.rb
index 2d4a395a7c..e3c2d0cb29 100644
--- a/lib/chef/resource/windows_user_privilege.rb
+++ b/lib/chef/resource/windows_user_privilege.rb
@@ -29,54 +29,54 @@ class Chef
introduced "16.0"
examples <<~DOC
- **Set the SeNetworkLogonRight Privilege for the Builtin Administrators Group and Authenticated Users**:
+ **Set the SeNetworkLogonRight Privilege for the Builtin Administrators Group and Authenticated Users**:
- ```ruby
- windows_user_privilege 'Network Logon Rights' do
- privilege 'SeNetworkLogonRight'
- users ['BUILTIN\\Administrators', 'NT AUTHORITY\\Authenticated Users']
- action :set
- end
- ```
+ ```ruby
+ windows_user_privilege 'Network Logon Rights' do
+ privilege 'SeNetworkLogonRight'
+ users ['BUILTIN\\Administrators', 'NT AUTHORITY\\Authenticated Users']
+ action :set
+ end
+ ```
- **Add the SeDenyRemoteInteractiveLogonRight Privilege to the Builtin Guests and Local Accounts User Groups**:
+ **Add the SeDenyRemoteInteractiveLogonRight Privilege to the Builtin Guests and Local Accounts User Groups**:
- ```ruby
- windows_user_privilege 'Remote interactive logon' do
- privilege 'SeDenyRemoteInteractiveLogonRight'
- users ['Builtin\\Guests', 'NT AUTHORITY\\Local Account']
- action :add
- end
- ```
+ ```ruby
+ windows_user_privilege 'Remote interactive logon' do
+ privilege 'SeDenyRemoteInteractiveLogonRight'
+ users ['Builtin\\Guests', 'NT AUTHORITY\\Local Account']
+ action :add
+ end
+ ```
- **Provide only the Builtin Guests and Administrator Groups with the SeCreatePageFile Privilege**:
+ **Provide only the Builtin Guests and Administrator Groups with the SeCreatePageFile Privilege**:
- ```ruby
- windows_user_privilege 'Create Pagefile' do
- privilege 'SeCreatePagefilePrivilege'
- users ['BUILTIN\\Guests', 'BUILTIN\\Administrators']
- action :set
- end
- ```
+ ```ruby
+ windows_user_privilege 'Create Pagefile' do
+ privilege 'SeCreatePagefilePrivilege'
+ users ['BUILTIN\\Guests', 'BUILTIN\\Administrators']
+ action :set
+ end
+ ```
- **Remove the SeCreatePageFile Privilege from the Builtin Guests Group**:
+ **Remove the SeCreatePageFile Privilege from the Builtin Guests Group**:
- ```ruby
- windows_user_privilege 'Create Pagefile' do
- privilege 'SeCreatePagefilePrivilege'
- users ['BUILTIN\\Guests']
- action :remove
- end
- ```
+ ```ruby
+ windows_user_privilege 'Create Pagefile' do
+ privilege 'SeCreatePagefilePrivilege'
+ users ['BUILTIN\\Guests']
+ action :remove
+ end
+ ```
- **Clear all users from the SeDenyNetworkLogonRight Privilege**:
+ **Clear all users from the SeDenyNetworkLogonRight Privilege**:
- ```ruby
- windows_user_privilege 'Allow any user the Network Logon right' do
- privilege 'SeDenyNetworkLogonRight'
- action :clear
- end
- ```
+ ```ruby
+ windows_user_privilege 'Allow any user the Network Logon right' do
+ privilege 'SeDenyNetworkLogonRight'
+ action :clear
+ end
+ ```
DOC
PRIVILEGE_OPTS = %w{ SeAssignPrimaryTokenPrivilege
diff --git a/lib/chef/resource/windows_workgroup.rb b/lib/chef/resource/windows_workgroup.rb
index acb3bee542..9a076df665 100644
--- a/lib/chef/resource/windows_workgroup.rb
+++ b/lib/chef/resource/windows_workgroup.rb
@@ -28,20 +28,20 @@ class Chef
description "Use the **windows_workgroup** resource to join or change the workgroup of a Windows host."
introduced "14.5"
examples <<~DOC
- **Join a workgroup**:
+ **Join a workgroup**:
- ```ruby
- windows_workgroup 'myworkgroup'
- ```
+ ```ruby
+ windows_workgroup 'myworkgroup'
+ ```
- **Join a workgroup using a specific user**:
+ **Join a workgroup using a specific user**:
- ```ruby
- windows_workgroup 'myworkgroup' do
- user 'Administrator'
- password 'passw0rd'
- end
- ```
+ ```ruby
+ windows_workgroup 'myworkgroup' do
+ user 'Administrator'
+ password 'passw0rd'
+ end
+ ```
DOC
property :workgroup_name, String,
diff --git a/lib/chef/resource/yum_repository.rb b/lib/chef/resource/yum_repository.rb
index b5ad2688eb..7339253cd1 100644
--- a/lib/chef/resource/yum_repository.rb
+++ b/lib/chef/resource/yum_repository.rb
@@ -28,24 +28,24 @@ class Chef
description "Use the **yum_repository** resource to manage a Yum repository configuration file located at `/etc/yum.repos.d/repositoryid.repo` on the local machine. This configuration file specifies which repositories to reference, how to handle cached data, etc."
introduced "12.14"
examples <<~DOC
- **Add an internal company repository**:
-
- ```ruby
- yum_repository 'OurCo' do
- description 'OurCo yum repository'
- mirrorlist 'http://artifacts.ourco.org/mirrorlist?repo=ourco-8&arch=$basearch'
- gpgkey 'http://artifacts.ourco.org/pub/yum/RPM-GPG-KEY-OURCO-8'
- action :create
- end
- ```
-
- **Delete a repository**:
-
- ```ruby
- yum_repository 'CentOS-Media' do
- action :delete
- end
- ```
+ **Add an internal company repository**:
+
+ ```ruby
+ yum_repository 'OurCo' do
+ description 'OurCo yum repository'
+ mirrorlist 'http://artifacts.ourco.org/mirrorlist?repo=ourco-8&arch=$basearch'
+ gpgkey 'http://artifacts.ourco.org/pub/yum/RPM-GPG-KEY-OURCO-8'
+ action :create
+ end
+ ```
+
+ **Delete a repository**:
+
+ ```ruby
+ yum_repository 'CentOS-Media' do
+ action :delete
+ end
+ ```
DOC
# http://linux.die.net/man/5/yum.conf as well as