chef 18.9.4 → 18.11.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +16 -12
  3. data/README.md +0 -1
  4. data/Rakefile +21 -5
  5. data/chef-universal-mingw-ucrt.gemspec +4 -2
  6. data/chef.gemspec +17 -14
  7. data/lib/chef/application/apply.rb +1 -1
  8. data/lib/chef/application/base.rb +4 -4
  9. data/lib/chef/application/exit_code.rb +1 -1
  10. data/lib/chef/chef_fs/command_line.rb +4 -4
  11. data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +1 -1
  12. data/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb +2 -3
  13. data/lib/chef/client.rb +2 -3
  14. data/lib/chef/compliance/fetcher/chef_server.rb +1 -1
  15. data/lib/chef/compliance/reporter/cli.rb +2 -2
  16. data/lib/chef/compliance/runner.rb +19 -1
  17. data/lib/chef/dsl/chef_vault.rb +1 -1
  18. data/lib/chef/dsl/rest_resource.rb +223 -16
  19. data/lib/chef/encrypted_data_bag_item/decryptor.rb +1 -5
  20. data/lib/chef/environment.rb +1 -1
  21. data/lib/chef/exceptions.rb +1 -1
  22. data/lib/chef/file_cache.rb +1 -5
  23. data/lib/chef/formatters/error_description.rb +8 -1
  24. data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +1 -1
  25. data/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +1 -1
  26. data/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +1 -1
  27. data/lib/chef/group.rb +1 -1
  28. data/lib/chef/handler/slow_report.rb +1 -1
  29. data/lib/chef/http/authenticator.rb +25 -12
  30. data/lib/chef/mixin/api_version_request_handling.rb +1 -1
  31. data/lib/chef/mixin/powershell_type_coercions.rb +2 -2
  32. data/lib/chef/mixin/securable.rb +2 -2
  33. data/lib/chef/mixin/template.rb +25 -3
  34. data/lib/chef/mixin/versioned_api.rb +1 -1
  35. data/lib/chef/monkey_patches/net-http.rb +8 -8
  36. data/lib/chef/monkey_patches/reline-windows.rb +116 -0
  37. data/lib/chef/property.rb +1 -1
  38. data/lib/chef/provider/cron.rb +1 -1
  39. data/lib/chef/provider/directory.rb +11 -0
  40. data/lib/chef/provider/dsc_resource.rb +2 -2
  41. data/lib/chef/provider/file/content.rb +3 -2
  42. data/lib/chef/provider/file.rb +1 -1
  43. data/lib/chef/provider/git.rb +1 -1
  44. data/lib/chef/provider/ifconfig/debian.rb +1 -1
  45. data/lib/chef/provider/ifconfig/redhat.rb +1 -1
  46. data/lib/chef/provider/mount/linux.rb +1 -1
  47. data/lib/chef/provider/mount/windows.rb +4 -4
  48. data/lib/chef/provider/package/chocolatey.rb +78 -19
  49. data/lib/chef/provider/package/dnf/dnf_helper.py +355 -65
  50. data/lib/chef/provider/package/dnf/python_helper.rb +7 -4
  51. data/lib/chef/provider/package/dnf.rb +25 -6
  52. data/lib/chef/provider/package/homebrew.rb +3 -3
  53. data/lib/chef/provider/package/rubygems.rb +25 -2
  54. data/lib/chef/provider/package/snap.rb +1 -1
  55. data/lib/chef/provider/package/windows/exe.rb +1 -1
  56. data/lib/chef/provider/package/windows/msi.rb +1 -1
  57. data/lib/chef/provider/package/yum/rpm_utils.rb +2 -2
  58. data/lib/chef/provider/package/yum.rb +1 -1
  59. data/lib/chef/provider/powershell_script.rb +84 -84
  60. data/lib/chef/provider/service/debian.rb +2 -4
  61. data/lib/chef/provider/user/dscl.rb +1 -1
  62. data/lib/chef/provider/user/mac.rb +1 -1
  63. data/lib/chef/provider/windows_script.rb +1 -1
  64. data/lib/chef/resource/_rest_resource.rb +9 -7
  65. data/lib/chef/resource/alternatives.rb +41 -41
  66. data/lib/chef/resource/apt_package.rb +31 -31
  67. data/lib/chef/resource/apt_preference.rb +22 -22
  68. data/lib/chef/resource/apt_repository.rb +2 -2
  69. data/lib/chef/resource/archive_file.rb +52 -18
  70. data/lib/chef/resource/bash.rb +129 -129
  71. data/lib/chef/resource/bff_package.rb +15 -15
  72. data/lib/chef/resource/breakpoint.rb +44 -44
  73. data/lib/chef/resource/cab_package.rb +22 -22
  74. data/lib/chef/resource/chef_client_config.rb +251 -89
  75. data/lib/chef/resource/chef_client_cron.rb +18 -18
  76. data/lib/chef/resource/chef_client_launchd.rb +1 -1
  77. data/lib/chef/resource/chef_client_scheduled_task.rb +31 -31
  78. data/lib/chef/resource/chef_client_systemd_timer.rb +16 -16
  79. data/lib/chef/resource/chef_client_trusted_certificate.rb +28 -28
  80. data/lib/chef/resource/chef_handler.rb +107 -107
  81. data/lib/chef/resource/chef_vault_secret.rb +1 -1
  82. data/lib/chef/resource/chocolatey_config.rb +14 -14
  83. data/lib/chef/resource/chocolatey_feature.rb +1 -1
  84. data/lib/chef/resource/chocolatey_installer.rb +60 -42
  85. data/lib/chef/resource/chocolatey_package.rb +1 -1
  86. data/lib/chef/resource/chocolatey_source.rb +15 -15
  87. data/lib/chef/resource/cron/_cron_shared.rb +0 -2
  88. data/lib/chef/resource/cron/cron.rb +70 -70
  89. data/lib/chef/resource/csh.rb +5 -5
  90. data/lib/chef/resource/directory.rb +6 -6
  91. data/lib/chef/resource/dpkg_package.rb +3 -3
  92. data/lib/chef/resource/group.rb +28 -28
  93. data/lib/chef/resource/habitat/habitat_package.rb +80 -80
  94. data/lib/chef/resource/habitat/habitat_sup.rb +93 -95
  95. data/lib/chef/resource/habitat/habitat_sup_systemd.rb +10 -10
  96. data/lib/chef/resource/habitat/habitat_sup_windows.rb +3 -3
  97. data/lib/chef/resource/habitat_config.rb +13 -13
  98. data/lib/chef/resource/habitat_install.rb +17 -17
  99. data/lib/chef/resource/habitat_service.rb +1 -1
  100. data/lib/chef/resource/habitat_user_toml.rb +12 -12
  101. data/lib/chef/resource/helpers/cron_validations.rb +2 -2
  102. data/lib/chef/resource/homebrew_cask.rb +1 -1
  103. data/lib/chef/resource/homebrew_package.rb +20 -20
  104. data/lib/chef/resource/homebrew_tap.rb +1 -1
  105. data/lib/chef/resource/hostname.rb +2 -2
  106. data/lib/chef/resource/http_request.rb +2 -2
  107. data/lib/chef/resource/ifconfig.rb +34 -34
  108. data/lib/chef/resource/inspec_input.rb +37 -37
  109. data/lib/chef/resource/inspec_waiver.rb +63 -63
  110. data/lib/chef/resource/inspec_waiver_file_entry.rb +25 -25
  111. data/lib/chef/resource/ksh.rb +5 -5
  112. data/lib/chef/resource/launchd.rb +2 -2
  113. data/lib/chef/resource/link.rb +8 -8
  114. data/lib/chef/resource/locale.rb +6 -6
  115. data/lib/chef/resource/log.rb +4 -4
  116. data/lib/chef/resource/mdadm.rb +36 -36
  117. data/lib/chef/resource/mount.rb +3 -3
  118. data/lib/chef/resource/msu_package.rb +1 -1
  119. data/lib/chef/resource/ohai.rb +32 -32
  120. data/lib/chef/resource/ohai_hint.rb +24 -24
  121. data/lib/chef/resource/openssl_ec_private_key.rb +2 -2
  122. data/lib/chef/resource/openssl_ec_public_key.rb +2 -2
  123. data/lib/chef/resource/openssl_rsa_private_key.rb +1 -1
  124. data/lib/chef/resource/openssl_rsa_public_key.rb +2 -2
  125. data/lib/chef/resource/openssl_x509_certificate.rb +1 -1
  126. data/lib/chef/resource/openssl_x509_crl.rb +15 -15
  127. data/lib/chef/resource/openssl_x509_request.rb +2 -2
  128. data/lib/chef/resource/osx_profile.rb +54 -54
  129. data/lib/chef/resource/package.rb +6 -6
  130. data/lib/chef/resource/perl.rb +5 -5
  131. data/lib/chef/resource/plist.rb +4 -4
  132. data/lib/chef/resource/powershell_package_source.rb +12 -12
  133. data/lib/chef/resource/python.rb +4 -4
  134. data/lib/chef/resource/reboot.rb +5 -5
  135. data/lib/chef/resource/registry_key.rb +81 -81
  136. data/lib/chef/resource/remote_file.rb +72 -72
  137. data/lib/chef/resource/resource_notification.rb +4 -4
  138. data/lib/chef/resource/rhsm_errata_level.rb +1 -1
  139. data/lib/chef/resource/rhsm_register.rb +2 -2
  140. data/lib/chef/resource/scm/git.rb +79 -79
  141. data/lib/chef/resource/scm/subversion.rb +9 -9
  142. data/lib/chef/resource/script.rb +3 -3
  143. data/lib/chef/resource/selinux_boolean.rb +12 -12
  144. data/lib/chef/resource/selinux_fcontext.rb +21 -21
  145. data/lib/chef/resource/selinux_install.rb +18 -18
  146. data/lib/chef/resource/selinux_login.rb +11 -11
  147. data/lib/chef/resource/selinux_module.rb +16 -16
  148. data/lib/chef/resource/selinux_permissive.rb +9 -9
  149. data/lib/chef/resource/selinux_port.rb +16 -16
  150. data/lib/chef/resource/selinux_state.rb +28 -28
  151. data/lib/chef/resource/selinux_user.rb +14 -14
  152. data/lib/chef/resource/service.rb +5 -5
  153. data/lib/chef/resource/snap_package.rb +16 -16
  154. data/lib/chef/resource/ssh_known_hosts_entry.rb +10 -10
  155. data/lib/chef/resource/sudo.rb +68 -68
  156. data/lib/chef/resource/swap_file.rb +12 -12
  157. data/lib/chef/resource/sysctl.rb +42 -42
  158. data/lib/chef/resource/systemd_unit.rb +38 -38
  159. data/lib/chef/resource/timezone.rb +16 -16
  160. data/lib/chef/resource/user/mac_user.rb +3 -3
  161. data/lib/chef/resource/user.rb +6 -6
  162. data/lib/chef/resource/user_ulimit.rb +22 -22
  163. data/lib/chef/resource/windows_ad_join.rb +25 -25
  164. data/lib/chef/resource/windows_audit_policy.rb +34 -34
  165. data/lib/chef/resource/windows_auto_run.rb +8 -8
  166. data/lib/chef/resource/windows_certificate.rb +20 -20
  167. data/lib/chef/resource/windows_defender.rb +22 -22
  168. data/lib/chef/resource/windows_defender_exclusion.rb +17 -17
  169. data/lib/chef/resource/windows_env.rb +6 -6
  170. data/lib/chef/resource/windows_feature.rb +42 -42
  171. data/lib/chef/resource/windows_feature_dism.rb +8 -8
  172. data/lib/chef/resource/windows_feature_powershell.rb +20 -20
  173. data/lib/chef/resource/windows_firewall_profile.rb +28 -28
  174. data/lib/chef/resource/windows_firewall_rule.rb +47 -47
  175. data/lib/chef/resource/windows_font.rb +7 -7
  176. data/lib/chef/resource/windows_package.rb +59 -59
  177. data/lib/chef/resource/windows_pagefile.rb +29 -29
  178. data/lib/chef/resource/windows_path.rb +12 -12
  179. data/lib/chef/resource/windows_printer.rb +28 -28
  180. data/lib/chef/resource/windows_printer_port.rb +21 -21
  181. data/lib/chef/resource/windows_security_policy.rb +23 -23
  182. data/lib/chef/resource/windows_service.rb +108 -108
  183. data/lib/chef/resource/windows_share.rb +19 -19
  184. data/lib/chef/resource/windows_shortcut.rb +7 -7
  185. data/lib/chef/resource/windows_task.rb +105 -105
  186. data/lib/chef/resource/windows_uac.rb +14 -14
  187. data/lib/chef/resource/windows_update_settings.rb +27 -27
  188. data/lib/chef/resource/windows_user_privilege.rb +59 -59
  189. data/lib/chef/resource/windows_workgroup.rb +12 -12
  190. data/lib/chef/resource/yum_package.rb +1 -1
  191. data/lib/chef/resource/yum_repository.rb +36 -36
  192. data/lib/chef/resource.rb +1 -1
  193. data/lib/chef/resource_collection/resource_set.rb +2 -3
  194. data/lib/chef/resource_inspector.rb +1 -2
  195. data/lib/chef/run_context.rb +2 -2
  196. data/lib/chef/runner.rb +1 -1
  197. data/lib/chef/secret_fetcher/akeyless_vault.rb +0 -1
  198. data/lib/chef/secret_fetcher/hashi_vault.rb +0 -1
  199. data/lib/chef/shell/ext.rb +20 -20
  200. data/lib/chef/shell/shell_session.rb +1 -1
  201. data/lib/chef/shell.rb +7 -0
  202. data/lib/chef/version.rb +1 -1
  203. data/lib/chef/version_constraint.rb +1 -1
  204. data/lib/chef/win32/file/version_info.rb +1 -1
  205. metadata +63 -38
@@ -27,51 +27,51 @@ class Chef
27
27
 
28
28
  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."
29
29
  examples <<~DOC
30
- **Configure a network interface with a static IP**
30
+ **Configure a network interface with a static IP**
31
31
 
32
- ```ruby
33
- ifconfig '33.33.33.80' do
34
- device 'eth1'
35
- end
36
- ```
32
+ ```ruby
33
+ ifconfig '33.33.33.80' do
34
+ device 'eth1'
35
+ end
36
+ ```
37
37
 
38
- will create the following interface configuration:
38
+ will create the following interface configuration:
39
39
 
40
- ```
41
- iface eth1 inet static
42
- address 33.33.33.80
43
- ```
40
+ ```
41
+ iface eth1 inet static
42
+ address 33.33.33.80
43
+ ```
44
44
 
45
- **Configure an interface to use DHCP**
45
+ **Configure an interface to use DHCP**
46
46
 
47
- ```ruby
48
- ifconfig 'Set eth1 to DHCP' do
49
- device 'eth1'
50
- bootproto 'dhcp'
51
- end
52
- ```
47
+ ```ruby
48
+ ifconfig 'Set eth1 to DHCP' do
49
+ device 'eth1'
50
+ bootproto 'dhcp'
51
+ end
52
+ ```
53
53
 
54
- will create the following interface configuration:
54
+ will create the following interface configuration:
55
55
 
56
- ```
57
- iface eth1 inet dhcp
58
- ```
56
+ ```
57
+ iface eth1 inet dhcp
58
+ ```
59
59
 
60
- **Update a static IP address with a boot protocol**
60
+ **Update a static IP address with a boot protocol**
61
61
 
62
- ```ruby
63
- ifconfig "33.33.33.80" do
64
- bootproto "dhcp"
65
- device "eth1"
66
- end
67
- ```
62
+ ```ruby
63
+ ifconfig "33.33.33.80" do
64
+ bootproto "dhcp"
65
+ device "eth1"
66
+ end
67
+ ```
68
68
 
69
- will update the interface configuration from static to dhcp:
69
+ will update the interface configuration from static to dhcp:
70
70
 
71
- ```
72
- iface eth1 inet dhcp
73
- address 33.33.33.80
74
- ```
71
+ ```
72
+ iface eth1 inet dhcp
73
+ address 33.33.33.80
74
+ ```
75
75
  DOC
76
76
 
77
77
  state_attrs :inet_addr, :mask
@@ -25,55 +25,55 @@ class Chef
25
25
  introduced "17.5"
26
26
  examples <<~DOC
27
27
 
28
- **Activate the default input in the openssh cookbook's compliance segment**:
28
+ **Activate the default input in the openssh cookbook's compliance segment**:
29
29
 
30
- ```ruby
31
- inspec_input 'openssh' do
32
- action :add
33
- end
34
- ```
30
+ ```ruby
31
+ inspec_input 'openssh' do
32
+ action :add
33
+ end
34
+ ```
35
35
 
36
- **Activate all inputs in the openssh cookbook's compliance segment**:
36
+ **Activate all inputs in the openssh cookbook's compliance segment**:
37
37
 
38
- ```ruby
39
- inspec_input 'openssh::.*' do
40
- action :add
41
- end
42
- ```
38
+ ```ruby
39
+ inspec_input 'openssh::.*' do
40
+ action :add
41
+ end
42
+ ```
43
43
 
44
- **Add an InSpec input to the Compliance Phase from a hash**:
44
+ **Add an InSpec input to the Compliance Phase from a hash**:
45
45
 
46
- ```ruby
47
- inspec_input { ssh_custom_path: '/whatever2' }
48
- ```
46
+ ```ruby
47
+ inspec_input { ssh_custom_path: '/whatever2' }
48
+ ```
49
49
 
50
- **Add an InSpec input to the Compliance Phase using the 'name' property to identify the input**:
50
+ **Add an InSpec input to the Compliance Phase using the 'name' property to identify the input**:
51
51
 
52
- ```ruby
53
- inspec_input "setting my input" do
54
- source( { ssh_custom_path: '/whatever2' })
55
- end
56
- ```
52
+ ```ruby
53
+ inspec_input "setting my input" do
54
+ source( { ssh_custom_path: '/whatever2' })
55
+ end
56
+ ```
57
57
 
58
- **Add an InSpec input to the Compliance Phase using a TOML, JSON, or YAML file**:
58
+ **Add an InSpec input to the Compliance Phase using a TOML, JSON, or YAML file**:
59
59
 
60
- ```ruby
61
- inspec_input "/path/to/my/input.yml"
62
- ```
60
+ ```ruby
61
+ inspec_input "/path/to/my/input.yml"
62
+ ```
63
63
 
64
- **Add an InSpec input to the Compliance Phase using a TOML, JSON, or YAML file, using the 'name' property**:
64
+ **Add an InSpec input to the Compliance Phase using a TOML, JSON, or YAML file, using the 'name' property**:
65
65
 
66
- ```ruby
67
- inspec_input "setting my input" do
68
- source "/path/to/my/input.yml"
69
- end
70
- ```
66
+ ```ruby
67
+ inspec_input "setting my input" do
68
+ source "/path/to/my/input.yml"
69
+ end
70
+ ```
71
71
 
72
- 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
73
- the resource while not causing the updated resource count to be larger than zero. Since the resource does not update the state of the managed node, this behavior
74
- is still consistent with the configuration management model. Instead, you should use events to observe configuration changes for the compliance phase. It is
75
- possible to use the `notify_group` resource to chain notifications of the two resources, but notifications are the wrong model to use, and you should use pure ruby
76
- conditionals instead. Compliance configuration should be independent of other resources and should only be conditional based on state/attributes, not other resources.
72
+ 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
73
+ the resource while not causing the updated resource count to be larger than zero. Since the resource does not update the state of the managed node, this behavior
74
+ is still consistent with the configuration management model. Instead, you should use events to observe configuration changes for the compliance phase. It is
75
+ possible to use the `notify_group` resource to chain notifications of the two resources, but notifications are the wrong model to use, and you should use pure ruby
76
+ conditionals instead. Compliance configuration should be independent of other resources and should only be conditional based on state/attributes, not other resources.
77
77
  DOC
78
78
 
79
79
  property :name, [ Hash, String ]
@@ -24,87 +24,87 @@ class Chef
24
24
  description "Use the **inspec_waiver** resource to add a waiver to the Compliance Phase."
25
25
  introduced "17.5"
26
26
  examples <<~DOC
27
- **Activate the default waiver in the openssh cookbook's compliance segment**:
27
+ **Activate the default waiver in the openssh cookbook's compliance segment**:
28
28
 
29
- ```ruby
30
- inspec_waiver 'openssh' do
31
- action :add
32
- end
33
- ```
29
+ ```ruby
30
+ inspec_waiver 'openssh' do
31
+ action :add
32
+ end
33
+ ```
34
34
 
35
- **Activate all waivers in the openssh cookbook's compliance segment**:
35
+ **Activate all waivers in the openssh cookbook's compliance segment**:
36
36
 
37
- ```ruby
38
- inspec_waiver 'openssh::.*' do
39
- action :add
40
- end
41
- ```
37
+ ```ruby
38
+ inspec_waiver 'openssh::.*' do
39
+ action :add
40
+ end
41
+ ```
42
42
 
43
- **Add an InSpec waiver to the Compliance Phase**:
43
+ **Add an InSpec waiver to the Compliance Phase**:
44
44
 
45
- ```ruby
46
- inspec_waiver 'Add waiver entry for control' do
47
- control 'my_inspec_control_01'
48
- run_test false
49
- justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
50
- expiration '2022-01-01'
51
- action :add
52
- end
53
- ```
45
+ ```ruby
46
+ inspec_waiver 'Add waiver entry for control' do
47
+ control 'my_inspec_control_01'
48
+ run_test false
49
+ justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
50
+ expiration '2022-01-01'
51
+ action :add
52
+ end
53
+ ```
54
54
 
55
- **Add an InSpec waiver to the Compliance Phase using the 'name' property to identify the control**:
55
+ **Add an InSpec waiver to the Compliance Phase using the 'name' property to identify the control**:
56
56
 
57
- ```ruby
58
- inspec_waiver 'my_inspec_control_01' do
59
- justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
60
- action :add
61
- end
62
- ```
57
+ ```ruby
58
+ inspec_waiver 'my_inspec_control_01' do
59
+ justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
60
+ action :add
61
+ end
62
+ ```
63
63
 
64
- **Add an InSpec waiver to the Compliance Phase using an arbitrary YAML, JSON, or TOML file**:
64
+ **Add an InSpec waiver to the Compliance Phase using an arbitrary YAML, JSON, or TOML file**:
65
65
 
66
- ```ruby
67
- # files ending in .yml or .yaml that exist are parsed as YAML
68
- inspec_waiver "/path/to/my/waiver.yml"
66
+ ```ruby
67
+ # files ending in .yml or .yaml that exist are parsed as YAML
68
+ inspec_waiver "/path/to/my/waiver.yml"
69
69
 
70
- inspec_waiver "my-waiver-name" do
71
- source "/path/to/my/waiver.yml"
72
- end
70
+ inspec_waiver "my-waiver-name" do
71
+ source "/path/to/my/waiver.yml"
72
+ end
73
73
 
74
- # files ending in .json that exist are parsed as JSON
75
- inspec_waiver "/path/to/my/waiver.json"
74
+ # files ending in .json that exist are parsed as JSON
75
+ inspec_waiver "/path/to/my/waiver.json"
76
76
 
77
- inspec_waiver "my-waiver-name" do
78
- source "/path/to/my/waiver.json"
79
- end
77
+ inspec_waiver "my-waiver-name" do
78
+ source "/path/to/my/waiver.json"
79
+ end
80
80
 
81
- # files ending in .toml that exist are parsed as TOML
82
- inspec_waiver "/path/to/my/waiver.toml"
81
+ # files ending in .toml that exist are parsed as TOML
82
+ inspec_waiver "/path/to/my/waiver.toml"
83
83
 
84
- inspec_waiver "my-waiver-name" do
85
- source "/path/to/my/waiver.toml"
86
- end
87
- ```
84
+ inspec_waiver "my-waiver-name" do
85
+ source "/path/to/my/waiver.toml"
86
+ end
87
+ ```
88
88
 
89
- **Add an InSpec waiver to the Compliance Phase using a hash**:
89
+ **Add an InSpec waiver to the Compliance Phase using a hash**:
90
90
 
91
- ```ruby
92
- my_hash = { "ssh-01" => {
93
- "expiration_date" => "2033-07-31",
94
- "run" => false,
95
- "justification" => "because"
96
- } }
91
+ ```ruby
92
+ my_hash = { "ssh-01" => {
93
+ "expiration_date" => "2033-07-31",
94
+ "run" => false,
95
+ "justification" => "because"
96
+ } }
97
97
 
98
- inspec_waiver "my-waiver-name" do
99
- source my_hash
100
- end
101
- ```
98
+ inspec_waiver "my-waiver-name" do
99
+ source my_hash
100
+ end
101
+ ```
102
102
 
103
- 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
104
- the resource while not causing the updated resource count to be larger than zero. Since the resource does not update the state of the managed node, this behavior
105
- is still consistent with the configuration management model. Instead, you should use events to observe configuration changes for the compliance phase. It is
106
- possible to use the `notify_group` resource to chain notifications of the two resources, but notifications are the wrong model to use, and you should use pure ruby
107
- conditionals instead. Compliance configuration should be independent of other resources and should only be conditional based on state/attributes, not other resources.
103
+ 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
104
+ the resource while not causing the updated resource count to be larger than zero. Since the resource does not update the state of the managed node, this behavior
105
+ is still consistent with the configuration management model. Instead, you should use events to observe configuration changes for the compliance phase. It is
106
+ possible to use the `notify_group` resource to chain notifications of the two resources, but notifications are the wrong model to use, and you should use pure ruby
107
+ conditionals instead. Compliance configuration should be independent of other resources and should only be conditional based on state/attributes, not other resources.
108
108
  DOC
109
109
 
110
110
  property :control, String,
@@ -28,35 +28,35 @@ class Chef
28
28
  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."
29
29
  introduced "17.1"
30
30
  examples <<~DOC
31
- **Add an InSpec waiver entry to a given waiver file**:
32
-
33
- ```ruby
34
- inspec_waiver_file_entry 'Add waiver entry for control' do
35
- file_path 'C:\\chef\\inspec_waiver_file.yml'
36
- control 'my_inspec_control_01'
37
- run_test false
38
- justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
39
- expiration '2022-01-01'
40
- action :add
41
- end
42
- ```
31
+ **Add an InSpec waiver entry to a given waiver file**:
32
+
33
+ ```ruby
34
+ inspec_waiver_file_entry 'Add waiver entry for control' do
35
+ file_path 'C:\\chef\\inspec_waiver_file.yml'
36
+ control 'my_inspec_control_01'
37
+ run_test false
38
+ justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
39
+ expiration '2022-01-01'
40
+ action :add
41
+ end
42
+ ```
43
43
 
44
- **Add an InSpec waiver entry to a given waiver file using the 'name' property to identify the control**:
44
+ **Add an InSpec waiver entry to a given waiver file using the 'name' property to identify the control**:
45
45
 
46
- ```ruby
47
- inspec_waiver_file_entry 'my_inspec_control_01' do
48
- justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
49
- action :add
50
- end
51
- ```
46
+ ```ruby
47
+ inspec_waiver_file_entry 'my_inspec_control_01' do
48
+ justification "The subject of this control is not managed by #{ChefUtils::Dist::Infra::PRODUCT} on the systems in policy group \#{node['policy_group']}"
49
+ action :add
50
+ end
51
+ ```
52
52
 
53
- **Remove an InSpec waiver entry to a given waiver file**:
53
+ **Remove an InSpec waiver entry to a given waiver file**:
54
54
 
55
- ```ruby
56
- inspec_waiver_file_entry "my_inspec_control_01" do
57
- action :remove
58
- end
59
- ```
55
+ ```ruby
56
+ inspec_waiver_file_entry "my_inspec_control_01" do
57
+ action :remove
58
+ end
59
+ ```
60
60
  DOC
61
61
 
62
62
  property :control, String,
@@ -24,11 +24,11 @@ class Chef
24
24
 
25
25
  provides :ksh
26
26
 
27
- description "Use the **ksh** resource to execute scripts using the Korn shell (ksh)"\
28
- " interpreter. This resource may also use any of the actions and properties"\
29
- " that are available to the **execute** resource. Commands that are executed"\
30
- " with this resource are (by their nature) not idempotent, as they are"\
31
- " typically unique to the environment in which they are run. Use `not_if`"\
27
+ description "Use the **ksh** resource to execute scripts using the Korn shell (ksh)" \
28
+ " interpreter. This resource may also use any of the actions and properties" \
29
+ " that are available to the **execute** resource. Commands that are executed" \
30
+ " with this resource are (by their nature) not idempotent, as they are" \
31
+ " typically unique to the environment in which they are run. Use `not_if`" \
32
32
  " and `only_if` to guard this resource for idempotence."
33
33
  introduced "12.6"
34
34
 
@@ -136,7 +136,7 @@ class Chef
136
136
  description: "Sets the log mask to `LOG_DEBUG` for this job."
137
137
 
138
138
  property :disabled, [ TrueClass, FalseClass ], default: false,
139
- description: "Hints to `launchctl` to not submit this job to launchd."
139
+ description: "Hints to `launchctl` to not submit this job to launchd."
140
140
 
141
141
  property :enable_globbing, [ TrueClass, FalseClass ],
142
142
  description: "Update program arguments before invocation."
@@ -190,7 +190,7 @@ class Chef
190
190
 
191
191
  property :nice, Integer,
192
192
  description: "The program scheduling priority value in the range -20 to 19.",
193
- callbacks: { "should be a Integer between -20 and 19" => proc { |v| v >= -20 && v <= 19 } }
193
+ callbacks: { "should be a Integer between -20 and 19" => proc { |v| v.between?(-20, 19) } }
194
194
 
195
195
  property :on_demand, [ TrueClass, FalseClass ],
196
196
  description: "Keep a job alive. Only applies to macOS version 10.4 (and earlier); use `keep_alive` instead for newer versions."
@@ -27,14 +27,14 @@ class Chef
27
27
 
28
28
  provides :link
29
29
 
30
- description "Use the **link** resource to create symbolic or hard links.\n\n"\
31
- "A symbolic link—sometimes referred to as a soft link—is a directory entry"\
32
- " that associates a file name with a string that contains an absolute or"\
33
- " relative path to a file on any file system. In other words, 'a file that"\
34
- " contains a path that points to another file.' A symbolic link creates a new"\
35
- " file with a new inode that points to the inode location of the original file.\n\n"\
36
- "A hard link is a directory entry that associates a file with another file in the"\
37
- " same file system. In other words, 'multiple directory entries to the same file.'"\
30
+ description "Use the **link** resource to create symbolic or hard links.\n\n" \
31
+ "A symbolic link—sometimes referred to as a soft link—is a directory entry" \
32
+ " that associates a file name with a string that contains an absolute or" \
33
+ " relative path to a file on any file system. In other words, 'a file that" \
34
+ " contains a path that points to another file.' A symbolic link creates a new" \
35
+ " file with a new inode that points to the inode location of the original file.\n\n" \
36
+ "A hard link is a directory entry that associates a file with another file in the" \
37
+ " same file system. In other words, 'multiple directory entries to the same file.'" \
38
38
  " A hard link creates a new file that points to the same inode as the original file."
39
39
 
40
40
  state_attrs :owner # required since it's not a property below
@@ -27,13 +27,13 @@ class Chef
27
27
  introduced "14.5"
28
28
 
29
29
  examples <<~DOC
30
- Set the lang to 'en_US.UTF-8'
30
+ Set the lang to 'en_US.UTF-8'
31
31
 
32
- ```ruby
33
- locale 'set system locale' do
34
- lang 'en_US.UTF-8'
35
- end
36
- ```
32
+ ```ruby
33
+ locale 'set system locale' do
34
+ lang 'en_US.UTF-8'
35
+ end
36
+ ```
37
37
  DOC
38
38
 
39
39
  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
@@ -32,10 +32,10 @@ class Chef
32
32
 
33
33
  provides :log, target_mode: true
34
34
 
35
- description "Use the **log** resource to create log entries. The log resource behaves"\
36
- " like any other resource: built into the resource collection during the"\
37
- " compile phase, and then run during the execution phase. (To create a log"\
38
- " entry that is not built into the resource collection, use Chef::Log instead"\
35
+ description "Use the **log** resource to create log entries. The log resource behaves" \
36
+ " like any other resource: built into the resource collection during the" \
37
+ " compile phase, and then run during the execution phase. (To create a log" \
38
+ " entry that is not built into the resource collection, use Chef::Log instead" \
39
39
  " of the log resource.)"
40
40
 
41
41
  property :message, String,
@@ -25,55 +25,55 @@ class Chef
25
25
 
26
26
  provides :mdadm
27
27
 
28
- description "Use the **mdadm** resource to manage RAID devices in a Linux environment using the mdadm utility. The mdadm resource"\
29
- " will create and assemble an array, but it will not create the config file that is used to persist the array upon"\
30
- " reboot. If the config file is required, it must be done by specifying a template with the correct array layout,"\
28
+ description "Use the **mdadm** resource to manage RAID devices in a Linux environment using the mdadm utility. The mdadm resource" \
29
+ " will create and assemble an array, but it will not create the config file that is used to persist the array upon" \
30
+ " reboot. If the config file is required, it must be done by specifying a template with the correct array layout," \
31
31
  " and then by using the mount provider to create a file systems table (fstab) entry."
32
32
 
33
33
  examples <<~DOC
34
- **Create and assemble a RAID 0 array**
34
+ **Create and assemble a RAID 0 array**
35
35
 
36
- 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:
36
+ 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:
37
37
 
38
- ```
39
- mdadm --create /dev/md0 --level=0 --raid-devices=10 /dev/s01.../dev/s10
40
- ```
38
+ ```
39
+ mdadm --create /dev/md0 --level=0 --raid-devices=10 /dev/s01.../dev/s10
40
+ ```
41
41
 
42
- 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:
42
+ 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:
43
43
 
44
- ```ruby
45
- mdadm '/dev/md0' do
46
- devices [ '/dev/s01', ... '/dev/s10' ]
47
- level 0
48
- action :create
49
- end
50
- ```
44
+ ```ruby
45
+ mdadm '/dev/md0' do
46
+ devices [ '/dev/s01', ... '/dev/s10' ]
47
+ level 0
48
+ action :create
49
+ end
50
+ ```
51
51
 
52
- (again, where /dev/s01 .. /dev/s10 represents devices /dev/s01, /dev/s02, /dev/s03, and so on).
52
+ (again, where /dev/s01 .. /dev/s10 represents devices /dev/s01, /dev/s02, /dev/s03, and so on).
53
53
 
54
- **Create and assemble a RAID 1 array**
54
+ **Create and assemble a RAID 1 array**
55
55
 
56
- ```ruby
57
- mdadm '/dev/md0' do
58
- devices [ '/dev/sda', '/dev/sdb' ]
59
- level 1
60
- action [ :create, :assemble ]
61
- end
62
- ```
56
+ ```ruby
57
+ mdadm '/dev/md0' do
58
+ devices [ '/dev/sda', '/dev/sdb' ]
59
+ level 1
60
+ action [ :create, :assemble ]
61
+ end
62
+ ```
63
63
 
64
- **Create and assemble a RAID 5 array**
64
+ **Create and assemble a RAID 5 array**
65
65
 
66
- 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:
66
+ 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:
67
67
 
68
- ```ruby
69
- mdadm '/dev/sd0' do
70
- devices [ '/dev/s1', '/dev/s2', '/dev/s3', '/dev/s4' ]
71
- level 5
72
- metadata '0.90'
73
- chunk 32
74
- action :create
75
- end
76
- ```
68
+ ```ruby
69
+ mdadm '/dev/sd0' do
70
+ devices [ '/dev/s1', '/dev/s2', '/dev/s3', '/dev/s4' ]
71
+ level 5
72
+ metadata '0.90'
73
+ chunk 32
74
+ action :create
75
+ end
76
+ ```
77
77
  DOC
78
78
 
79
79
  default_action :create
@@ -41,11 +41,11 @@ class Chef
41
41
  sensitive: true
42
42
 
43
43
  property :mount_point, String, name_property: true,
44
- coerce: proc { |arg| (arg == "/" || arg.match?(":/$")) ? arg : arg.chomp("/") }, # Removed "/" from the end of str, because it was causing idempotency issue.
45
- description: "The directory (or path) in which the device is to be mounted. Defaults to the name of the resource block if not provided."
44
+ coerce: proc { |arg| (arg == "/" || arg.match?(":/$")) ? arg : arg.chomp("/") }, # Removed "/" from the end of str, because it was causing idempotency issue.
45
+ description: "The directory (or path) in which the device is to be mounted. Defaults to the name of the resource block if not provided."
46
46
 
47
47
  property :device, String, identity: true,
48
- description: "Required for `:umount` and `:remount` actions (for the purpose of checking the mount command output for presence). The special block device or remote node, a label, or a uuid to be mounted."
48
+ description: "Required for `:umount` and `:remount` actions (for the purpose of checking the mount command output for presence). The special block device or remote node, a label, or a uuid to be mounted."
49
49
 
50
50
  property :device_type, [String, Symbol],
51
51
  description: "The type of device: :device, :label, or :uuid",
@@ -54,7 +54,7 @@ class Chef
54
54
  default: lazy { package_name }
55
55
 
56
56
  property :checksum, String, desired_state: false,
57
- description: "SHA-256 digest used to verify the checksum of the downloaded MSU package."
57
+ description: "SHA-256 digest used to verify the checksum of the downloaded MSU package."
58
58
 
59
59
  property :timeout, [String, Integer],
60
60
  default: 3600,