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,73 +27,73 @@ class Chef
27
27
 
28
28
  provides(:sudo) { true }
29
29
 
30
- description "Use the **sudo** resource to add or remove individual sudo entries using sudoers.d files."\
31
- " Sudo version 1.7.2 or newer is required to use the sudo resource, as it relies on the"\
32
- " `#includedir` directive introduced in version 1.7.2. This resource does not enforce"\
33
- " installation of the required sudo version. Chef-supported releases of Ubuntu, SuSE, Debian,"\
30
+ description "Use the **sudo** resource to add or remove individual sudo entries using sudoers.d files." \
31
+ " Sudo version 1.7.2 or newer is required to use the sudo resource, as it relies on the" \
32
+ " `#includedir` directive introduced in version 1.7.2. This resource does not enforce" \
33
+ " installation of the required sudo version. Chef-supported releases of Ubuntu, SuSE, Debian," \
34
34
  " and RHEL (6+) all support this feature."
35
35
  introduced "14.0"
36
36
  examples <<~DOC
37
- **Grant a user sudo privileges for any command**
37
+ **Grant a user sudo privileges for any command**
38
38
 
39
- ```ruby
40
- sudo 'admin' do
41
- user 'admin'
42
- end
43
- ```
39
+ ```ruby
40
+ sudo 'admin' do
41
+ user 'admin'
42
+ end
43
+ ```
44
44
 
45
- **Grant a user and groups sudo privileges for any command**
45
+ **Grant a user and groups sudo privileges for any command**
46
46
 
47
- ```ruby
48
- sudo 'admins' do
49
- users 'bob'
50
- groups 'sysadmins, superusers'
51
- end
52
- ```
47
+ ```ruby
48
+ sudo 'admins' do
49
+ users 'bob'
50
+ groups 'sysadmins, superusers'
51
+ end
52
+ ```
53
53
 
54
- **Grant passwordless sudo privileges for specific commands**
54
+ **Grant passwordless sudo privileges for specific commands**
55
55
 
56
- ```ruby
57
- sudo 'passwordless-access' do
58
- commands ['/bin/systemctl restart httpd', '/bin/systemctl restart mysql']
59
- nopasswd true
60
- end
61
- ```
62
-
63
- **Create command aliases and assign them to a group**
64
-
65
- ```ruby
66
- sudo 'webteam' do
67
- command_aliases [
68
- {
69
- 'name': 'WEBTEAM_SYSTEMD_JBOSS',
70
- 'command_list': [
71
- '/usr/bin/systemctl start eap7-standalone.service',
72
- '/usr/bin/systemctl start jbcs-httpd24-httpd.service', \
73
- '/usr/bin/systemctl stop eap7-standalone.service', \
74
- '/usr/bin/systemctl stop jbcs-httpd24-httpd.service', \
75
- '/usr/bin/systemctl restart eap7-standalone.service', \
76
- '/usr/bin/systemctl restart jbcs-httpd24-httpd.service', \
77
- '/usr/bin/systemctl --full edit eap7-standalone.service', \
78
- '/usr/bin/systemctl --full edit jbcs-httpd24-httpd.service', \
79
- '/usr/bin/systemctl daemon-reload',
80
- ]
81
- },
82
- {
83
- 'name': 'GENERIC_SYSTEMD',
84
- 'command_list': [
85
- '/usr/sbin/systemctl list-unit-files',
86
- '/usr/sbin/systemctl list-timers', \
87
- '/usr/sbin/systemctl is-active *', \
88
- '/usr/sbin/systemctl is-enabled *',
56
+ ```ruby
57
+ sudo 'passwordless-access' do
58
+ commands ['/bin/systemctl restart httpd', '/bin/systemctl restart mysql']
59
+ nopasswd true
60
+ end
61
+ ```
62
+
63
+ **Create command aliases and assign them to a group**
64
+
65
+ ```ruby
66
+ sudo 'webteam' do
67
+ command_aliases [
68
+ {
69
+ 'name': 'WEBTEAM_SYSTEMD_JBOSS',
70
+ 'command_list': [
71
+ '/usr/bin/systemctl start eap7-standalone.service',
72
+ '/usr/bin/systemctl start jbcs-httpd24-httpd.service', \
73
+ '/usr/bin/systemctl stop eap7-standalone.service', \
74
+ '/usr/bin/systemctl stop jbcs-httpd24-httpd.service', \
75
+ '/usr/bin/systemctl restart eap7-standalone.service', \
76
+ '/usr/bin/systemctl restart jbcs-httpd24-httpd.service', \
77
+ '/usr/bin/systemctl --full edit eap7-standalone.service', \
78
+ '/usr/bin/systemctl --full edit jbcs-httpd24-httpd.service', \
79
+ '/usr/bin/systemctl daemon-reload',
89
80
  ]
90
- }
91
- ]
92
- nopasswd true
93
- users '%webteam'
94
- commands [ 'WEBTEAM_SYSTEMD_JBOSS', 'GENERIC_SYSTEMD' ]
95
- end
96
- ```
81
+ },
82
+ {
83
+ 'name': 'GENERIC_SYSTEMD',
84
+ 'command_list': [
85
+ '/usr/sbin/systemctl list-unit-files',
86
+ '/usr/sbin/systemctl list-timers', \
87
+ '/usr/sbin/systemctl is-active *', \
88
+ '/usr/sbin/systemctl is-enabled *',
89
+ ]
90
+ }
91
+ ]
92
+ nopasswd true
93
+ users '%webteam'
94
+ commands [ 'WEBTEAM_SYSTEMD_JBOSS', 'GENERIC_SYSTEMD' ]
95
+ end
96
+ ```
97
97
  DOC
98
98
 
99
99
  # According to the sudo man pages sudo will ignore files in an include dir that have a `.` or `~`
@@ -235,16 +235,16 @@ class Chef
235
235
  local true
236
236
  mode "0440"
237
237
  variables sudoer: (new_resource.groups + new_resource.users).join(","),
238
- host: new_resource.host,
239
- runas: new_resource.runas,
240
- nopasswd: new_resource.nopasswd,
241
- noexec: new_resource.noexec,
242
- commands: new_resource.commands,
243
- command_aliases: new_resource.command_aliases,
244
- defaults: new_resource.defaults,
245
- setenv: new_resource.setenv,
246
- env_keep_add: new_resource.env_keep_add,
247
- env_keep_subtract: new_resource.env_keep_subtract
238
+ host: new_resource.host,
239
+ runas: new_resource.runas,
240
+ nopasswd: new_resource.nopasswd,
241
+ noexec: new_resource.noexec,
242
+ commands: new_resource.commands,
243
+ command_aliases: new_resource.command_aliases,
244
+ defaults: new_resource.defaults,
245
+ setenv: new_resource.setenv,
246
+ env_keep_add: new_resource.env_keep_add,
247
+ env_keep_subtract: new_resource.env_keep_subtract
248
248
  verify visudo_content(file_path) if visudo_present?
249
249
  action :create
250
250
  end
@@ -26,21 +26,21 @@ class Chef
26
26
  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."
27
27
  introduced "14.0"
28
28
  examples <<~DOC
29
- **Create a swap file**
29
+ **Create a swap file**
30
30
 
31
- ```ruby
32
- swap_file '/dev/sda1' do
33
- size 1024
34
- end
35
- ```
31
+ ```ruby
32
+ swap_file '/dev/sda1' do
33
+ size 1024
34
+ end
35
+ ```
36
36
 
37
- **Remove a swap file**
37
+ **Remove a swap file**
38
38
 
39
- ```ruby
40
- swap_file '/dev/sda1' do
41
- action :remove
42
- end
43
- ```
39
+ ```ruby
40
+ swap_file '/dev/sda1' do
41
+ action :remove
42
+ end
43
+ ```
44
44
  DOC
45
45
 
46
46
  property :path, String,
@@ -26,63 +26,63 @@ class Chef
26
26
 
27
27
  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`."
28
28
  examples <<~DOC
29
- **Set vm.swappiness**:
29
+ **Set vm.swappiness**:
30
30
 
31
- ```ruby
32
- sysctl 'vm.swappiness' do
33
- value 19
34
- end
35
- ```
31
+ ```ruby
32
+ sysctl 'vm.swappiness' do
33
+ value 19
34
+ end
35
+ ```
36
36
 
37
- **Remove kernel.msgmax**:
37
+ **Remove kernel.msgmax**:
38
38
 
39
- **Note**: This only removes the sysctl.d config for kernel.msgmax. The value will be set back to the kernel default value.
39
+ **Note**: This only removes the sysctl.d config for kernel.msgmax. The value will be set back to the kernel default value.
40
40
 
41
- ```ruby
42
- sysctl 'kernel.msgmax' do
43
- action :remove
44
- end
45
- ```
41
+ ```ruby
42
+ sysctl 'kernel.msgmax' do
43
+ action :remove
44
+ end
45
+ ```
46
46
 
47
- **Adding Comments to sysctl configuration files**:
47
+ **Adding Comments to sysctl configuration files**:
48
48
 
49
- ```ruby
50
- sysctl 'vm.swappiness' do
51
- value 19
52
- comment "define how aggressively the kernel will swap memory pages."
53
- end
54
- ```
49
+ ```ruby
50
+ sysctl 'vm.swappiness' do
51
+ value 19
52
+ comment "define how aggressively the kernel will swap memory pages."
53
+ end
54
+ ```
55
55
 
56
- This produces /etc/sysctl.d/99-chef-vm.swappiness.conf as follows:
56
+ This produces /etc/sysctl.d/99-chef-vm.swappiness.conf as follows:
57
57
 
58
- ```
59
- # define how aggressively the kernel will swap memory pages.
60
- vm.swappiness = 1
61
- ```
58
+ ```
59
+ # define how aggressively the kernel will swap memory pages.
60
+ vm.swappiness = 1
61
+ ```
62
62
 
63
- **Converting sysctl settings from shell scripts**:
63
+ **Converting sysctl settings from shell scripts**:
64
64
 
65
- Example of existing settings:
65
+ Example of existing settings:
66
66
 
67
- ```bash
68
- fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500 kernel.sem = 250 32000 100 128
69
- ```
67
+ ```bash
68
+ fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500 kernel.sem = 250 32000 100 128
69
+ ```
70
70
 
71
- Converted to sysctl resources:
71
+ Converted to sysctl resources:
72
72
 
73
- ```ruby
74
- sysctl 'fs.aio-max-nr' do
75
- value '1048576'
76
- end
73
+ ```ruby
74
+ sysctl 'fs.aio-max-nr' do
75
+ value '1048576'
76
+ end
77
77
 
78
- sysctl 'net.ipv4.ip_local_port_range' do
79
- value '9000 65500'
80
- end
78
+ sysctl 'net.ipv4.ip_local_port_range' do
79
+ value '9000 65500'
80
+ end
81
81
 
82
- sysctl 'kernel.sem' do
83
- value '250 32000 100 128'
84
- end
85
- ```
82
+ sysctl 'kernel.sem' do
83
+ value '250 32000 100 128'
84
+ end
85
+ ```
86
86
  DOC
87
87
 
88
88
  introduced "14.0"
@@ -29,45 +29,45 @@ class Chef
29
29
  description "Use the **systemd_unit** resource to create, manage, and run [systemd units](https://www.freedesktop.org/software/systemd/man/systemd.html#Concepts)."
30
30
  introduced "12.11"
31
31
  examples <<~DOC
32
- **Create systemd service unit file from a Hash**
33
-
34
- ```ruby
35
- systemd_unit 'etcd.service' do
36
- content({ Unit: {
37
- Description: 'Etcd',
38
- Documentation: ['https://coreos.com/etcd', 'man:etcd(1)'],
39
- After: 'network.target',
40
- },
41
- Service: {
42
- Type: 'notify',
43
- ExecStart: '/usr/local/etcd',
44
- Restart: 'always',
45
- },
46
- Install: {
47
- WantedBy: 'multi-user.target',
48
- } })
49
- action [:create, :enable]
50
- end
51
- ```
32
+ **Create systemd service unit file from a Hash**
33
+
34
+ ```ruby
35
+ systemd_unit 'etcd.service' do
36
+ content({ Unit: {
37
+ Description: 'Etcd',
38
+ Documentation: ['https://coreos.com/etcd', 'man:etcd(1)'],
39
+ After: 'network.target',
40
+ },
41
+ Service: {
42
+ Type: 'notify',
43
+ ExecStart: '/usr/local/etcd',
44
+ Restart: 'always',
45
+ },
46
+ Install: {
47
+ WantedBy: 'multi-user.target',
48
+ } })
49
+ action [:create, :enable]
50
+ end
51
+ ```
52
52
 
53
- **Create systemd service unit file from a String**
53
+ **Create systemd service unit file from a String**
54
54
 
55
- ```ruby
56
- systemd_unit 'sysstat-collect.timer' do
57
- content <<~EOU
58
- [Unit]
59
- Description=Run system activity accounting tool every 10 minutes
55
+ ```ruby
56
+ systemd_unit 'sysstat-collect.timer' do
57
+ content <<~EOU
58
+ [Unit]
59
+ Description=Run system activity accounting tool every 10 minutes
60
60
 
61
- [Timer]
62
- OnCalendar=*:00/10
61
+ [Timer]
62
+ OnCalendar=*:00/10
63
63
 
64
- [Install]
65
- WantedBy=sysstat.service
66
- EOU
64
+ [Install]
65
+ WantedBy=sysstat.service
66
+ EOU
67
67
 
68
- action [:create, :enable]
69
- end
70
- ```
68
+ action [:create, :enable]
69
+ end
70
+ ```
71
71
  DOC
72
72
 
73
73
  default_action :nothing
@@ -89,7 +89,7 @@ class Chef
89
89
 
90
90
  # User-provided properties
91
91
  property :user, String, desired_state: false,
92
- description: "The user account that the systemd unit process is run under. The path to the unit for that user would be something like '/etc/systemd/user/sshd.service'. If no user account is specified, the systemd unit will run under a 'system' account, with the path to the unit being something like '/etc/systemd/system/sshd.service'."
92
+ description: "The user account that the systemd unit process is run under. The path to the unit for that user would be something like '/etc/systemd/user/sshd.service'. If no user account is specified, the systemd unit will run under a 'system' account, with the path to the unit being something like '/etc/systemd/system/sshd.service'."
93
93
 
94
94
  property :content, [String, Hash],
95
95
  description: "A string or hash that contains a systemd [unit file](https://www.freedesktop.org/software/systemd/man/systemd.unit.html) definition that describes the properties of systemd-managed entities, such as services, sockets, devices, and so on. In #{ChefUtils::Dist::Infra::PRODUCT} 14.4 or later, repeatable options can be implemented with an array."
@@ -103,9 +103,9 @@ class Chef
103
103
  description: "Specifies if the unit will be verified before installation. Systemd can be overly strict when verifying units, so in certain cases it is preferable not to verify the unit."
104
104
 
105
105
  property :unit_name, String, desired_state: false,
106
- name_property: true,
107
- description: "The name of the unit file if it differs from the resource block's name.",
108
- introduced: "13.7"
106
+ name_property: true,
107
+ description: "The name of the unit file if it differs from the resource block's name.",
108
+ introduced: "13.7"
109
109
 
110
110
  def to_ini
111
111
  case content
@@ -28,27 +28,27 @@ class Chef
28
28
  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."
29
29
  introduced "14.6"
30
30
  examples <<~DOC
31
- **Set the timezone to UTC**
31
+ **Set the timezone to UTC**
32
32
 
33
- ```ruby
34
- timezone 'UTC'
35
- ```
33
+ ```ruby
34
+ timezone 'UTC'
35
+ ```
36
36
 
37
- **Set the timezone to America/Los_Angeles with a friendly resource name on Linux/macOS**
37
+ **Set the timezone to America/Los_Angeles with a friendly resource name on Linux/macOS**
38
38
 
39
- ```ruby
40
- timezone "Set the host's timezone to America/Los_Angeles" do
41
- timezone 'America/Los_Angeles'
42
- end
43
- ```
39
+ ```ruby
40
+ timezone "Set the host's timezone to America/Los_Angeles" do
41
+ timezone 'America/Los_Angeles'
42
+ end
43
+ ```
44
44
 
45
- **Set the timezone to PST with a friendly resource name on Windows**
45
+ **Set the timezone to PST with a friendly resource name on Windows**
46
46
 
47
- ```ruby
48
- timezone "Set the host's timezone to PST" do
49
- timezone 'Pacific Standard time'
50
- end
51
- ```
47
+ ```ruby
48
+ timezone "Set the host's timezone to PST" do
49
+ timezone 'Pacific Standard time'
50
+ end
51
+ ```
52
52
  DOC
53
53
 
54
54
  property :timezone, String,
@@ -90,9 +90,9 @@ class Chef
90
90
 
91
91
  password
92
92
  },
93
- callbacks: {
94
- "Password length must be >= 4" => ->(password) { password.size >= 4 },
95
- }
93
+ callbacks: {
94
+ "Password length must be >= 4" => ->(password) { password.size >= 4 },
95
+ }
96
96
 
97
97
  # Overload home so we set our default.
98
98
  property :home, String, description: "The user home directory", default: lazy { "/Users/#{name}" }
@@ -74,14 +74,14 @@ class Chef
74
74
  alias_method :group, :gid
75
75
 
76
76
  property :expire_date, [ String, NilClass ],
77
- description: "(Linux) The date on which the user account will be disabled. The date is specified in YYYY-MM-DD format.",
78
- introduced: "18.0",
79
- desired_state: false
77
+ description: "(Linux) The date on which the user account will be disabled. The date is specified in YYYY-MM-DD format.",
78
+ introduced: "18.0",
79
+ desired_state: false
80
80
 
81
81
  property :inactive, [ String, Integer, NilClass ],
82
- description: "(Linux) The number of days after a password expires until the account is permanently disabled. A value of `0` disables the account as soon as the password has expired, and a value of `-1` disables the feature.",
83
- introduced: "18.0",
84
- desired_state: false
82
+ description: "(Linux) The number of days after a password expires until the account is permanently disabled. A value of `0` disables the account as soon as the password has expired, and a value of `-1` disables the feature.",
83
+ introduced: "18.0",
84
+ desired_state: false
85
85
  end
86
86
  end
87
87
  end
@@ -28,31 +28,31 @@ class Chef
28
28
  description "Use the **user_ulimit** resource to create individual ulimit files that are installed into the `/etc/security/limits.d/` directory."
29
29
  introduced "16.0"
30
30
  examples <<~DOC
31
- **Set filehandle limit for the tomcat user**:
31
+ **Set filehandle limit for the tomcat user**:
32
32
 
33
- ```ruby
34
- user_ulimit 'tomcat' do
35
- filehandle_limit 8192
36
- end
37
- ```
33
+ ```ruby
34
+ user_ulimit 'tomcat' do
35
+ filehandle_limit 8192
36
+ end
37
+ ```
38
38
 
39
- **Specify a username that differs from the name given to the resource block**:
39
+ **Specify a username that differs from the name given to the resource block**:
40
40
 
41
- ```ruby
42
- user_ulimit 'Bump filehandle limits for tomcat user' do
43
- username 'tomcat'
44
- filehandle_limit 8192
45
- end
46
- ```
41
+ ```ruby
42
+ user_ulimit 'Bump filehandle limits for tomcat user' do
43
+ username 'tomcat'
44
+ filehandle_limit 8192
45
+ end
46
+ ```
47
47
 
48
- **Set filehandle limit for the tomcat user with a non-default filename**:
48
+ **Set filehandle limit for the tomcat user with a non-default filename**:
49
49
 
50
- ```ruby
51
- user_ulimit 'tomcat' do
52
- filehandle_limit 8192
53
- filename 'tomcat_filehandle_limits.conf'
54
- end
55
- ```
50
+ ```ruby
51
+ user_ulimit 'tomcat' do
52
+ filehandle_limit 8192
53
+ filename 'tomcat_filehandle_limits.conf'
54
+ end
55
+ ```
56
56
  DOC
57
57
 
58
58
  property :username, String, name_property: true
@@ -93,8 +93,8 @@ class Chef
93
93
  property :rtprio_hard_limit, [String, Integer]
94
94
  property :virt_limit, [String, Integer]
95
95
  property :filename, String,
96
- coerce: proc { |m| m.end_with?(".conf") ? m : m + ".conf" },
97
- default: lazy { |r| r.username == "*" ? "00_all_limits.conf" : "#{r.username}_limits.conf" }
96
+ coerce: proc { |m| m.end_with?(".conf") ? m : m + ".conf" },
97
+ default: lazy { |r| r.username == "*" ? "00_all_limits.conf" : "#{r.username}_limits.conf" }
98
98
 
99
99
  action :create, description: "Create a ulimit configuration file." do
100
100
  template "/etc/security/limits.d/#{new_resource.filename}" do
@@ -26,33 +26,33 @@ class Chef
26
26
  description "Use the **windows_ad_join** resource to join a Windows Active Directory domain."
27
27
  introduced "14.0"
28
28
  examples <<~DOC
29
- **Join a domain**
29
+ **Join a domain**
30
30
 
31
- ```ruby
32
- windows_ad_join 'ad.example.org' do
33
- domain_user 'nick'
34
- domain_password 'p@ssw0rd1'
35
- end
36
- ```
31
+ ```ruby
32
+ windows_ad_join 'ad.example.org' do
33
+ domain_user 'nick'
34
+ domain_password 'p@ssw0rd1'
35
+ end
36
+ ```
37
37
 
38
- **Join a domain, as `win-workstation`**
38
+ **Join a domain, as `win-workstation`**
39
39
 
40
- ```ruby
41
- windows_ad_join 'ad.example.org' do
42
- domain_user 'nick'
43
- domain_password 'p@ssw0rd1'
44
- new_hostname 'win-workstation'
45
- end
46
- ```
40
+ ```ruby
41
+ windows_ad_join 'ad.example.org' do
42
+ domain_user 'nick'
43
+ domain_password 'p@ssw0rd1'
44
+ new_hostname 'win-workstation'
45
+ end
46
+ ```
47
47
 
48
- **Leave the current domain and re-join the `local` workgroup**
48
+ **Leave the current domain and re-join the `local` workgroup**
49
49
 
50
- ```ruby
51
- windows_ad_join 'Leave domain' do
52
- action :leave
53
- workgroup 'local'
54
- end
55
- ```
50
+ ```ruby
51
+ windows_ad_join 'Leave domain' do
52
+ action :leave
53
+ workgroup 'local'
54
+ end
55
+ ```
56
56
  DOC
57
57
 
58
58
  property :domain_name, String,
@@ -65,7 +65,7 @@ class Chef
65
65
  description: "The domain user that will be used to join the domain.",
66
66
  required: true
67
67
 
68
- property :domain_password, String,
68
+ property :domain_password, String, sensitive: true,
69
69
  description: "The password for the domain user. Note that this resource is set to hide sensitive information by default. ",
70
70
  required: true
71
71
 
@@ -97,7 +97,7 @@ class Chef
97
97
 
98
98
  action :join, description: "Join the Active Directory domain." do
99
99
  unless on_desired_domain?
100
- cmd = "$pswd = ConvertTo-SecureString \'#{new_resource.domain_password}\' -AsPlainText -Force;"
100
+ cmd = "$pswd = ConvertTo-SecureString '#{new_resource.domain_password}' -AsPlainText -Force;"
101
101
  cmd << "$credential = New-Object System.Management.Automation.PSCredential (\"#{sanitize_usename}\",$pswd);"
102
102
  cmd << "Add-Computer -DomainName #{new_resource.domain_name} -Credential $credential"
103
103
  cmd << " -OUPath \"#{new_resource.ou_path}\"" if new_resource.ou_path
@@ -128,7 +128,7 @@ class Chef
128
128
  action :leave, description: "Leave an Active Directory domain and re-join a workgroup." do
129
129
  if joined_to_domain?
130
130
  cmd = ""
131
- cmd << "$pswd = ConvertTo-SecureString \'#{new_resource.domain_password}\' -AsPlainText -Force;"
131
+ cmd << "$pswd = ConvertTo-SecureString '#{new_resource.domain_password}' -AsPlainText -Force;"
132
132
  cmd << "$credential = New-Object System.Management.Automation.PSCredential (\"#{sanitize_usename}\",$pswd);"
133
133
  cmd << "Remove-Computer"
134
134
  cmd << " -UnjoinDomainCredential $credential"