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
@@ -31,46 +31,46 @@ class Chef
31
31
  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."
32
32
 
33
33
  examples <<~DOC
34
- Reload All Ohai Plugins
34
+ Reload All Ohai Plugins
35
35
 
36
- ```ruby
37
- ohai 'reload' do
38
- action :reload
39
- end
40
- ```
36
+ ```ruby
37
+ ohai 'reload' do
38
+ action :reload
39
+ end
40
+ ```
41
41
 
42
- Reload A Single Ohai Plugin
42
+ Reload A Single Ohai Plugin
43
43
 
44
- ```ruby
45
- ohai 'reload' do
46
- plugin 'ipaddress'
47
- action :reload
48
- end
49
- ```
44
+ ```ruby
45
+ ohai 'reload' do
46
+ plugin 'ipaddress'
47
+ action :reload
48
+ end
49
+ ```
50
50
 
51
- Reload Ohai after a new user is created
51
+ Reload Ohai after a new user is created
52
52
 
53
- ```ruby
54
- ohai 'reload_passwd' do
55
- action :nothing
56
- plugin 'etc'
57
- end
53
+ ```ruby
54
+ ohai 'reload_passwd' do
55
+ action :nothing
56
+ plugin 'etc'
57
+ end
58
58
 
59
- user 'daemon_user' do
60
- home '/dev/null'
61
- shell '/sbin/nologin'
62
- system true
63
- notifies :reload, 'ohai[reload_passwd]', :immediately
64
- end
59
+ user 'daemon_user' do
60
+ home '/dev/null'
61
+ shell '/sbin/nologin'
62
+ system true
63
+ notifies :reload, 'ohai[reload_passwd]', :immediately
64
+ end
65
65
 
66
- ruby_block 'just an example' do
67
- block do
68
- # These variables will now have the new values
69
- puts node['etc']['passwd']['daemon_user']['uid']
70
- puts node['etc']['passwd']['daemon_user']['gid']
66
+ ruby_block 'just an example' do
67
+ block do
68
+ # These variables will now have the new values
69
+ puts node['etc']['passwd']['daemon_user']['uid']
70
+ puts node['etc']['passwd']['daemon_user']['gid']
71
+ end
71
72
  end
72
- end
73
- ```
73
+ ```
74
74
  DOC
75
75
 
76
76
  property :plugin, String,
@@ -26,37 +26,37 @@ class Chef
26
26
  description "Use the **ohai_hint** resource to aid in configuration detection by passing hint data to Ohai."
27
27
  introduced "14.0"
28
28
  examples <<~DOC
29
- **Create a hint file**
29
+ **Create a hint file**
30
30
 
31
- ```ruby
32
- ohai_hint 'example' do
33
- content a: 'test_content'
34
- end
35
- ```
31
+ ```ruby
32
+ ohai_hint 'example' do
33
+ content a: 'test_content'
34
+ end
35
+ ```
36
36
 
37
- **Create a hint file with a name that does not match the resource name**
37
+ **Create a hint file with a name that does not match the resource name**
38
38
 
39
- ```ruby
40
- ohai_hint 'example' do
41
- hint_name 'custom'
42
- end
43
- ```
39
+ ```ruby
40
+ ohai_hint 'example' do
41
+ hint_name 'custom'
42
+ end
43
+ ```
44
44
 
45
- **Create a hint file that is not loaded at compile time**
45
+ **Create a hint file that is not loaded at compile time**
46
46
 
47
- ```ruby
48
- ohai_hint 'example' do
49
- compile_time false
50
- end
51
- ```
47
+ ```ruby
48
+ ohai_hint 'example' do
49
+ compile_time false
50
+ end
51
+ ```
52
52
 
53
- **Delete a hint file**
53
+ **Delete a hint file**
54
54
 
55
- ```ruby
56
- ohai_hint 'example' do
57
- action :delete
58
- end
59
- ```
55
+ ```ruby
56
+ ohai_hint 'example' do
57
+ action :delete
58
+ end
59
+ ```
60
60
  DOC
61
61
 
62
62
  property :hint_name, String,
@@ -60,7 +60,7 @@ class Chef
60
60
  description: "The desired curve of the generated key (if key_type is equal to 'ec'). Run openssl ecparam -list_curves to see available options.",
61
61
  default: "prime256v1"
62
62
 
63
- property :key_pass, String,
63
+ property :key_pass, String, sensitive: true,
64
64
  description: "The desired passphrase for the key."
65
65
 
66
66
  property :key_cipher, String,
@@ -89,7 +89,7 @@ class Chef
89
89
  action :create, description: "Generate the EC private key file." do
90
90
  unless new_resource.force || priv_key_file_valid?(new_resource.path, new_resource.key_pass)
91
91
  converge_by("Create an EC private key #{new_resource.path}") do
92
- log "Generating an #{new_resource.key_curve} "\
92
+ log "Generating an #{new_resource.key_curve} " \
93
93
  "EC key file at #{new_resource.path}, this may take some time"
94
94
 
95
95
  if new_resource.key_pass
@@ -56,10 +56,10 @@ class Chef
56
56
  property :private_key_path, String,
57
57
  description: "The path to the private key file."
58
58
 
59
- property :private_key_content, String,
59
+ property :private_key_content, String, sensitive: true,
60
60
  description: "The content of the private key including new lines. This property is used in place of private_key_path in instances where you want to avoid having to first write the private key to disk"
61
61
 
62
- property :private_key_pass, String,
62
+ property :private_key_pass, String, sensitive: true,
63
63
  description: "The passphrase of the provided private key."
64
64
 
65
65
  property :owner, [String, Integer],
@@ -59,7 +59,7 @@ class Chef
59
59
  description: "The desired bit length of the generated key.",
60
60
  default: 2048
61
61
 
62
- property :key_pass, String,
62
+ property :key_pass, String, sensitive: true,
63
63
  description: "The desired passphrase for the key."
64
64
 
65
65
  property :key_cipher, String,
@@ -57,10 +57,10 @@ class Chef
57
57
  property :private_key_path, String,
58
58
  description: "The path to the private key file."
59
59
 
60
- property :private_key_content, String,
60
+ property :private_key_content, String, sensitive: true,
61
61
  description: "The content of the private key, including new lines. This property is used in place of private_key_path in instances where you want to avoid having to first write the private key to disk."
62
62
 
63
- property :private_key_pass, String,
63
+ property :private_key_pass, String, sensitive: true,
64
64
  description: "The passphrase of the provided private key."
65
65
 
66
66
  property :owner, [String, Integer],
@@ -115,7 +115,7 @@ class Chef
115
115
  property :key_file, String,
116
116
  description: "The path to a certificate key file on the filesystem. If the key_file property is specified, the resource will attempt to source a key from this location. If no key file is found, the resource will generate a new key file at this location. If the key_file property is not specified, the resource will generate a key file in the same directory as the generated certificate, with the same name as the generated certificate."
117
117
 
118
- property :key_pass, String,
118
+ property :key_pass, String, sensitive: true,
119
119
  description: "The passphrase for an existing key's passphrase."
120
120
 
121
121
  property :key_type, String,
@@ -29,24 +29,24 @@ class Chef
29
29
  description "Use the **openssl_x509_crl** resource to generate PEM-formatted x509 certificate revocation list (CRL) files."
30
30
  introduced "14.4"
31
31
  examples <<~DOC
32
- **Create a certificate revocation file**
32
+ **Create a certificate revocation file**
33
33
 
34
- ```ruby
35
- openssl_x509_crl '/etc/ssl_test/my_ca.crl' do
36
- ca_cert_file '/etc/ssl_test/my_ca.crt'
37
- ca_key_file '/etc/ssl_test/my_ca.key'
38
- end
39
- ```
34
+ ```ruby
35
+ openssl_x509_crl '/etc/ssl_test/my_ca.crl' do
36
+ ca_cert_file '/etc/ssl_test/my_ca.crt'
37
+ ca_key_file '/etc/ssl_test/my_ca.key'
38
+ end
39
+ ```
40
40
 
41
- **Create a certificate revocation file for a particular serial**
41
+ **Create a certificate revocation file for a particular serial**
42
42
 
43
- ```ruby
44
- openssl_x509_crl '/etc/ssl_test/my_ca.crl' do
45
- ca_cert_file '/etc/ssl_test/my_ca.crt'
46
- ca_key_file '/etc/ssl_test/my_ca.key'
47
- serial_to_revoke C7BCB6602A2E4251EF4E2827A228CB52BC0CEA2F
48
- end
49
- ```
43
+ ```ruby
44
+ openssl_x509_crl '/etc/ssl_test/my_ca.crl' do
45
+ ca_cert_file '/etc/ssl_test/my_ca.crt'
46
+ ca_key_file '/etc/ssl_test/my_ca.key'
47
+ serial_to_revoke C7BCB6602A2E4251EF4E2827A228CB52BC0CEA2F
48
+ end
49
+ ```
50
50
  DOC
51
51
 
52
52
  property :path, String,
@@ -66,7 +66,7 @@ class Chef
66
66
  DOC
67
67
 
68
68
  property :path, String, name_property: true,
69
- description: "An optional property for specifying the path to write the file to if it differs from the resource block's name."
69
+ description: "An optional property for specifying the path to write the file to if it differs from the resource block's name."
70
70
 
71
71
  property :owner, [String, Integer],
72
72
  description: "The owner applied to all files created by the resource."
@@ -102,7 +102,7 @@ class Chef
102
102
  property :key_file, String,
103
103
  description: "The path to a certificate key file on the filesystem. If the `key_file` property is specified, the resource will attempt to source a key from this location. If no key file is found, the resource will generate a new key file at this location. If the `key_file` property is not specified, the resource will generate a key file in the same directory as the generated certificate, with the same name as the generated certificate."
104
104
 
105
- property :key_pass, String,
105
+ property :key_pass, String, sensitive: true,
106
106
  description: "The passphrase for an existing key's passphrase."
107
107
 
108
108
  property :key_type, String,
@@ -32,68 +32,68 @@ class Chef
32
32
  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."
33
33
  introduced "12.7"
34
34
  examples <<~DOC
35
- **Install a profile from a cookbook file**
36
-
37
- ```ruby
38
- osx_profile 'com.company.screensaver.mobileconfig'
39
- ```
40
-
41
- **Install profile from a hash**
42
-
43
- ```ruby
44
- profile_hash = {
45
- 'PayloadIdentifier' => 'com.company.screensaver',
46
- 'PayloadRemovalDisallowed' => false,
47
- 'PayloadScope' => 'System',
48
- 'PayloadType' => 'Configuration',
49
- 'PayloadUUID' => '1781fbec-3325-565f-9022-8aa28135c3cc',
50
- 'PayloadOrganization' => 'Chef',
51
- 'PayloadVersion' => 1,
52
- 'PayloadDisplayName' => 'Screensaver Settings',
53
- 'PayloadContent' => [
54
- {
55
- 'PayloadType' => 'com.apple.ManagedClient.preferences',
56
- 'PayloadVersion' => 1,
57
- 'PayloadIdentifier' => 'com.company.screensaver',
58
- 'PayloadUUID' => '73fc30e0-1e57-0131-c32d-000c2944c108',
59
- 'PayloadEnabled' => true,
60
- 'PayloadDisplayName' => 'com.apple.screensaver',
61
- 'PayloadContent' => {
62
- 'com.apple.screensaver' => {
63
- 'Forced' => [
64
- {
65
- 'mcx_preference_settings' => {
66
- 'idleTime' => 0,
35
+ **Install a profile from a cookbook file**
36
+
37
+ ```ruby
38
+ osx_profile 'com.company.screensaver.mobileconfig'
39
+ ```
40
+
41
+ **Install profile from a hash**
42
+
43
+ ```ruby
44
+ profile_hash = {
45
+ 'PayloadIdentifier' => 'com.company.screensaver',
46
+ 'PayloadRemovalDisallowed' => false,
47
+ 'PayloadScope' => 'System',
48
+ 'PayloadType' => 'Configuration',
49
+ 'PayloadUUID' => '1781fbec-3325-565f-9022-8aa28135c3cc',
50
+ 'PayloadOrganization' => 'Chef',
51
+ 'PayloadVersion' => 1,
52
+ 'PayloadDisplayName' => 'Screensaver Settings',
53
+ 'PayloadContent' => [
54
+ {
55
+ 'PayloadType' => 'com.apple.ManagedClient.preferences',
56
+ 'PayloadVersion' => 1,
57
+ 'PayloadIdentifier' => 'com.company.screensaver',
58
+ 'PayloadUUID' => '73fc30e0-1e57-0131-c32d-000c2944c108',
59
+ 'PayloadEnabled' => true,
60
+ 'PayloadDisplayName' => 'com.apple.screensaver',
61
+ 'PayloadContent' => {
62
+ 'com.apple.screensaver' => {
63
+ 'Forced' => [
64
+ {
65
+ 'mcx_preference_settings' => {
66
+ 'idleTime' => 0,
67
+ },
67
68
  },
68
- },
69
- ],
69
+ ],
70
+ },
70
71
  },
71
72
  },
72
- },
73
- ],
74
- }
73
+ ],
74
+ }
75
75
 
76
- osx_profile 'Install screensaver profile' do
77
- profile profile_hash
78
- end
79
- ```
76
+ osx_profile 'Install screensaver profile' do
77
+ profile profile_hash
78
+ end
79
+ ```
80
80
 
81
- **Remove profile using identifier in resource name**
81
+ **Remove profile using identifier in resource name**
82
82
 
83
- ```ruby
84
- osx_profile 'com.company.screensaver' do
85
- action :remove
86
- end
87
- ```
83
+ ```ruby
84
+ osx_profile 'com.company.screensaver' do
85
+ action :remove
86
+ end
87
+ ```
88
88
 
89
- **Remove profile by identifier and user friendly resource name**
89
+ **Remove profile by identifier and user friendly resource name**
90
90
 
91
- ```ruby
92
- osx_profile 'Remove screensaver profile' do
93
- identifier 'com.company.screensaver'
94
- action :remove
95
- end
96
- ```
91
+ ```ruby
92
+ osx_profile 'Remove screensaver profile' do
93
+ identifier 'com.company.screensaver'
94
+ action :remove
95
+ end
96
+ ```
97
97
  DOC
98
98
 
99
99
  property :profile_name, String,
@@ -24,12 +24,12 @@ class Chef
24
24
  class Package < Chef::Resource
25
25
  provides :package
26
26
 
27
- description "Use the **package** resource to manage packages. When the package is"\
28
- " installed from a local file (such as with RubyGems, dpkg, or RPM"\
29
- " Package Manager), the file must be added to the node using the remote_file"\
30
- " or cookbook_file resources.\n\nThis resource is the base resource for"\
31
- " several other resources used for package management on specific platforms."\
32
- " While it is possible to use each of these specific resources, it is"\
27
+ description "Use the **package** resource to manage packages. When the package is" \
28
+ " installed from a local file (such as with RubyGems, dpkg, or RPM" \
29
+ " Package Manager), the file must be added to the node using the remote_file" \
30
+ " or cookbook_file resources.\n\nThis resource is the base resource for" \
31
+ " several other resources used for package management on specific platforms." \
32
+ " While it is possible to use each of these specific resources, it is" \
33
33
  " recommended to use the package resource as often as possible."
34
34
 
35
35
  default_action :install
@@ -29,11 +29,11 @@ class Chef
29
29
  @interpreter = "perl"
30
30
  end
31
31
 
32
- description "Use the **perl** resource to execute scripts using the Perl interpreter."\
33
- " This resource may also use any of the actions and properties that are"\
34
- " available to the **execute** resource. Commands that are executed with this"\
35
- " resource are (by their nature) not idempotent, as they are typically"\
36
- " unique to the environment in which they are run. Use `not_if` and `only_if`"\
32
+ description "Use the **perl** resource to execute scripts using the Perl interpreter." \
33
+ " This resource may also use any of the actions and properties that are" \
34
+ " available to the **execute** resource. Commands that are executed with this" \
35
+ " resource are (by their nature) not idempotent, as they are typically" \
36
+ " unique to the environment in which they are run. Use `not_if` and `only_if`" \
37
37
  " to guard this resource for idempotence."
38
38
  end
39
39
  end
@@ -59,9 +59,9 @@ class Chef
59
59
  DEFAULTS_EXECUTABLE = "/usr/bin/defaults".freeze
60
60
  PLUTIL_EXECUTABLE = "/usr/bin/plutil".freeze
61
61
  PLUTIL_FORMAT_MAP = { "us-ascii" => "xml1",
62
- "text/xml" => "xml1",
63
- "utf-8" => "xml1",
64
- "binary" => "binary1" }.freeze
62
+ "text/xml" => "xml1",
63
+ "utf-8" => "xml1",
64
+ "binary" => "binary1" }.freeze
65
65
 
66
66
  load_current_value do |new_resource|
67
67
  current_value_does_not_exist! unless ::File.exist? new_resource.path
@@ -206,7 +206,7 @@ class Chef
206
206
  end
207
207
  entry_with_arg = ["\"#{entry}\"", arg].join(sep).strip
208
208
  subcommand = "#{subcommand.capitalize} :#{entry_with_arg}"
209
- [PLISTBUDDY_EXECUTABLE, "-c", "\'#{subcommand}\'", "\"#{path}\""].join(" ")
209
+ [PLISTBUDDY_EXECUTABLE, "-c", "'#{subcommand}'", "\"#{path}\""].join(" ")
210
210
  end
211
211
 
212
212
  def setting_from_plist(entry, path)
@@ -143,7 +143,7 @@ class Chef
143
143
  introduced: "17.6",
144
144
  description: "A username that, as part of a credential object, is used to register a repository or other package source with."
145
145
 
146
- property :password, String,
146
+ property :password, String, sensitive: true,
147
147
  introduced: "17.6",
148
148
  description: "A password that, as part of a credential object, is used to register a repository or other package source with."
149
149
 
@@ -239,17 +239,17 @@ class Chef
239
239
 
240
240
  def get_package_source_details
241
241
  powershell_exec! <<~EOH
242
- $package_details = Get-PackageSource -Name '#{new_resource.source_name}' -ErrorAction SilentlyContinue
243
- if ($package_details.ProviderName -match "PowerShellGet"){
244
- return "PSRepository"
245
- }
246
- elseif ($package_details.ProviderName ) {
247
- return "PackageSource"
248
- }
249
- elseif ($null -eq $package_details)
250
- {
251
- return "Unregistered"
252
- }
242
+ $package_details = Get-PackageSource -Name '#{new_resource.source_name}' -ErrorAction SilentlyContinue
243
+ if ($package_details.ProviderName -match "PowerShellGet"){
244
+ return "PSRepository"
245
+ }
246
+ elseif ($package_details.ProviderName ) {
247
+ return "PackageSource"
248
+ }
249
+ elseif ($null -eq $package_details)
250
+ {
251
+ return "Unregistered"
252
+ }
253
253
  EOH
254
254
  end
255
255
 
@@ -28,10 +28,10 @@ class Chef
28
28
  @interpreter = "python"
29
29
  end
30
30
 
31
- description "Use the **python** resource to execute scripts using the Python interpreter."\
32
- " This resource may also use any of the actions and properties that are available"\
33
- " to the **execute** resource. Commands that are executed with this resource are (by"\
34
- " their nature) not idempotent, as they are typically unique to the environment in"\
31
+ description "Use the **python** resource to execute scripts using the Python interpreter." \
32
+ " This resource may also use any of the actions and properties that are available" \
33
+ " to the **execute** resource. Commands that are executed with this resource are (by" \
34
+ " their nature) not idempotent, as they are typically unique to the environment in" \
35
35
  " which they are run. Use `not_if` and `only_if` to guard this resource for idempotence."
36
36
  end
37
37
  end
@@ -25,11 +25,11 @@ class Chef
25
25
 
26
26
  provides :reboot
27
27
 
28
- description "Use the **reboot** resource to reboot a node, a necessary step with some"\
29
- " installations on certain platforms. This resource is supported for use on"\
30
- " the Microsoft Windows, macOS, and Linux platforms.\n"\
31
- "In using this resource via notifications, it's important to *only* use"\
32
- " immediate notifications. Delayed notifications produce unintuitive and"\
28
+ description "Use the **reboot** resource to reboot a node, a necessary step with some" \
29
+ " installations on certain platforms. This resource is supported for use on" \
30
+ " the Microsoft Windows, macOS, and Linux platforms.\n" \
31
+ "In using this resource via notifications, it's important to *only* use" \
32
+ " immediate notifications. Delayed notifications produce unintuitive and" \
33
33
  " probably undesired results."
34
34
  introduced "12.0"
35
35
  examples <<~DOC