chef 17.1.35-universal-mingw32 → 17.4.38-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -4
  3. data/chef.gemspec +1 -0
  4. data/lib/chef/action_collection.rb +6 -26
  5. data/lib/chef/application/base.rb +15 -0
  6. data/lib/chef/application.rb +4 -2
  7. data/lib/chef/client.rb +7 -1
  8. data/lib/chef/compliance/default_attributes.rb +5 -3
  9. data/lib/chef/compliance/reporter/automate.rb +1 -1
  10. data/lib/chef/compliance/runner.rb +16 -2
  11. data/lib/chef/cookbook_version.rb +26 -4
  12. data/lib/chef/data_collector/run_end_message.rb +1 -1
  13. data/lib/chef/data_collector.rb +0 -1
  14. data/lib/chef/deprecated.rb +14 -4
  15. data/lib/chef/dsl/render_helpers.rb +44 -0
  16. data/lib/chef/dsl/secret.rb +64 -0
  17. data/lib/chef/dsl/toml.rb +116 -0
  18. data/lib/chef/dsl/universal.rb +5 -0
  19. data/lib/chef/dsl.rb +1 -0
  20. data/lib/chef/event_dispatch/base.rb +2 -1
  21. data/lib/chef/exceptions.rb +23 -0
  22. data/lib/chef/formatters/doc.rb +14 -13
  23. data/lib/chef/formatters/error_mapper.rb +2 -2
  24. data/lib/chef/formatters/minimal.rb +6 -5
  25. data/lib/chef/handler/slow_report.rb +66 -0
  26. data/lib/chef/handler.rb +46 -8
  27. data/lib/chef/http.rb +5 -5
  28. data/lib/chef/json_compat.rb +1 -1
  29. data/lib/chef/node.rb +20 -19
  30. data/lib/chef/policy_builder/policyfile.rb +88 -45
  31. data/lib/chef/provider/execute.rb +1 -1
  32. data/lib/chef/provider/file.rb +2 -2
  33. data/lib/chef/provider/group/dscl.rb +1 -1
  34. data/lib/chef/provider/launchd.rb +6 -6
  35. data/lib/chef/provider/lwrp_base.rb +1 -1
  36. data/lib/chef/provider/package/habitat.rb +168 -0
  37. data/lib/chef/provider/package/powershell.rb +5 -0
  38. data/lib/chef/provider/subversion.rb +4 -4
  39. data/lib/chef/provider/support/yum_repo.erb +1 -1
  40. data/lib/chef/provider/support/zypper_repo.erb +4 -2
  41. data/lib/chef/provider/systemd_unit.rb +17 -16
  42. data/lib/chef/provider/user/mac.rb +3 -3
  43. data/lib/chef/provider/yum_repository.rb +27 -43
  44. data/lib/chef/provider/zypper_repository.rb +30 -34
  45. data/lib/chef/provider.rb +26 -1
  46. data/lib/chef/provider_resolver.rb +8 -2
  47. data/lib/chef/providers.rb +1 -0
  48. data/lib/chef/resource/alternatives.rb +5 -5
  49. data/lib/chef/resource/apt_preference.rb +2 -2
  50. data/lib/chef/resource/apt_repository.rb +2 -2
  51. data/lib/chef/resource/apt_update.rb +4 -4
  52. data/lib/chef/resource/build_essential.rb +1 -1
  53. data/lib/chef/resource/chef_client_config.rb +10 -5
  54. data/lib/chef/resource/chef_client_cron.rb +3 -3
  55. data/lib/chef/resource/chef_client_launchd.rb +3 -3
  56. data/lib/chef/resource/chef_client_scheduled_task.rb +15 -15
  57. data/lib/chef/resource/chef_client_systemd_timer.rb +3 -3
  58. data/lib/chef/resource/chef_client_trusted_certificate.rb +2 -2
  59. data/lib/chef/resource/chef_handler.rb +2 -2
  60. data/lib/chef/resource/chef_sleep.rb +1 -1
  61. data/lib/chef/resource/chef_vault_secret.rb +2 -2
  62. data/lib/chef/resource/chocolatey_feature.rb +2 -2
  63. data/lib/chef/resource/chocolatey_source.rb +1 -1
  64. data/lib/chef/resource/cron/cron_d.rb +4 -6
  65. data/lib/chef/resource/cron_access.rb +1 -1
  66. data/lib/chef/resource/dmg_package.rb +1 -1
  67. data/lib/chef/resource/dsc_resource.rb +1 -1
  68. data/lib/chef/resource/execute.rb +5 -5
  69. data/lib/chef/resource/gem_package.rb +2 -1
  70. data/lib/chef/resource/group.rb +4 -4
  71. data/lib/chef/resource/habitat/_habitat_shared.rb +28 -0
  72. data/lib/chef/resource/habitat/habitat_package.rb +129 -0
  73. data/lib/chef/resource/habitat/habitat_sup.rb +329 -0
  74. data/lib/chef/resource/habitat/habitat_sup_systemd.rb +67 -0
  75. data/lib/chef/resource/habitat/habitat_sup_windows.rb +90 -0
  76. data/lib/chef/resource/habitat_config.rb +107 -0
  77. data/lib/chef/resource/habitat_install.rb +247 -0
  78. data/lib/chef/resource/habitat_service.rb +451 -0
  79. data/lib/chef/resource/habitat_user_toml.rb +92 -0
  80. data/lib/chef/resource/homebrew_cask.rb +18 -7
  81. data/lib/chef/resource/homebrew_package.rb +1 -1
  82. data/lib/chef/resource/homebrew_tap.rb +4 -3
  83. data/lib/chef/resource/homebrew_update.rb +2 -2
  84. data/lib/chef/resource/hostname.rb +49 -7
  85. data/lib/chef/resource/inspec_waiver_file_entry.rb +8 -7
  86. data/lib/chef/resource/kernel_module.rb +6 -6
  87. data/lib/chef/resource/launchd.rb +3 -3
  88. data/lib/chef/resource/locale.rb +1 -1
  89. data/lib/chef/resource/lwrp_base.rb +1 -1
  90. data/lib/chef/resource/macos_userdefaults.rb +2 -2
  91. data/lib/chef/resource/ohai_hint.rb +2 -6
  92. data/lib/chef/resource/openbsd_package.rb +17 -0
  93. data/lib/chef/resource/openssl_dhparam.rb +1 -2
  94. data/lib/chef/resource/openssl_ec_private_key.rb +1 -3
  95. data/lib/chef/resource/openssl_ec_public_key.rb +1 -3
  96. data/lib/chef/resource/openssl_rsa_private_key.rb +1 -3
  97. data/lib/chef/resource/openssl_rsa_public_key.rb +1 -3
  98. data/lib/chef/resource/openssl_x509_certificate.rb +1 -4
  99. data/lib/chef/resource/openssl_x509_crl.rb +1 -3
  100. data/lib/chef/resource/openssl_x509_request.rb +1 -3
  101. data/lib/chef/resource/osx_profile.rb +3 -3
  102. data/lib/chef/resource/plist.rb +1 -1
  103. data/lib/chef/resource/powershell_package_source.rb +2 -4
  104. data/lib/chef/resource/reboot.rb +38 -9
  105. data/lib/chef/resource/remote_directory.rb +2 -2
  106. data/lib/chef/resource/remote_file.rb +1 -1
  107. data/lib/chef/resource/rhsm_errata.rb +0 -2
  108. data/lib/chef/resource/rhsm_errata_level.rb +1 -5
  109. data/lib/chef/resource/rhsm_repo.rb +15 -0
  110. data/lib/chef/resource/rhsm_subscription.rb +5 -5
  111. data/lib/chef/resource/ruby_block.rb +100 -0
  112. data/lib/chef/resource/scm/subversion.rb +1 -1
  113. data/lib/chef/resource/ssh_known_hosts_entry.rb +4 -7
  114. data/lib/chef/resource/sudo.rb +2 -6
  115. data/lib/chef/resource/support/HabService.dll.config.erb +19 -0
  116. data/lib/chef/resource/support/client.erb +8 -1
  117. data/lib/chef/resource/support/sup.toml.erb +179 -0
  118. data/lib/chef/resource/swap_file.rb +2 -6
  119. data/lib/chef/resource/sysctl.rb +2 -2
  120. data/lib/chef/resource/systemd_unit.rb +3 -3
  121. data/lib/chef/resource/timezone.rb +1 -1
  122. data/lib/chef/resource/user_ulimit.rb +2 -2
  123. data/lib/chef/resource/windows_ad_join.rb +2 -2
  124. data/lib/chef/resource/windows_audit_policy.rb +2 -2
  125. data/lib/chef/resource/windows_auto_run.rb +2 -2
  126. data/lib/chef/resource/windows_certificate.rb +1 -1
  127. data/lib/chef/resource/windows_defender.rb +163 -0
  128. data/lib/chef/resource/windows_defender_exclusion.rb +125 -0
  129. data/lib/chef/resource/windows_dfs_folder.rb +2 -2
  130. data/lib/chef/resource/windows_dfs_namespace.rb +2 -2
  131. data/lib/chef/resource/windows_dns_record.rb +2 -2
  132. data/lib/chef/resource/windows_dns_zone.rb +2 -2
  133. data/lib/chef/resource/windows_feature.rb +3 -3
  134. data/lib/chef/resource/windows_feature_dism.rb +3 -5
  135. data/lib/chef/resource/windows_feature_powershell.rb +3 -3
  136. data/lib/chef/resource/windows_firewall_profile.rb +2 -2
  137. data/lib/chef/resource/windows_firewall_rule.rb +20 -6
  138. data/lib/chef/resource/windows_font.rb +1 -1
  139. data/lib/chef/resource/windows_pagefile.rb +103 -64
  140. data/lib/chef/resource/windows_path.rb +2 -2
  141. data/lib/chef/resource/windows_printer.rb +80 -61
  142. data/lib/chef/resource/windows_printer_port.rb +48 -65
  143. data/lib/chef/resource/windows_security_policy.rb +2 -2
  144. data/lib/chef/resource/windows_share.rb +2 -2
  145. data/lib/chef/resource/windows_shortcut.rb +1 -1
  146. data/lib/chef/resource/windows_task.rb +1 -1
  147. data/lib/chef/resource/windows_uac.rb +3 -5
  148. data/lib/chef/resource/windows_update_settings.rb +259 -0
  149. data/lib/chef/resource/windows_user_privilege.rb +2 -2
  150. data/lib/chef/resource/windows_workgroup.rb +2 -2
  151. data/lib/chef/resource/yum_package.rb +11 -15
  152. data/lib/chef/resource/zypper_package.rb +4 -4
  153. data/lib/chef/resource/zypper_repository.rb +28 -8
  154. data/lib/chef/resource.rb +13 -17
  155. data/lib/chef/resource_inspector.rb +6 -2
  156. data/lib/chef/resource_reporter.rb +0 -1
  157. data/lib/chef/resources.rb +12 -1
  158. data/lib/chef/secret_fetcher/aws_secrets_manager.rb +65 -0
  159. data/lib/chef/secret_fetcher/azure_key_vault.rb +78 -0
  160. data/lib/chef/secret_fetcher/base.rb +76 -0
  161. data/lib/chef/secret_fetcher/example.rb +46 -0
  162. data/lib/chef/secret_fetcher.rb +55 -0
  163. data/lib/chef/version.rb +1 -1
  164. data/spec/functional/mixin/from_file_spec.rb +1 -1
  165. data/spec/functional/resource/windows_hostname_spec.rb +91 -0
  166. data/spec/functional/resource/windows_pagefile_spec.rb +98 -0
  167. data/spec/integration/compliance/compliance_spec.rb +1 -0
  168. data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
  169. data/spec/integration/recipes/resource_action_spec.rb +6 -6
  170. data/spec/support/shared/unit/provider/file.rb +2 -8
  171. data/spec/unit/compliance/runner_spec.rb +46 -2
  172. data/spec/unit/cookbook_version_spec.rb +52 -0
  173. data/spec/unit/data_collector_spec.rb +47 -1
  174. data/spec/unit/dsl/render_helpers_spec.rb +102 -0
  175. data/spec/unit/dsl/secret_spec.rb +71 -0
  176. data/spec/unit/formatters/doc_spec.rb +1 -1
  177. data/spec/unit/handler_spec.rb +8 -2
  178. data/spec/unit/policy_builder/dynamic_spec.rb +0 -5
  179. data/spec/unit/policy_builder/policyfile_spec.rb +144 -56
  180. data/spec/unit/provider/apt_update_spec.rb +3 -1
  181. data/spec/unit/provider/mount/aix_spec.rb +1 -1
  182. data/spec/unit/provider/package/powershell_spec.rb +74 -12
  183. data/spec/unit/provider/zypper_repository_spec.rb +3 -10
  184. data/spec/unit/provider_spec.rb +23 -0
  185. data/spec/unit/resource/homebrew_cask_spec.rb +29 -11
  186. data/spec/unit/resource/rhsm_subscription_spec.rb +50 -3
  187. data/spec/unit/resource/systemd_unit_spec.rb +1 -1
  188. data/spec/unit/resource/windows_defender_exclusion_spec.rb +62 -0
  189. data/spec/unit/resource/windows_defender_spec.rb +71 -0
  190. data/spec/unit/resource/windows_firewall_rule_spec.rb +12 -7
  191. data/spec/unit/resource/windows_pagefile_spec.rb +4 -9
  192. data/spec/unit/resource/windows_update_settings_spec.rb +64 -0
  193. data/spec/unit/resource/zypper_repository_spec.rb +1 -1
  194. data/spec/unit/resource_spec.rb +19 -8
  195. data/spec/unit/secret_fetcher/aws_secrets_manager_spec.rb +70 -0
  196. data/spec/unit/secret_fetcher/azure_key_vault_spec.rb +70 -0
  197. data/spec/unit/secret_fetcher_spec.rb +82 -0
  198. metadata +55 -7
@@ -29,7 +29,7 @@ class Chef
29
29
  examples <<~DOC
30
30
  **Bare minimum #{ChefUtils::Dist::Infra::PRODUCT} client.rb**:
31
31
 
32
- The absolute minimum configuration necessary for a node to communicate with the Infra Server is the URL of the Infra Server. All other configuration options either have values at the server side (Policyfiles, Roles, Environments, etc) or have default values determined at client startup.
32
+ The absolute minimum configuration necessary for a node to communicate with the #{ChefUtils::Dist::Server::PRODUCT} is the URL of the #{ChefUtils::Dist::Server::PRODUCT}. All other configuration options either have values at the server side (Policyfiles, Roles, Environments, etc) or have default values determined at client startup.
33
33
 
34
34
  ```ruby
35
35
  chef_client_config 'Create client.rb' do
@@ -139,7 +139,7 @@ class Chef
139
139
  DESC
140
140
 
141
141
  property :formatters, Array,
142
- description: "",
142
+ description: "Client logging formatters to load.",
143
143
  default: []
144
144
 
145
145
  property :event_loggers, Array,
@@ -184,6 +184,10 @@ class Chef
184
184
  coerce: proc { |x| x.map { |v| string_to_symbol(v).capitalize } },
185
185
  default: []
186
186
 
187
+ property :policy_persist_run_list, [true, false],
188
+ description: "Override run lists defined in a Policyfile with the `run_list` defined on the #{ChefUtils::Dist::Server::PRODUCT}.",
189
+ introduced: "17.3"
190
+
187
191
  property :minimal_ohai, [true, false],
188
192
  description: "Run a minimal set of Ohai plugins providing data necessary for the execution of #{ChefUtils::Dist::Infra::PRODUCT}'s built-in resources. Setting this to true will skip many large and time consuming data sets such as `cloud` or `packages`. Setting this this to true may break cookbooks that assume all Ohai data will be present."
189
193
 
@@ -227,7 +231,7 @@ class Chef
227
231
  property :additional_config, String,
228
232
  description: "Additional text to add at the bottom of the client.rb config. This can be used to run custom Ruby or to add less common config options"
229
233
 
230
- action :create, description: "Create a client.rb config file" do
234
+ action :create, description: "Create a client.rb config file for configuring #{ChefUtils::Dist::Infra::PRODUCT}." do
231
235
  unless ::Dir.exist?(new_resource.config_directory)
232
236
  directory new_resource.config_directory do
233
237
  user new_resource.user unless new_resource.user.nil?
@@ -277,14 +281,15 @@ class Chef
277
281
  report_handlers: format_handler(new_resource.report_handlers),
278
282
  ssl_verify_mode: new_resource.ssl_verify_mode,
279
283
  start_handlers: format_handler(new_resource.start_handlers),
280
- additional_config: new_resource.additional_config
284
+ additional_config: new_resource.additional_config,
285
+ policy_persist_run_list: new_resource.policy_persist_run_list
281
286
  )
282
287
  mode "0640"
283
288
  action :create
284
289
  end
285
290
  end
286
291
 
287
- action :remove, description: "Remove a client.rb config file" do
292
+ action :remove, description: "Remove a client.rb config file for configuring #{ChefUtils::Dist::Infra::PRODUCT}." do
288
293
  file ::File.join(new_resource.config_directory, "client.rb") do
289
294
  action :delete
290
295
  end
@@ -106,7 +106,7 @@ class Chef
106
106
  description: "The e-mail address to e-mail any cron task failures to."
107
107
 
108
108
  property :accept_chef_license, [true, false],
109
- description: "Accept the Chef Online Master License and Services Agreement. See <https://www.chef.io/online-master-agreement/>",
109
+ description: "Accept the Chef Online Master License and Services Agreement. See <https://www.chef.io/online-master-agreement>",
110
110
  default: false
111
111
 
112
112
  property :config_directory, String,
@@ -144,7 +144,7 @@ class Chef
144
144
  coerce: proc { |x| Integer(x) },
145
145
  callbacks: { "should be an Integer between -20 and 19" => proc { |v| v >= -20 && v <= 19 } }
146
146
 
147
- action :add, description: "Add a cron job to run #{ChefUtils::Dist::Infra::PRODUCT}" do
147
+ action :add, description: "Add a cron job to run #{ChefUtils::Dist::Infra::PRODUCT}." do
148
148
  # TODO: Replace this with a :create_if_missing action on directory when that exists
149
149
  unless ::Dir.exist?(new_resource.log_directory)
150
150
  directory new_resource.log_directory do
@@ -168,7 +168,7 @@ class Chef
168
168
  end
169
169
  end
170
170
 
171
- action :remove, description: "Remove a cron job for #{ChefUtils::Dist::Infra::PRODUCT}" do
171
+ action :remove, description: "Remove a cron job for #{ChefUtils::Dist::Infra::PRODUCT}." do
172
172
  declare_resource(cron_resource_type, new_resource.job_name) do
173
173
  action :delete
174
174
  end
@@ -65,7 +65,7 @@ class Chef
65
65
  description: "A random number of seconds between 0 and X to add to interval so that all #{ChefUtils::Dist::Infra::CLIENT} commands don't execute at the same time."
66
66
 
67
67
  property :accept_chef_license, [true, false],
68
- description: "Accept the Chef Online Master License and Services Agreement. See <https://www.chef.io/online-master-agreement/>",
68
+ description: "Accept the Chef Online Master License and Services Agreement. See <https://www.chef.io/online-master-agreement>",
69
69
  default: false
70
70
 
71
71
  property :config_directory, String,
@@ -101,7 +101,7 @@ class Chef
101
101
  description: "Run the #{ChefUtils::Dist::Infra::CLIENT} process with low priority disk IO",
102
102
  default: true
103
103
 
104
- action :enable do
104
+ action :enable, description: "Enable running #{ChefUtils::Dist::Infra::PRODUCT} on a schedule using launchd." do
105
105
  unless ::Dir.exist?(new_resource.log_directory)
106
106
  directory new_resource.log_directory do
107
107
  owner new_resource.user
@@ -148,7 +148,7 @@ class Chef
148
148
  end
149
149
  end
150
150
 
151
- action :disable do
151
+ action :disable, description: "Disable running #{ChefUtils::Dist::Infra::PRODUCT} on a schedule using launchd" do
152
152
  service ChefUtils::Dist::Infra::PRODUCT do
153
153
  service_name "com.#{ChefUtils::Dist::Infra::SHORT}.#{ChefUtils::Dist::Infra::CLIENT}"
154
154
  action :disable
@@ -30,33 +30,33 @@ class Chef
30
30
  **Setup #{ChefUtils::Dist::Infra::PRODUCT} to run using the default 30 minute cadence**:
31
31
 
32
32
  ```ruby
33
- chef_client_scheduled_task 'Run #{ChefUtils::Dist::Infra::PRODUCT} as a scheduled task'
33
+ chef_client_scheduled_task 'Run #{ChefUtils::Dist::Infra::PRODUCT} as a scheduled task'
34
34
  ```
35
35
 
36
36
  **Run #{ChefUtils::Dist::Infra::PRODUCT} on system start**:
37
37
 
38
38
  ```ruby
39
- chef_client_scheduled_task '#{ChefUtils::Dist::Infra::PRODUCT} on start' do
40
- frequency 'onstart'
41
- end
39
+ chef_client_scheduled_task '#{ChefUtils::Dist::Infra::PRODUCT} on start' do
40
+ frequency 'onstart'
41
+ end
42
42
  ```
43
43
 
44
44
  **Run #{ChefUtils::Dist::Infra::PRODUCT} with extra options passed to the client**:
45
45
 
46
46
  ```ruby
47
- chef_client_scheduled_task 'Run an override recipe' do
48
- daemon_options ['--override-runlist mycorp_base::default']
49
- end
47
+ chef_client_scheduled_task 'Run an override recipe' do
48
+ daemon_options ['--override-runlist mycorp_base::default']
49
+ end
50
50
  ```
51
51
 
52
52
  **Run #{ChefUtils::Dist::Infra::PRODUCT} daily at 01:00 am, specifying a named run-list**:
53
53
 
54
54
  ```ruby
55
- chef_client_scheduled_task 'Run chef-client named run-list daily' do
56
- frequency 'daily'
57
- start_time '01:00'
58
- daemon_options ['-n audit_only']
59
- end
55
+ chef_client_scheduled_task 'Run chef-client named run-list daily' do
56
+ frequency 'daily'
57
+ start_time '01:00'
58
+ daemon_options ['-n audit_only']
59
+ end
60
60
  ```
61
61
  DOC
62
62
 
@@ -87,7 +87,7 @@ class Chef
87
87
  default_description: "30 if frequency is 'minute', 1 otherwise"
88
88
 
89
89
  property :accept_chef_license, [true, false],
90
- description: "Accept the Chef Online Master License and Services Agreement. See <https://www.chef.io/online-master-agreement/>",
90
+ description: "Accept the Chef Online Master License and Services Agreement. See <https://www.chef.io/online-master-agreement>",
91
91
  default: false
92
92
 
93
93
  property :start_date, String,
@@ -129,7 +129,7 @@ class Chef
129
129
  description: "An array of options to pass to the #{ChefUtils::Dist::Infra::CLIENT} command.",
130
130
  default: []
131
131
 
132
- action :add do
132
+ action :add, description: "Add a Windows Scheduled Task that runs #{ChefUtils::Dist::Infra::PRODUCT}." do
133
133
  # TODO: Replace this with a :create_if_missing action on directory when that exists
134
134
  unless Dir.exist?(new_resource.log_directory)
135
135
  directory new_resource.log_directory do
@@ -157,7 +157,7 @@ class Chef
157
157
  end
158
158
  end
159
159
 
160
- action :remove do
160
+ action :remove, description: "Remove a Windows Scheduled Task that runs #{ChefUtils::Dist::Infra::PRODUCT}." do
161
161
  windows_task new_resource.task_name do
162
162
  action :delete
163
163
  end
@@ -75,7 +75,7 @@ class Chef
75
75
  default: "5min"
76
76
 
77
77
  property :accept_chef_license, [true, false],
78
- description: "Accept the Chef Online Master License and Services Agreement. See <https://www.chef.io/online-master-agreement/>",
78
+ description: "Accept the Chef Online Master License and Services Agreement. See <https://www.chef.io/online-master-agreement>",
79
79
  default: false
80
80
 
81
81
  property :run_on_battery, [true, false],
@@ -104,7 +104,7 @@ class Chef
104
104
  coerce: proc { |x| Integer(x) },
105
105
  callbacks: { "should be a positive Integer" => proc { |v| v > 0 } }
106
106
 
107
- action :add do
107
+ action :add, description: "Add a systemd timer that runs #{ChefUtils::Dist::Infra::PRODUCT}." do
108
108
  systemd_unit "#{new_resource.job_name}.service" do
109
109
  content service_content
110
110
  action :create
@@ -116,7 +116,7 @@ class Chef
116
116
  end
117
117
  end
118
118
 
119
- action :remove do
119
+ action :remove, description: "Remove a systemd timer that runs #{ChefUtils::Dist::Infra::PRODUCT}." do
120
120
  systemd_unit "#{new_resource.job_name}.service" do
121
121
  action :delete
122
122
  end
@@ -64,7 +64,7 @@ class Chef
64
64
  property :certificate, String, required: [:add],
65
65
  description: "The text of the certificate file including the BEGIN/END comment lines."
66
66
 
67
- action :add do
67
+ action :add, description: "Add a trusted certificate to #{ChefUtils::Dist::Infra::PRODUCT}'s trusted certificate directory" do
68
68
  unless ::Dir.exist?(Chef::Config[:trusted_certs_dir])
69
69
  directory Chef::Config[:trusted_certs_dir] do
70
70
  mode "0640"
@@ -78,7 +78,7 @@ class Chef
78
78
  end
79
79
  end
80
80
 
81
- action :remove do
81
+ action :remove, description: "Remove a trusted certificate from #{ChefUtils::Dist::Infra::PRODUCT}'s trusted certificate directory" do
82
82
  file cert_path do
83
83
  action :delete
84
84
  end
@@ -194,7 +194,7 @@ class Chef
194
194
 
195
195
  # This action needs to find an rb file that presumably contains the indicated class in it and the
196
196
  # load that file. It then instantiates that class by name and registers it as a handler.
197
- action :enable, description: "Enables the handler for the current #{ChefUtils::Dist::Infra::PRODUCT} run on the current node" do
197
+ action :enable, description: "Enables the handler for the current #{ChefUtils::Dist::Infra::PRODUCT} run on the current node." do
198
198
  class_name = new_resource.class_name
199
199
  new_resource.type.each do |type, enable|
200
200
  next unless enable
@@ -216,7 +216,7 @@ class Chef
216
216
  end
217
217
  end
218
218
 
219
- action :disable, description: "Disables the handler for the current #{ChefUtils::Dist::Infra::PRODUCT} run on the current node" do
219
+ action :disable, description: "Disables the handler for the current #{ChefUtils::Dist::Infra::PRODUCT} run on the current node." do
220
220
  new_resource.type.each_key do |type|
221
221
  unregister_handler(type, new_resource.class_name)
222
222
  end
@@ -62,7 +62,7 @@ class Chef
62
62
  coerce: proc { |s| Integer(s) },
63
63
  name_property: true
64
64
 
65
- action :sleep, description: "Pause the #{ChefUtils::Dist::Infra::PRODUCT} run for a specified number of seconds" do
65
+ action :sleep, description: "Pause the #{ChefUtils::Dist::Infra::PRODUCT} run for a specified number of seconds." do
66
66
  converge_by("sleep #{new_resource.seconds} seconds") do
67
67
  sleep(new_resource.seconds)
68
68
  end
@@ -33,7 +33,7 @@ class Chef
33
33
  ```ruby
34
34
  chef_vault_secret 'foo' do
35
35
  data_bag 'bar'
36
- raw_data({'auth' => 'baz'})
36
+ raw_data({ 'auth' => 'baz' })
37
37
  admins 'jtimberman'
38
38
  search '*:*'
39
39
  end
@@ -45,7 +45,7 @@ class Chef
45
45
  chef_vault_secret 'root-password' do
46
46
  admins 'jtimberman,paulmooring'
47
47
  data_bag 'secrets'
48
- raw_data({'auth' => 'DoNotUseThisPasswordForRoot'})
48
+ raw_data({ 'auth' => 'DoNotUseThisPasswordForRoot' })
49
49
  search '*:*'
50
50
  end
51
51
  ```
@@ -65,7 +65,7 @@ class Chef
65
65
  data ? data.attribute("enabled").to_s : nil # REXML just returns nil if it can't find anything so avoid an undefined method error
66
66
  end
67
67
 
68
- action :enable, description: "Enables a named Chocolatey feature" do
68
+ action :enable, description: "Enables a named Chocolatey feature." do
69
69
  if current_resource.feature_state != true
70
70
  converge_by("enable Chocolatey feature '#{new_resource.feature_name}'") do
71
71
  shell_out!(choco_cmd("enable"))
@@ -73,7 +73,7 @@ class Chef
73
73
  end
74
74
  end
75
75
 
76
- action :disable, description: "Disables a named Chocolatey feature" do
76
+ action :disable, description: "Disables a named Chocolatey feature." do
77
77
  if current_resource.feature_state == true
78
78
  converge_by("disable Chocolatey feature '#{new_resource.feature_name}'") do
79
79
  shell_out!(choco_cmd("disable"))
@@ -98,7 +98,7 @@ class Chef
98
98
  end
99
99
  end
100
100
 
101
- action :remove, description: "Removes a Chocolatey source" do
101
+ action :remove, description: "Removes a Chocolatey source." do
102
102
 
103
103
  if current_resource
104
104
  converge_by("remove Chocolatey source '#{new_resource.source_name}'") do
@@ -29,7 +29,7 @@ class Chef
29
29
  provides :cron_d
30
30
 
31
31
  introduced "14.4"
32
- description "Use the **cron_d** resource to manage cron job files in the /etc/cron.d directory. This is similar to the 'cron' resource, but it does not use the monolithic /etc/crontab file."
32
+ description "Use the **cron_d** resource to manage cron job files in the `/etc/cron.d` directory. This is similar to the 'cron' resource, but it does not use the monolithic /etc/crontab file."
33
33
  examples <<~DOC
34
34
  **Run a program on the fifth hour of the day**
35
35
 
@@ -116,19 +116,17 @@ class Chef
116
116
  end
117
117
 
118
118
  action :create do
119
- description "Add a cron definition file to /etc/cron.d."
119
+ description "Add a cron definition file to `/etc/cron.d`."
120
120
 
121
121
  create_template(:create)
122
122
  end
123
123
 
124
- action :create_if_missing do
125
- description "Add a cron definition file to /etc/cron.d, but do not update an existing file."
124
+ action :create_if_missing, description: "Add a cron definition file to `/etc/cron.d`, but do not update an existing file." do
126
125
 
127
126
  create_template(:create_if_missing)
128
127
  end
129
128
 
130
- action :delete do
131
- description "Remove a cron definition file from /etc/cron.d if it exists."
129
+ action :delete, description: "Remove a cron definition file from `/etc/cron.d` if it exists." do
132
130
 
133
131
  # cleanup the legacy named job if it exists
134
132
  file "legacy named cron.d file" do
@@ -64,7 +64,7 @@ class Chef
64
64
  "default" => "/etc",
65
65
  }.freeze
66
66
 
67
- action :allow, description: "Add the user to the cron.allow file" do
67
+ action :allow, description: "Add the user to the cron.allow file." do
68
68
  allow_path = ::File.join(value_for_platform_family(CRON_PATHS), "cron.allow")
69
69
 
70
70
  with_run_context :root do
@@ -121,7 +121,7 @@ class Chef
121
121
  end
122
122
  end
123
123
 
124
- action :install, description: "Installs the application" do
124
+ action :install, description: "Installs the application." do
125
125
  if current_resource.nil?
126
126
  if new_resource.source
127
127
  remote_file dmg_file do
@@ -74,7 +74,7 @@ class Chef
74
74
 
75
75
  property :module_version, String,
76
76
  introduced: "12.21",
77
- description: "The version number of the module to use. PowerShell 5.0.10018.0 (or higher) supports having multiple versions of a module installed. This should be specified along with the module_name."
77
+ description: "The version number of the module to use. PowerShell 5.0.10018.0 (or higher) supports having multiple versions of a module installed. This should be specified along with the `module_name` property."
78
78
 
79
79
  def property(property_name, value = nil)
80
80
  unless property_name.is_a?(Symbol)
@@ -304,9 +304,9 @@ class Chef
304
304
  gives a recipe full control over the command issued in a much cleaner, more
305
305
  direct manner.
306
306
 
307
- **Use the search recipe DSL method to find users**:
307
+ **Use the search Infra Language helper to find users**:
308
308
 
309
- The following example shows how to use the `search` method in the Recipe DSL to
309
+ The following example shows how to use the `search` method in the Chef Infra Language to
310
310
  search for users:
311
311
 
312
312
  ```ruby
@@ -515,7 +515,7 @@ class Chef
515
515
 
516
516
  property :command, [ String, Array ],
517
517
  name_property: true,
518
- description: "An optional property to set the command to be executed if it differs from the resource block's name."
518
+ description: "An optional property to set the command to be executed if it differs from the resource block's name. Note: Use the **execute** resource to run a single command. Use multiple **execute** resource blocks to run multiple commands."
519
519
 
520
520
  property :umask, [ String, Integer ],
521
521
  description: "The file mode creation mask, or umask."
@@ -549,11 +549,11 @@ class Chef
549
549
  desired_state: false
550
550
 
551
551
  property :user, [ String, Integer ],
552
- description: "The user name of the user identity with which to launch the new process. The user name may optionally be specified with a domain, i.e. `domainuser` or `user@my.dns.domain.com` via Universal Principal Name (UPN)format. It can also be specified without a domain simply as user if the domain is instead specified using the domain property. On Windows only, if this property is specified, the password property must be specified."
552
+ description: "The user name of the user identity with which to launch the new process. The user name may optionally be specified with a domain, i.e. `domain\\user` or `user@my.dns.domain.com` via Universal Principal Name (UPN)format. It can also be specified without a domain simply as user if the domain is instead specified using the domain property. On Windows only, if this property is specified, the password property must be specified."
553
553
 
554
554
  property :domain, String,
555
555
  introduced: "12.21",
556
- description: "Windows only: The domain of the user user specified by the user property. If not specified, the username and password specified by the `user` and `password` properties will be used to resolve that user against the domain in which the system running #{ChefUtils::Dist::Infra::PRODUCT} is joined, or if that system is not joined to a domain it will resolve the user as a local account on that system. An alternative way to specify the domain is to leave this property unspecified and specify the domain as part of the user property."
556
+ description: "Windows only: The domain of the user specified by the user property. If not specified, the username and password specified by the `user` and `password` properties will be used to resolve that user against the domain in which the system running #{ChefUtils::Dist::Infra::PRODUCT} is joined, or if that system is not joined to a domain it will resolve the user as a local account on that system. An alternative way to specify the domain is to leave this property unspecified and specify the domain as part of the user property."
557
557
 
558
558
  property :password, String, sensitive: true,
559
559
  introduced: "12.21",
@@ -83,7 +83,8 @@ class Chef
83
83
 
84
84
  property :clear_sources, [ TrueClass, FalseClass, nil ],
85
85
  description: "Set to `true` to download a gem from the path specified by the `source` property (and not from RubyGems).",
86
- default: lazy { Chef::Config[:clear_gem_sources] }, desired_state: false
86
+ default: lazy { Chef::Config[:clear_gem_sources] },
87
+ default_description: "false unless `clear_gem_sources` set to true in the `client.rb` config.", desired_state: false
87
88
 
88
89
  property :gem_binary, String, desired_state: false,
89
90
  description: "The path of a gem binary to use for the installation. By default, the same version of Ruby that is used by #{ChefUtils::Dist::Infra::PRODUCT} will be used."
@@ -43,16 +43,16 @@ class Chef
43
43
 
44
44
  property :excluded_members, [String, Array], default: [],
45
45
  coerce: proc { |arg| arg.is_a?(String) ? arg.split(/\s*,\s*/) : arg },
46
- description: "Remove users from a group. May only be used when append is set to true."
46
+ description: "Remove users from a group. May only be used when `append` is set to `true`."
47
47
 
48
48
  property :append, [ TrueClass, FalseClass ], default: false,
49
- description: "How members should be appended and/or removed from a group. When true, members are appended and excluded_members are removed. When false, group members are reset to the value of the members property."
49
+ description: "How members should be appended and/or removed from a group. When true, `members` are appended and `excluded_members` are removed. When `false`, group members are reset to the value of the `members` property."
50
50
 
51
51
  property :system, [ TrueClass, FalseClass ], default: false,
52
- description: "Set if a group belongs to a system group. Set to true if the group belongs to a system group."
52
+ description: "Set to `true` if the group belongs to a system group."
53
53
 
54
54
  property :non_unique, [ TrueClass, FalseClass ], default: false,
55
- description: "Allow gid duplication. May only be used with the Groupadd provider."
55
+ description: "Allow gid duplication. May only be used with the `Groupadd` user resource provider."
56
56
 
57
57
  property :comment, String,
58
58
  introduced: "14.9",
@@ -0,0 +1,28 @@
1
+ #
2
+ # Copyright:: Chef Software, Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # li
16
+
17
+ def hab(*command)
18
+ # Windows shell_out does not support arrays, so manually cleaning and joining
19
+ hab_cmd = if windows?
20
+ (["hab"] + command).flatten.compact.join(" ")
21
+ else
22
+ (["hab"] + command)
23
+ end
24
+ shell_out!(hab_cmd)
25
+ rescue Errno::ENOENT
26
+ Chef::Log.fatal("'hab' binary not found, use the 'habitat_install' resource to install it first")
27
+ raise
28
+ end