chef 17.0.242-universal-mingw32 → 17.4.25-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -14
- data/Rakefile +2 -2
- data/chef.gemspec +10 -20
- data/lib/chef/action_collection.rb +6 -26
- data/lib/chef/application/base.rb +15 -0
- data/lib/chef/application.rb +4 -2
- data/lib/chef/chef_fs/file_pattern.rb +2 -2
- data/lib/chef/client.rb +7 -1
- data/lib/chef/compliance/default_attributes.rb +5 -3
- data/lib/chef/compliance/reporter/automate.rb +1 -1
- data/lib/chef/compliance/runner.rb +17 -3
- data/lib/chef/cookbook/cookbook_version_loader.rb +3 -3
- data/lib/chef/cookbook/gem_installer.rb +5 -1
- data/lib/chef/cookbook_version.rb +26 -4
- data/lib/chef/data_collector/run_end_message.rb +1 -1
- data/lib/chef/data_collector.rb +0 -1
- data/lib/chef/deprecated.rb +14 -4
- data/lib/chef/dsl/declare_resource.rb +5 -10
- data/lib/chef/dsl/render_helpers.rb +44 -0
- data/lib/chef/dsl/secret.rb +64 -0
- data/lib/chef/dsl/toml.rb +116 -0
- data/lib/chef/dsl/universal.rb +5 -0
- data/lib/chef/dsl.rb +1 -0
- data/lib/chef/event_dispatch/base.rb +2 -1
- data/lib/chef/exceptions.rb +23 -0
- data/lib/chef/formatters/doc.rb +2 -1
- data/lib/chef/formatters/error_mapper.rb +2 -2
- data/lib/chef/handler/slow_report.rb +66 -0
- data/lib/chef/handler.rb +46 -8
- data/lib/chef/json_compat.rb +1 -1
- data/lib/chef/node.rb +21 -20
- data/lib/chef/policy_builder/policyfile.rb +88 -45
- data/lib/chef/provider/directory.rb +6 -6
- data/lib/chef/provider/execute.rb +1 -1
- data/lib/chef/provider/file.rb +2 -2
- data/lib/chef/provider/group/dscl.rb +1 -1
- data/lib/chef/provider/launchd.rb +6 -6
- data/lib/chef/provider/link.rb +1 -1
- data/lib/chef/provider/lwrp_base.rb +1 -1
- data/lib/chef/provider/package/dnf/dnf_helper.py +11 -10
- data/lib/chef/provider/package/dnf/python_helper.rb +9 -8
- data/lib/chef/provider/package/habitat.rb +168 -0
- data/lib/chef/provider/package/powershell.rb +5 -0
- data/lib/chef/provider/package/yum/python_helper.rb +15 -10
- data/lib/chef/provider/package/yum/yum_helper.py +46 -62
- data/lib/chef/provider/package/yum.rb +1 -4
- data/lib/chef/provider/registry_key.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +1 -1
- data/lib/chef/provider/subversion.rb +4 -4
- data/lib/chef/provider/support/yum_repo.erb +1 -1
- data/lib/chef/provider/support/zypper_repo.erb +4 -2
- data/lib/chef/provider/systemd_unit.rb +18 -17
- data/lib/chef/provider/template/content.rb +1 -1
- data/lib/chef/provider/user/mac.rb +3 -3
- data/lib/chef/provider/windows_script.rb +1 -1
- data/lib/chef/provider/yum_repository.rb +27 -43
- data/lib/chef/provider/zypper_repository.rb +30 -34
- data/lib/chef/provider.rb +26 -1
- data/lib/chef/provider_resolver.rb +8 -2
- data/lib/chef/providers.rb +1 -0
- data/lib/chef/resource/alternatives.rb +5 -5
- data/lib/chef/resource/apt_preference.rb +2 -2
- data/lib/chef/resource/apt_repository.rb +2 -2
- data/lib/chef/resource/apt_update.rb +4 -4
- data/lib/chef/resource/build_essential.rb +1 -1
- data/lib/chef/resource/chef_client_config.rb +10 -5
- data/lib/chef/resource/chef_client_cron.rb +3 -3
- data/lib/chef/resource/chef_client_launchd.rb +3 -3
- data/lib/chef/resource/chef_client_scheduled_task.rb +15 -15
- data/lib/chef/resource/chef_client_systemd_timer.rb +3 -3
- data/lib/chef/resource/chef_client_trusted_certificate.rb +2 -2
- data/lib/chef/resource/chef_handler.rb +2 -2
- data/lib/chef/resource/chef_sleep.rb +1 -1
- data/lib/chef/resource/chef_vault_secret.rb +2 -2
- data/lib/chef/resource/chocolatey_feature.rb +2 -2
- data/lib/chef/resource/chocolatey_source.rb +1 -1
- data/lib/chef/resource/cron/cron_d.rb +4 -6
- data/lib/chef/resource/cron_access.rb +1 -1
- data/lib/chef/resource/dmg_package.rb +1 -1
- data/lib/chef/resource/dsc_resource.rb +1 -1
- data/lib/chef/resource/execute.rb +5 -5
- data/lib/chef/resource/gem_package.rb +2 -1
- data/lib/chef/resource/group.rb +4 -4
- data/lib/chef/resource/habitat/_habitat_shared.rb +28 -0
- data/lib/chef/resource/habitat/habitat_package.rb +129 -0
- data/lib/chef/resource/habitat/habitat_sup.rb +329 -0
- data/lib/chef/resource/habitat/habitat_sup_systemd.rb +67 -0
- data/lib/chef/resource/habitat/habitat_sup_windows.rb +90 -0
- data/lib/chef/resource/habitat_config.rb +107 -0
- data/lib/chef/resource/habitat_install.rb +247 -0
- data/lib/chef/resource/habitat_service.rb +451 -0
- data/lib/chef/resource/habitat_user_toml.rb +92 -0
- data/lib/chef/resource/homebrew_cask.rb +18 -7
- data/lib/chef/resource/homebrew_package.rb +1 -1
- data/lib/chef/resource/homebrew_tap.rb +4 -3
- data/lib/chef/resource/homebrew_update.rb +2 -2
- data/lib/chef/resource/hostname.rb +49 -7
- data/lib/chef/resource/inspec_waiver_file_entry.rb +156 -0
- data/lib/chef/resource/kernel_module.rb +6 -6
- data/lib/chef/resource/launchd.rb +3 -3
- data/lib/chef/resource/locale.rb +1 -1
- data/lib/chef/resource/lwrp_base.rb +18 -3
- data/lib/chef/resource/macos_userdefaults.rb +2 -2
- data/lib/chef/resource/ohai_hint.rb +2 -6
- data/lib/chef/resource/openbsd_package.rb +17 -0
- data/lib/chef/resource/openssl_dhparam.rb +1 -2
- data/lib/chef/resource/openssl_ec_private_key.rb +1 -3
- data/lib/chef/resource/openssl_ec_public_key.rb +1 -3
- data/lib/chef/resource/openssl_rsa_private_key.rb +1 -3
- data/lib/chef/resource/openssl_rsa_public_key.rb +1 -3
- data/lib/chef/resource/openssl_x509_certificate.rb +1 -4
- data/lib/chef/resource/openssl_x509_crl.rb +1 -3
- data/lib/chef/resource/openssl_x509_request.rb +1 -3
- data/lib/chef/resource/osx_profile.rb +3 -3
- data/lib/chef/resource/plist.rb +1 -1
- data/lib/chef/resource/powershell_package_source.rb +2 -4
- data/lib/chef/resource/reboot.rb +38 -9
- data/lib/chef/resource/remote_directory.rb +2 -2
- data/lib/chef/resource/remote_file.rb +3 -3
- data/lib/chef/resource/rhsm_errata.rb +0 -2
- data/lib/chef/resource/rhsm_errata_level.rb +1 -5
- data/lib/chef/resource/rhsm_repo.rb +15 -0
- data/lib/chef/resource/rhsm_subscription.rb +5 -5
- data/lib/chef/resource/ruby_block.rb +100 -0
- data/lib/chef/resource/scm/subversion.rb +1 -1
- data/lib/chef/resource/ssh_known_hosts_entry.rb +4 -7
- data/lib/chef/resource/sudo.rb +2 -6
- data/lib/chef/resource/support/HabService.dll.config.erb +19 -0
- data/lib/chef/resource/support/client.erb +8 -1
- data/lib/chef/resource/support/sup.toml.erb +179 -0
- data/lib/chef/resource/swap_file.rb +2 -6
- data/lib/chef/resource/sysctl.rb +2 -2
- data/lib/chef/resource/systemd_unit.rb +3 -3
- data/lib/chef/resource/timezone.rb +1 -1
- data/lib/chef/resource/user_ulimit.rb +2 -2
- data/lib/chef/resource/windows_ad_join.rb +2 -2
- data/lib/chef/resource/windows_audit_policy.rb +2 -2
- data/lib/chef/resource/windows_auto_run.rb +2 -2
- data/lib/chef/resource/windows_certificate.rb +1 -1
- data/lib/chef/resource/windows_defender.rb +163 -0
- data/lib/chef/resource/windows_defender_exclusion.rb +125 -0
- data/lib/chef/resource/windows_dfs_folder.rb +2 -2
- data/lib/chef/resource/windows_dfs_namespace.rb +2 -2
- data/lib/chef/resource/windows_dns_record.rb +2 -2
- data/lib/chef/resource/windows_dns_zone.rb +2 -2
- data/lib/chef/resource/windows_env.rb +1 -1
- data/lib/chef/resource/windows_feature.rb +3 -3
- data/lib/chef/resource/windows_feature_dism.rb +3 -5
- data/lib/chef/resource/windows_feature_powershell.rb +3 -3
- data/lib/chef/resource/windows_firewall_profile.rb +2 -2
- data/lib/chef/resource/windows_firewall_rule.rb +20 -6
- data/lib/chef/resource/windows_font.rb +2 -2
- data/lib/chef/resource/windows_pagefile.rb +104 -65
- data/lib/chef/resource/windows_path.rb +4 -4
- data/lib/chef/resource/windows_printer.rb +80 -61
- data/lib/chef/resource/windows_printer_port.rb +48 -65
- data/lib/chef/resource/windows_security_policy.rb +7 -4
- data/lib/chef/resource/windows_share.rb +2 -2
- data/lib/chef/resource/windows_shortcut.rb +1 -1
- data/lib/chef/resource/windows_task.rb +2 -2
- data/lib/chef/resource/windows_uac.rb +3 -5
- data/lib/chef/resource/windows_update_settings.rb +259 -0
- data/lib/chef/resource/windows_user_privilege.rb +2 -2
- data/lib/chef/resource/windows_workgroup.rb +2 -2
- data/lib/chef/resource/yum_package.rb +11 -15
- data/lib/chef/resource/zypper_package.rb +4 -4
- data/lib/chef/resource/zypper_repository.rb +28 -8
- data/lib/chef/resource.rb +20 -25
- data/lib/chef/resource_builder.rb +8 -2
- data/lib/chef/resource_inspector.rb +6 -2
- data/lib/chef/resource_reporter.rb +0 -1
- data/lib/chef/resources.rb +13 -1
- data/lib/chef/run_lock.rb +1 -1
- data/lib/chef/runner.rb +1 -1
- data/lib/chef/secret_fetcher/aws_secrets_manager.rb +65 -0
- data/lib/chef/secret_fetcher/azure_key_vault.rb +78 -0
- data/lib/chef/secret_fetcher/base.rb +76 -0
- data/lib/chef/secret_fetcher/example.rb +46 -0
- data/lib/chef/secret_fetcher.rb +55 -0
- data/lib/chef/shell/ext.rb +3 -3
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api.rb +9 -2
- data/spec/data/knife-home/.chef/plugins/knife/example_home_subcommand.rb +0 -0
- data/spec/data/knife-site-subcommands/plugins/knife/example_subcommand.rb +0 -0
- data/spec/data/knife_subcommand/test_explicit_category.rb +7 -0
- data/spec/data/knife_subcommand/test_name_mapping.rb +4 -0
- data/spec/data/knife_subcommand/test_yourself.rb +21 -0
- data/spec/functional/mixin/from_file_spec.rb +1 -1
- data/spec/functional/resource/dnf_package_spec.rb +857 -537
- data/spec/functional/resource/group_spec.rb +1 -1
- data/spec/functional/resource/link_spec.rb +1 -1
- data/spec/functional/resource/remote_file_spec.rb +1 -1
- data/spec/functional/resource/windows_env_spec.rb +2 -2
- data/spec/functional/resource/windows_hostname_spec.rb +91 -0
- data/spec/functional/resource/windows_pagefile_spec.rb +98 -0
- data/spec/functional/resource/yum_package_spec.rb +495 -428
- data/spec/integration/client/client_spec.rb +0 -20
- data/spec/integration/compliance/compliance_spec.rb +1 -0
- data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
- data/spec/integration/recipes/resource_action_spec.rb +6 -6
- data/spec/integration/recipes/unified_mode_spec.rb +70 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/chef_helpers.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/functional/knife.rb +37 -0
- data/spec/support/shared/integration/knife_support.rb +192 -0
- data/spec/support/shared/unit/knife_shared.rb +39 -0
- data/spec/support/shared/unit/provider/file.rb +3 -9
- data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +1 -1
- data/spec/unit/compliance/runner_spec.rb +46 -2
- data/spec/unit/cookbook_version_spec.rb +52 -0
- data/spec/unit/data_collector_spec.rb +47 -1
- data/spec/unit/dsl/render_helpers_spec.rb +102 -0
- data/spec/unit/dsl/secret_spec.rb +71 -0
- data/spec/unit/handler_spec.rb +8 -2
- data/spec/unit/policy_builder/dynamic_spec.rb +0 -5
- data/spec/unit/policy_builder/policyfile_spec.rb +144 -56
- data/spec/unit/provider/apt_update_spec.rb +3 -1
- data/spec/unit/provider/link_spec.rb +1 -1
- data/spec/unit/provider/mount/aix_spec.rb +1 -1
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -0
- data/spec/unit/provider/package/powershell_spec.rb +74 -12
- data/spec/unit/provider/package/yum/python_helper_spec.rb +1 -0
- data/spec/unit/provider/service/systemd_service_spec.rb +2 -2
- data/spec/unit/provider/systemd_unit_spec.rb +2 -2
- data/spec/unit/provider/zypper_repository_spec.rb +3 -10
- data/spec/unit/provider_spec.rb +23 -0
- data/spec/unit/resource/homebrew_cask_spec.rb +29 -11
- data/spec/unit/resource/inspec_waiver_file_entry_spec.rb +80 -0
- data/spec/unit/resource/rhsm_subscription_spec.rb +50 -3
- data/spec/unit/resource/systemd_unit_spec.rb +1 -1
- data/spec/unit/resource/windows_defender_exclusion_spec.rb +62 -0
- data/spec/unit/resource/windows_defender_spec.rb +71 -0
- data/spec/unit/resource/windows_firewall_rule_spec.rb +12 -7
- data/spec/unit/resource/windows_pagefile_spec.rb +4 -9
- data/spec/unit/resource/windows_update_settings_spec.rb +64 -0
- data/spec/unit/resource/zypper_repository_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +19 -8
- data/spec/unit/secret_fetcher/aws_secrets_manager_spec.rb +70 -0
- data/spec/unit/secret_fetcher/azure_key_vault_spec.rb +70 -0
- data/spec/unit/secret_fetcher_spec.rb +82 -0
- data/tasks/rspec.rb +4 -9
- metadata +65 -161
- data/lib/chef/provider/package/yum/simplejson/LICENSE.txt +0 -79
- data/lib/chef/provider/package/yum/simplejson/__init__.py +0 -318
- data/lib/chef/provider/package/yum/simplejson/__init__.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/decoder.py +0 -354
- data/lib/chef/provider/package/yum/simplejson/decoder.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/encoder.py +0 -440
- data/lib/chef/provider/package/yum/simplejson/encoder.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/scanner.py +0 -65
- data/lib/chef/provider/package/yum/simplejson/scanner.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/tool.py +0 -37
@@ -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 }
|
@@ -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
|
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
|
-
|
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
|
-
|
40
|
-
|
41
|
-
|
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
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
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
|
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
|
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
|
@@ -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
|
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
|
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."
|
@@ -633,13 +633,13 @@ class Chef
|
|
633
633
|
end
|
634
634
|
|
635
635
|
# if domain is provided in both username and domain
|
636
|
-
if specified_user.is_a?(String) && ((specified_user.include?
|
636
|
+
if specified_user.is_a?(String) && ((specified_user.include? "\\") || (specified_user.include? "@")) && specified_domain
|
637
637
|
raise ArgumentError, "The domain is provided twice. Username: `#{specified_user}`, Domain: `#{specified_domain}`. Please specify domain only once."
|
638
638
|
end
|
639
639
|
|
640
640
|
if specified_user.is_a?(String) && specified_domain.nil?
|
641
641
|
# Splitting username of format: Domain\Username
|
642
|
-
domain_and_user = user.split(
|
642
|
+
domain_and_user = user.split("\\")
|
643
643
|
|
644
644
|
if domain_and_user.length == 2
|
645
645
|
domain = domain_and_user[0]
|
@@ -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] },
|
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."
|
data/lib/chef/resource/group.rb
CHANGED
@@ -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
|
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
|
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",
|