chef 17.1.35 → 17.2.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/lib/chef/action_collection.rb +6 -26
  4. data/lib/chef/application.rb +1 -1
  5. data/lib/chef/application/base.rb +15 -0
  6. data/lib/chef/client.rb +6 -0
  7. data/lib/chef/cookbook_version.rb +26 -4
  8. data/lib/chef/data_bag.rb +2 -1
  9. data/lib/chef/data_bag_item.rb +2 -1
  10. data/lib/chef/data_collector.rb +0 -1
  11. data/lib/chef/data_collector/run_end_message.rb +1 -1
  12. data/lib/chef/deprecated.rb +4 -0
  13. data/lib/chef/event_dispatch/base.rb +2 -1
  14. data/lib/chef/exceptions.rb +3 -0
  15. data/lib/chef/handler.rb +46 -8
  16. data/lib/chef/handler/slow_report.rb +66 -0
  17. data/lib/chef/node.rb +20 -19
  18. data/lib/chef/provider/support/zypper_repo.erb +4 -2
  19. data/lib/chef/provider/zypper_repository.rb +27 -31
  20. data/lib/chef/resource/alternatives.rb +5 -5
  21. data/lib/chef/resource/apt_preference.rb +2 -2
  22. data/lib/chef/resource/apt_repository.rb +2 -2
  23. data/lib/chef/resource/apt_update.rb +4 -4
  24. data/lib/chef/resource/build_essential.rb +1 -1
  25. data/lib/chef/resource/chef_client_config.rb +3 -3
  26. data/lib/chef/resource/chef_client_cron.rb +2 -2
  27. data/lib/chef/resource/chef_client_launchd.rb +2 -2
  28. data/lib/chef/resource/chef_client_scheduled_task.rb +14 -14
  29. data/lib/chef/resource/chef_client_systemd_timer.rb +2 -2
  30. data/lib/chef/resource/chef_handler.rb +2 -2
  31. data/lib/chef/resource/chef_sleep.rb +1 -1
  32. data/lib/chef/resource/chocolatey_feature.rb +2 -2
  33. data/lib/chef/resource/chocolatey_source.rb +1 -1
  34. data/lib/chef/resource/cron/cron_d.rb +4 -6
  35. data/lib/chef/resource/cron_access.rb +1 -1
  36. data/lib/chef/resource/dmg_package.rb +1 -1
  37. data/lib/chef/resource/group.rb +4 -4
  38. data/lib/chef/resource/homebrew_cask.rb +17 -6
  39. data/lib/chef/resource/homebrew_package.rb +1 -1
  40. data/lib/chef/resource/homebrew_tap.rb +4 -3
  41. data/lib/chef/resource/homebrew_update.rb +2 -2
  42. data/lib/chef/resource/hostname.rb +49 -7
  43. data/lib/chef/resource/inspec_waiver_file_entry.rb +6 -5
  44. data/lib/chef/resource/kernel_module.rb +6 -6
  45. data/lib/chef/resource/locale.rb +1 -1
  46. data/lib/chef/resource/macos_userdefaults.rb +2 -2
  47. data/lib/chef/resource/ohai_hint.rb +2 -6
  48. data/lib/chef/resource/openbsd_package.rb +17 -0
  49. data/lib/chef/resource/openssl_dhparam.rb +1 -2
  50. data/lib/chef/resource/openssl_ec_private_key.rb +1 -3
  51. data/lib/chef/resource/openssl_ec_public_key.rb +1 -3
  52. data/lib/chef/resource/openssl_rsa_private_key.rb +1 -3
  53. data/lib/chef/resource/openssl_rsa_public_key.rb +1 -3
  54. data/lib/chef/resource/openssl_x509_certificate.rb +1 -4
  55. data/lib/chef/resource/openssl_x509_crl.rb +1 -3
  56. data/lib/chef/resource/openssl_x509_request.rb +1 -3
  57. data/lib/chef/resource/osx_profile.rb +3 -3
  58. data/lib/chef/resource/plist.rb +1 -1
  59. data/lib/chef/resource/powershell_package_source.rb +2 -4
  60. data/lib/chef/resource/reboot.rb +38 -9
  61. data/lib/chef/resource/remote_directory.rb +2 -2
  62. data/lib/chef/resource/rhsm_errata.rb +0 -2
  63. data/lib/chef/resource/rhsm_errata_level.rb +1 -5
  64. data/lib/chef/resource/rhsm_repo.rb +15 -0
  65. data/lib/chef/resource/ssh_known_hosts_entry.rb +4 -7
  66. data/lib/chef/resource/sudo.rb +2 -6
  67. data/lib/chef/resource/swap_file.rb +2 -6
  68. data/lib/chef/resource/sysctl.rb +2 -2
  69. data/lib/chef/resource/timezone.rb +1 -1
  70. data/lib/chef/resource/user_ulimit.rb +2 -2
  71. data/lib/chef/resource/windows_ad_join.rb +2 -2
  72. data/lib/chef/resource/windows_audit_policy.rb +2 -2
  73. data/lib/chef/resource/windows_auto_run.rb +2 -2
  74. data/lib/chef/resource/windows_certificate.rb +1 -1
  75. data/lib/chef/resource/windows_dfs_folder.rb +2 -2
  76. data/lib/chef/resource/windows_dfs_namespace.rb +2 -2
  77. data/lib/chef/resource/windows_dns_record.rb +2 -2
  78. data/lib/chef/resource/windows_dns_zone.rb +2 -2
  79. data/lib/chef/resource/windows_feature.rb +3 -3
  80. data/lib/chef/resource/windows_feature_dism.rb +3 -5
  81. data/lib/chef/resource/windows_feature_powershell.rb +3 -3
  82. data/lib/chef/resource/windows_firewall_profile.rb +2 -2
  83. data/lib/chef/resource/windows_firewall_rule.rb +20 -6
  84. data/lib/chef/resource/windows_font.rb +1 -1
  85. data/lib/chef/resource/windows_pagefile.rb +103 -64
  86. data/lib/chef/resource/windows_path.rb +2 -2
  87. data/lib/chef/resource/windows_printer.rb +5 -20
  88. data/lib/chef/resource/windows_printer_port.rb +48 -65
  89. data/lib/chef/resource/windows_security_policy.rb +2 -2
  90. data/lib/chef/resource/windows_share.rb +2 -2
  91. data/lib/chef/resource/windows_shortcut.rb +1 -1
  92. data/lib/chef/resource/windows_task.rb +1 -1
  93. data/lib/chef/resource/windows_uac.rb +3 -5
  94. data/lib/chef/resource/windows_user_privilege.rb +2 -2
  95. data/lib/chef/resource/windows_workgroup.rb +2 -2
  96. data/lib/chef/resource/yum_package.rb +10 -10
  97. data/lib/chef/resource/zypper_package.rb +4 -4
  98. data/lib/chef/resource/zypper_repository.rb +28 -8
  99. data/lib/chef/resource_reporter.rb +0 -1
  100. data/lib/chef/version.rb +1 -1
  101. data/spec/functional/resource/windows_hostname_spec.rb +91 -0
  102. data/spec/functional/resource/windows_pagefile_spec.rb +98 -0
  103. data/spec/unit/cookbook_version_spec.rb +52 -0
  104. data/spec/unit/data_bag_item_spec.rb +2 -2
  105. data/spec/unit/data_bag_spec.rb +1 -1
  106. data/spec/unit/data_collector_spec.rb +47 -1
  107. data/spec/unit/handler_spec.rb +8 -2
  108. data/spec/unit/provider/zypper_repository_spec.rb +3 -10
  109. data/spec/unit/resource/windows_firewall_rule_spec.rb +12 -7
  110. data/spec/unit/resource/windows_pagefile_spec.rb +4 -9
  111. data/spec/unit/resource/zypper_repository_spec.rb +1 -1
  112. metadata +9 -6
data/lib/chef/node.rb CHANGED
@@ -687,6 +687,25 @@ class Chef
687
687
  name <=> other.name
688
688
  end
689
689
 
690
+ # Returns hash of node data with attributes based on whitelist/blacklist rules.
691
+ def data_for_save
692
+ data = for_json
693
+ %w{automatic default normal override}.each do |level|
694
+ allowlist = allowlist_or_whitelist_config(level)
695
+ unless allowlist.nil? # nil => save everything
696
+ logger.info("Allowing #{level} node attributes for save.")
697
+ data[level] = Chef::AttributeAllowlist.filter(data[level], allowlist)
698
+ end
699
+
700
+ blocklist = blocklist_or_blacklist_config(level)
701
+ unless blocklist.nil? # nil => remove nothing
702
+ logger.info("Blocking #{level} node attributes for save")
703
+ data[level] = Chef::AttributeBlocklist.filter(data[level], blocklist)
704
+ end
705
+ end
706
+ data
707
+ end
708
+
690
709
  private
691
710
 
692
711
  def save_without_policyfile_attrs
@@ -712,7 +731,7 @@ class Chef
712
731
  # @param [String] level the attribute level
713
732
  def allowlist_or_whitelist_config(level)
714
733
  if Chef::Config["#{level}_attribute_whitelist".to_sym]
715
- Chef.deprecated(:attribute_blacklist_configuration, "Attribute whitelist configurations have been deprecated. Use the allowed_LEVEL_attribute configs instead")
734
+ Chef.deprecated(:attribute_whitelist_configuration, "Attribute whitelist configurations have been deprecated. Use the allowed_LEVEL_attribute configs instead")
716
735
  Chef::Config["#{level}_attribute_whitelist".to_sym]
717
736
  else
718
737
  Chef::Config["allowed_#{level}_attributes".to_sym]
@@ -732,24 +751,6 @@ class Chef
732
751
  end
733
752
  end
734
753
 
735
- def data_for_save
736
- data = for_json
737
- %w{automatic default normal override}.each do |level|
738
- allowlist = allowlist_or_whitelist_config(level)
739
- unless allowlist.nil? # nil => save everything
740
- logger.info("Allowing #{level} node attributes for save.")
741
- data[level] = Chef::AttributeAllowlist.filter(data[level], allowlist)
742
- end
743
-
744
- blocklist = blocklist_or_blacklist_config(level)
745
- unless blocklist.nil? # nil => remove nothing
746
- logger.info("Blocking #{level} node attributes for save")
747
- data[level] = Chef::AttributeBlocklist.filter(data[level], blocklist)
748
- end
749
- end
750
- data
751
- end
752
-
753
754
  # Returns a UUID that uniquely identifies this node for reporting reasons.
754
755
  #
755
756
  # The node is read in from disk if it exists, or it's generated if it does
@@ -1,15 +1,17 @@
1
- # This file was generated by Chef
1
+ # This file was generated by Chef Infra
2
2
  # Do NOT modify this file by hand.
3
3
 
4
4
  [<%= @config.repo_name %>]
5
5
  <% %w{ type enabled autorefresh gpgcheck gpgkey baseurl mirrorlist path priority keeppackages mode refresh_cache }.each do |prop| -%>
6
- <% next if @config.send(prop.to_sym).nil? -%>
6
+ <% next if @config.send(prop.to_sym).nil? || (@config.send(prop.to_sym).is_a?(Array) && @config.send(prop.to_sym).empty?) -%>
7
7
  <%= prop %>=<%=
8
8
  case @config.send(prop.to_sym)
9
9
  when TrueClass
10
10
  '1'
11
11
  when FalseClass
12
12
  '0'
13
+ when Array
14
+ @config.send(prop.to_sym).join("\n ")
13
15
  else
14
16
  @config.send(prop.to_sym)
15
17
  end %>
@@ -31,12 +31,12 @@ class Chef
31
31
 
32
32
  action :create do
33
33
  if new_resource.gpgautoimportkeys
34
- install_gpg_key(new_resource.gpgkey)
34
+ install_gpg_keys(new_resource.gpgkey)
35
35
  else
36
36
  logger.debug("'gpgautoimportkeys' property is set to false. Skipping key import.")
37
37
  end
38
38
 
39
- declare_resource(:template, "/etc/zypp/repos.d/#{escaped_repo_name}.repo") do
39
+ template "/etc/zypp/repos.d/#{escaped_repo_name}.repo" do
40
40
  if template_available?(new_resource.source)
41
41
  source new_resource.source
42
42
  else
@@ -51,13 +51,13 @@ class Chef
51
51
  end
52
52
 
53
53
  action :delete do
54
- declare_resource(:execute, "zypper --quiet --non-interactive removerepo #{escaped_repo_name}") do
54
+ execute "zypper --quiet --non-interactive removerepo #{escaped_repo_name}" do
55
55
  only_if "zypper --quiet lr #{escaped_repo_name}"
56
56
  end
57
57
  end
58
58
 
59
59
  action :refresh do
60
- declare_resource(:execute, "zypper --quiet --non-interactive refresh --force #{escaped_repo_name}") do
60
+ execute "zypper --quiet --non-interactive refresh --force #{escaped_repo_name}" do
61
61
  only_if "zypper --quiet lr #{escaped_repo_name}"
62
62
  end
63
63
  end
@@ -68,15 +68,7 @@ class Chef
68
68
  # zypper repos are allowed to have spaces in the names
69
69
  # @return [String] escaped repo string
70
70
  def escaped_repo_name
71
- Shellwords.escape(new_resource.repo_name)
72
- end
73
-
74
- # return the specified cookbook name or the cookbook containing the
75
- # resource.
76
- #
77
- # @return [String] name of the cookbook
78
- def cookbook_name
79
- new_resource.cookbook || new_resource.cookbook_name
71
+ @escaped_repo_name ||= Shellwords.escape(new_resource.repo_name)
80
72
  end
81
73
 
82
74
  # determine if a template file is available in the current run
@@ -84,7 +76,7 @@ class Chef
84
76
  #
85
77
  # @return [Boolean] template file exists or doesn't
86
78
  def template_available?(path)
87
- !path.nil? && run_context.has_template_in_cookbook?(cookbook_name, path)
79
+ !path.nil? && run_context.has_template_in_cookbook?(new_resource.cookbook, path)
88
80
  end
89
81
 
90
82
  # determine if a cookbook file is available in the run
@@ -92,7 +84,7 @@ class Chef
92
84
  #
93
85
  # @return [Boolean] cookbook file exists or doesn't
94
86
  def has_cookbook_file?(fn)
95
- run_context.has_cookbook_file_in_cookbook?(cookbook_name, fn)
87
+ run_context.has_cookbook_file_in_cookbook?(new_resource.cookbook, fn)
96
88
  end
97
89
 
98
90
  # Given the provided key URI determine what kind of chef resource we need
@@ -158,27 +150,31 @@ class Chef
158
150
  short_key_id
159
151
  end
160
152
 
161
- # install the provided gpg key
162
- # @param [String] uri the uri of the local or remote gpg key
163
- def install_gpg_key(uri)
164
- unless uri
165
- logger.debug("'gpgkey' property not provided or set to nil. Skipping key import.")
153
+ # install the provided gpg keys
154
+ # @param [String] uris the uri of the local or remote gpg key
155
+ def install_gpg_keys(uris)
156
+ if uris.empty?
157
+ logger.debug("'gpgkey' property not provided or set. Skipping gpg key import.")
166
158
  return
167
159
  end
168
160
 
169
- cached_keyfile = ::File.join(Chef::Config[:file_cache_path], uri.split("/")[-1])
161
+ # fetch each key to the cache dir either from the cookbook or by downloading it
162
+ # and then import the key
163
+ uris.each do |uri|
164
+ cached_keyfile = ::File.join(Chef::Config[:file_cache_path], uri.split("/")[-1])
170
165
 
171
- declare_resource(key_type(new_resource.gpgkey), cached_keyfile) do
172
- source uri
173
- mode "0644"
174
- sensitive new_resource.sensitive
175
- action :create
176
- end
166
+ declare_resource(key_type(uri), cached_keyfile) do
167
+ source uri
168
+ mode "0644"
169
+ sensitive new_resource.sensitive
170
+ action :create
171
+ end
177
172
 
178
- declare_resource(:execute, "import gpg key from #{new_resource.gpgkey}") do
179
- command "/bin/rpm --import #{cached_keyfile}"
180
- not_if { key_installed?(cached_keyfile) }
181
- action :run
173
+ execute "import gpg key from #{uri}" do
174
+ command "/bin/rpm --import #{cached_keyfile}"
175
+ not_if { key_installed?(cached_keyfile) }
176
+ action :run
177
+ end
182
178
  end
183
179
  end
184
180
  end
@@ -122,7 +122,7 @@ class Chef
122
122
  end
123
123
  end
124
124
 
125
- action :install, description: "Install an alternative on the system including symlinks" do
125
+ action :install, description: "Install an alternative on the system including symlinks." do
126
126
  if path_priority != new_resource.priority
127
127
  converge_by("adding alternative #{new_resource.link} #{new_resource.link_name} #{new_resource.path} #{new_resource.priority}") do
128
128
  output = shell_out(alternatives_cmd, "--install", new_resource.link, new_resource.link_name, new_resource.path, new_resource.priority)
@@ -133,7 +133,7 @@ class Chef
133
133
  end
134
134
  end
135
135
 
136
- action :set, description: "Set the symlink for an alternative" do
136
+ action :set, description: "Set the symlink for an alternative." do
137
137
  if current_path != new_resource.path
138
138
  converge_by("setting alternative #{new_resource.link_name} #{new_resource.path}") do
139
139
  output = shell_out(alternatives_cmd, "--set", new_resource.link_name, new_resource.path)
@@ -144,7 +144,7 @@ class Chef
144
144
  end
145
145
  end
146
146
 
147
- action :remove, description: "Remove an alternative and all associated links" do
147
+ action :remove, description: "Remove an alternative and all associated links." do
148
148
  if path_exists?
149
149
  converge_by("removing alternative #{new_resource.link_name} #{new_resource.path}") do
150
150
  shell_out(alternatives_cmd, "--remove", new_resource.link_name, new_resource.path)
@@ -152,13 +152,13 @@ class Chef
152
152
  end
153
153
  end
154
154
 
155
- action :auto, description: "Set an alternative up in automatic mode with the highest priority automatically selected" do
155
+ action :auto, description: "Set an alternative up in automatic mode with the highest priority automatically selected." do
156
156
  converge_by("setting auto alternative #{new_resource.link_name}") do
157
157
  shell_out(alternatives_cmd, "--auto", new_resource.link_name)
158
158
  end
159
159
  end
160
160
 
161
- action :refresh, description: "Refresh alternatives" do
161
+ action :refresh, description: "Refresh alternatives." do
162
162
  converge_by("refreshing alternative #{new_resource.link_name}") do
163
163
  shell_out(alternatives_cmd, "--refresh", new_resource.link_name)
164
164
  end
@@ -91,7 +91,7 @@ class Chef
91
91
  end
92
92
  end
93
93
 
94
- action :add, description: "Creates a preferences file under `/etc/apt/preferences.d`" do
94
+ action :add, description: "Creates a preferences file under `/etc/apt/preferences.d`." do
95
95
  return unless debian?
96
96
 
97
97
  preference = build_pref(
@@ -130,7 +130,7 @@ class Chef
130
130
  end
131
131
  end
132
132
 
133
- action :remove, description: "Removes the preferences file, thus unpinning the package" do
133
+ action :remove, description: "Removes the preferences file, thus unpinning the package." do
134
134
  return unless debian?
135
135
 
136
136
  sanitized_prefname = safe_name(new_resource.package_name)
@@ -409,7 +409,7 @@ class Chef
409
409
  end
410
410
  end
411
411
 
412
- action :add, description: "Creates a repository file at `/etc/apt/sources.list.d/` and builds the repository listing" do
412
+ action :add, description: "Creates a repository file at `/etc/apt/sources.list.d/` and builds the repository listing." do
413
413
  return unless debian?
414
414
 
415
415
  execute "apt-cache gencaches" do
@@ -459,7 +459,7 @@ class Chef
459
459
  end
460
460
  end
461
461
 
462
- action :remove, description: "Removes the repository listing" do
462
+ action :remove, description: "Removes the repository listing." do
463
463
  return unless debian?
464
464
 
465
465
  cleanup_legacy_file!
@@ -33,8 +33,8 @@ class Chef
33
33
 
34
34
  ```ruby
35
35
  apt_update 'all platforms' do
36
- frequency 86400
37
- action :periodic
36
+ frequency 86400
37
+ action :periodic
38
38
  end
39
39
  ```
40
40
 
@@ -86,7 +86,7 @@ class Chef
86
86
  end
87
87
  end
88
88
 
89
- action :periodic, description: "Update the Apt repository at the interval specified by the `frequency` property" do
89
+ action :periodic, description: "Update the Apt repository at the interval specified by the `frequency` property." do
90
90
  return unless debian?
91
91
 
92
92
  unless apt_up_to_date?
@@ -96,7 +96,7 @@ class Chef
96
96
  end
97
97
  end
98
98
 
99
- action :update, description: "Update the Apt repository at the start of a #{ChefUtils::Dist::Infra::PRODUCT} run" do
99
+ action :update, description: "Update the Apt repository at the start of a #{ChefUtils::Dist::Infra::PRODUCT} run." do
100
100
  return unless debian?
101
101
 
102
102
  converge_by "force update new lists of packages" do
@@ -57,7 +57,7 @@ class Chef
57
57
  introduced: "15.5",
58
58
  default: false, desired_state: false # FIXME: make this default to true
59
59
 
60
- action :install, description: "Install build essential packages" do
60
+ action :install, description: "Install build essential packages." do
61
61
  case
62
62
  when debian?
63
63
  package %w{ autoconf binutils-doc bison build-essential flex gettext ncurses-dev }
@@ -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,
@@ -227,7 +227,7 @@ class Chef
227
227
  property :additional_config, String,
228
228
  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
229
 
230
- action :create, description: "Create a client.rb config file" do
230
+ action :create, description: "Create a client.rb config file for configuring #{ChefUtils::Dist::Infra::PRODUCT}." do
231
231
  unless ::Dir.exist?(new_resource.config_directory)
232
232
  directory new_resource.config_directory do
233
233
  user new_resource.user unless new_resource.user.nil?
@@ -284,7 +284,7 @@ class Chef
284
284
  end
285
285
  end
286
286
 
287
- action :remove, description: "Remove a client.rb config file" do
287
+ action :remove, description: "Remove a client.rb config file for configuring #{ChefUtils::Dist::Infra::PRODUCT}." do
288
288
  file ::File.join(new_resource.config_directory, "client.rb") do
289
289
  action :delete
290
290
  end
@@ -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
@@ -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
 
@@ -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
@@ -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