chef 17.1.35-universal-mingw32 → 17.2.29-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 +1 -0
- data/lib/chef/action_collection.rb +6 -26
- data/lib/chef/application.rb +1 -1
- data/lib/chef/application/base.rb +15 -0
- data/lib/chef/client.rb +6 -0
- data/lib/chef/cookbook_version.rb +26 -4
- data/lib/chef/data_bag.rb +2 -1
- data/lib/chef/data_bag_item.rb +2 -1
- data/lib/chef/data_collector.rb +0 -1
- data/lib/chef/data_collector/run_end_message.rb +1 -1
- data/lib/chef/deprecated.rb +4 -0
- data/lib/chef/event_dispatch/base.rb +2 -1
- data/lib/chef/exceptions.rb +3 -0
- data/lib/chef/handler.rb +46 -8
- data/lib/chef/handler/slow_report.rb +66 -0
- data/lib/chef/node.rb +20 -19
- data/lib/chef/provider/support/zypper_repo.erb +4 -2
- data/lib/chef/provider/zypper_repository.rb +27 -31
- 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 +3 -3
- data/lib/chef/resource/chef_client_cron.rb +2 -2
- data/lib/chef/resource/chef_client_launchd.rb +2 -2
- data/lib/chef/resource/chef_client_scheduled_task.rb +14 -14
- data/lib/chef/resource/chef_client_systemd_timer.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/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/group.rb +4 -4
- data/lib/chef/resource/homebrew_cask.rb +17 -6
- 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 +6 -5
- data/lib/chef/resource/kernel_module.rb +6 -6
- data/lib/chef/resource/locale.rb +1 -1
- 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/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/ssh_known_hosts_entry.rb +4 -7
- data/lib/chef/resource/sudo.rb +2 -6
- data/lib/chef/resource/swap_file.rb +2 -6
- data/lib/chef/resource/sysctl.rb +2 -2
- 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_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_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 +1 -1
- data/lib/chef/resource/windows_pagefile.rb +103 -64
- data/lib/chef/resource/windows_path.rb +2 -2
- data/lib/chef/resource/windows_printer.rb +5 -20
- data/lib/chef/resource/windows_printer_port.rb +48 -65
- data/lib/chef/resource/windows_security_policy.rb +2 -2
- 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 +1 -1
- data/lib/chef/resource/windows_uac.rb +3 -5
- 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 +10 -10
- data/lib/chef/resource/zypper_package.rb +4 -4
- data/lib/chef/resource/zypper_repository.rb +28 -8
- data/lib/chef/resource_reporter.rb +0 -1
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/windows_hostname_spec.rb +91 -0
- data/spec/functional/resource/windows_pagefile_spec.rb +98 -0
- data/spec/unit/cookbook_version_spec.rb +52 -0
- data/spec/unit/data_bag_item_spec.rb +2 -2
- data/spec/unit/data_bag_spec.rb +1 -1
- data/spec/unit/data_collector_spec.rb +47 -1
- data/spec/unit/handler_spec.rb +8 -2
- data/spec/unit/provider/zypper_repository_spec.rb +3 -10
- 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/zypper_repository_spec.rb +1 -1
- metadata +9 -6
@@ -31,6 +31,23 @@ class Chef
|
|
31
31
|
|
32
32
|
description "Use the **openbsd_package** resource to manage packages for the OpenBSD platform."
|
33
33
|
introduced "12.1"
|
34
|
+
examples <<~DOC
|
35
|
+
**Install a package**
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
openbsd_package 'name of package' do
|
39
|
+
action :install
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
**Remove a package**
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
openbsd_package 'name of package' do
|
47
|
+
action :remove
|
48
|
+
end
|
49
|
+
```
|
50
|
+
DOC
|
34
51
|
|
35
52
|
property :package_name, String,
|
36
53
|
description: "An optional property to set the package name if it differs from the resource block's name.",
|
@@ -88,8 +88,7 @@ class Chef
|
|
88
88
|
description: "The permission mode applied to all files created by the resource.",
|
89
89
|
default: "0640"
|
90
90
|
|
91
|
-
action :create do
|
92
|
-
description "Create the dhparam file."
|
91
|
+
action :create, description: "Create the `dhparam.pem` file." do
|
93
92
|
dhparam_content = nil
|
94
93
|
unless dhparam_pem_valid?(new_resource.path)
|
95
94
|
dhparam_content = gen_dhparam(new_resource.key_length, new_resource.generator).to_pem
|
@@ -88,9 +88,7 @@ class Chef
|
|
88
88
|
description: "Force creation of the key even if the same key already exists on the node.",
|
89
89
|
default: false, desired_state: false
|
90
90
|
|
91
|
-
action :create do
|
92
|
-
description "Generate the ec private key"
|
93
|
-
|
91
|
+
action :create, description: "Generate the EC private key file." do
|
94
92
|
unless new_resource.force || priv_key_file_valid?(new_resource.path, new_resource.key_pass)
|
95
93
|
converge_by("Create an EC private key #{new_resource.path}") do
|
96
94
|
log "Generating an #{new_resource.key_curve} "\
|
@@ -74,9 +74,7 @@ class Chef
|
|
74
74
|
description: "The permission mode applied to all files created by the resource.",
|
75
75
|
default: "0640"
|
76
76
|
|
77
|
-
action :create do
|
78
|
-
description "Generate the ec public key from a private key"
|
79
|
-
|
77
|
+
action :create, description: "Generate the EC public key file from a private key." do
|
80
78
|
raise ArgumentError, "You cannot specify both 'private_key_path' and 'private_key_content' properties at the same time." if new_resource.private_key_path && new_resource.private_key_content
|
81
79
|
raise ArgumentError, "You must specify the private key with either 'private_key_path' or 'private_key_content' properties." unless new_resource.private_key_path || new_resource.private_key_content
|
82
80
|
raise "#{new_resource.private_key_path} not a valid private EC key or password is invalid" unless priv_key_file_valid?((new_resource.private_key_path || new_resource.private_key_content), new_resource.private_key_pass)
|
@@ -87,9 +87,7 @@ class Chef
|
|
87
87
|
description: "Force creation of the key even if the same key already exists on the node.",
|
88
88
|
default: false, desired_state: false
|
89
89
|
|
90
|
-
action :create do
|
91
|
-
description "Create the RSA private key."
|
92
|
-
|
90
|
+
action :create, description: "Create the RSA private key file." do
|
93
91
|
return if new_resource.force || priv_key_file_valid?(new_resource.path, new_resource.key_pass)
|
94
92
|
|
95
93
|
converge_by("create #{new_resource.key_length} bit RSA key #{new_resource.path}") do
|
@@ -75,9 +75,7 @@ class Chef
|
|
75
75
|
description: "The permission mode applied to all files created by the resource.",
|
76
76
|
default: "0640"
|
77
77
|
|
78
|
-
action :create do
|
79
|
-
description "Create the RSA public key."
|
80
|
-
|
78
|
+
action :create, description: "Create the RSA public key file." do
|
81
79
|
raise ArgumentError, "You cannot specify both 'private_key_path' and 'private_key_content' properties at the same time." if new_resource.private_key_path && new_resource.private_key_content
|
82
80
|
raise ArgumentError, "You must specify the private key with either 'private_key_path' or 'private_key_content' properties." unless new_resource.private_key_path || new_resource.private_key_content
|
83
81
|
raise "#{new_resource.private_key_path} not a valid private RSA key or password is invalid" unless priv_key_file_valid?((new_resource.private_key_path || new_resource.private_key_content), new_resource.private_key_pass)
|
@@ -151,15 +151,12 @@ class Chef
|
|
151
151
|
description: "The number of days before the expiry. The certificate will be automatically renewed when the value is reached.",
|
152
152
|
introduced: "15.7"
|
153
153
|
|
154
|
-
action :create do
|
155
|
-
description "Generate a certificate"
|
156
|
-
|
154
|
+
action :create, description: "Generate a certificate file." do
|
157
155
|
file new_resource.path do
|
158
156
|
action :create_if_missing
|
159
157
|
owner new_resource.owner unless new_resource.owner.nil?
|
160
158
|
group new_resource.group unless new_resource.group.nil?
|
161
159
|
mode new_resource.mode unless new_resource.mode.nil?
|
162
|
-
sensitive true
|
163
160
|
content cert.to_pem
|
164
161
|
end
|
165
162
|
|
@@ -90,9 +90,7 @@ class Chef
|
|
90
90
|
property :mode, [Integer, String],
|
91
91
|
description: "The permission mode of the CRL file."
|
92
92
|
|
93
|
-
action :create do
|
94
|
-
description "Create the CRL file."
|
95
|
-
|
93
|
+
action :create, description: "Create the certificate revocation list (CRL) file." do
|
96
94
|
file new_resource.path do
|
97
95
|
owner new_resource.owner unless new_resource.owner.nil?
|
98
96
|
group new_resource.group unless new_resource.group.nil?
|
@@ -119,9 +119,7 @@ class Chef
|
|
119
119
|
equal_to: %w{secp384r1 secp521r1 prime256v1}, default: "prime256v1",
|
120
120
|
description: "The desired curve of the generated key (if key_type is equal to `ec`). Run `openssl ecparam -list_curves` to see available options."
|
121
121
|
|
122
|
-
action :create do
|
123
|
-
description "Generate a certificate request."
|
124
|
-
|
122
|
+
action :create, description: "Generate a certificate request file." do
|
125
123
|
unless ::File.exist? new_resource.path
|
126
124
|
converge_by("Create CSR #{@new_resource}") do
|
127
125
|
file new_resource.path do
|
@@ -51,7 +51,7 @@ class Chef
|
|
51
51
|
'PayloadOrganization' => 'Chef',
|
52
52
|
'PayloadVersion' => 1,
|
53
53
|
'PayloadDisplayName' => 'Screensaver Settings',
|
54
|
-
'PayloadContent'=> [
|
54
|
+
'PayloadContent' => [
|
55
55
|
{
|
56
56
|
'PayloadType' => 'com.apple.ManagedClient.preferences',
|
57
57
|
'PayloadVersion' => 1,
|
@@ -172,7 +172,7 @@ class Chef
|
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
175
|
-
action :install do
|
175
|
+
action :install, description: "Install the specified configuration profile." do
|
176
176
|
unless profile_installed?
|
177
177
|
converge_by("install profile #{new_profile_identifier}") do
|
178
178
|
profile_path = write_profile_to_disk
|
@@ -182,7 +182,7 @@ class Chef
|
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
|
-
action :remove do
|
185
|
+
action :remove, description: "Remove the specified configuration profile." do
|
186
186
|
# Clean up profile after removing it
|
187
187
|
if profile_installed?
|
188
188
|
converge_by("remove profile #{new_profile_identifier}") do
|
data/lib/chef/resource/plist.rb
CHANGED
@@ -81,7 +81,7 @@ class Chef
|
|
81
81
|
group file_group_cmd.stdout.chomp
|
82
82
|
end
|
83
83
|
|
84
|
-
action :set do
|
84
|
+
action :set, description: "Set a value in a plist file." do
|
85
85
|
converge_if_changed :path do
|
86
86
|
converge_by "create new plist: '#{new_resource.path}'" do
|
87
87
|
file new_resource.path do
|
@@ -70,8 +70,7 @@ class Chef
|
|
70
70
|
script_publish_location status["script_publish_location"]
|
71
71
|
end
|
72
72
|
|
73
|
-
action :register do
|
74
|
-
description "Registers and updates the powershell package source."
|
73
|
+
action :register, description: "Registers and updates the PowerShell package source." do
|
75
74
|
# TODO: Ensure package provider is installed?
|
76
75
|
if psrepository_cmdlet_appropriate?
|
77
76
|
if package_source_exists?
|
@@ -104,8 +103,7 @@ class Chef
|
|
104
103
|
end
|
105
104
|
end
|
106
105
|
|
107
|
-
action :unregister do
|
108
|
-
description "Unregisters the powershell package source."
|
106
|
+
action :unregister, description: "Unregisters the PowerShell package source." do
|
109
107
|
if package_source_exists?
|
110
108
|
unregister_cmd = "Get-PackageSource -Name '#{new_resource.source_name}' | Unregister-PackageSource"
|
111
109
|
converge_by("unregister source: #{new_resource.source_name}") do
|
data/lib/chef/resource/reboot.rb
CHANGED
@@ -33,6 +33,41 @@ class Chef
|
|
33
33
|
" immediate notifications. Delayed notifications produce unintuitive and"\
|
34
34
|
" probably undesired results."
|
35
35
|
introduced "12.0"
|
36
|
+
examples <<~DOC
|
37
|
+
**Reboot a node immediately**
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
reboot 'now' do
|
41
|
+
action :nothing
|
42
|
+
reason 'Cannot continue Chef run without a reboot.'
|
43
|
+
delay_mins 2
|
44
|
+
end
|
45
|
+
|
46
|
+
execute 'foo' do
|
47
|
+
command '...'
|
48
|
+
notifies :reboot_now, 'reboot[now]', :immediately
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
**Reboot a node at the end of a Chef Infra Client run**
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
reboot 'app_requires_reboot' do
|
56
|
+
action :request_reboot
|
57
|
+
reason 'Need to reboot when the run completes successfully.'
|
58
|
+
delay_mins 5
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
**Cancel a reboot**
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
reboot 'cancel_reboot_request' do
|
66
|
+
action :cancel
|
67
|
+
reason 'Cancel a previous end-of-run reboot request.'
|
68
|
+
end
|
69
|
+
```
|
70
|
+
DOC
|
36
71
|
|
37
72
|
property :reason, String,
|
38
73
|
description: "A string that describes the reboot action.",
|
@@ -42,18 +77,14 @@ class Chef
|
|
42
77
|
description: "The amount of time (in minutes) to delay a reboot request.",
|
43
78
|
default: 0
|
44
79
|
|
45
|
-
action :request_reboot do
|
46
|
-
description "Reboot a node at the end of a chef-client run."
|
47
|
-
|
80
|
+
action :request_reboot, description: "Reboot a node at the end of a #{ChefUtils::Dist::Infra::PRODUCT} run." do
|
48
81
|
converge_by("request a system reboot to occur if the run succeeds") do
|
49
82
|
logger.warn "Reboot requested:'#{new_resource.name}'"
|
50
83
|
request_reboot
|
51
84
|
end
|
52
85
|
end
|
53
86
|
|
54
|
-
action :reboot_now do
|
55
|
-
description "Reboot a node so that the chef-client may continue the installation process."
|
56
|
-
|
87
|
+
action :reboot_now, description: "Reboot a node so that the #{ChefUtils::Dist::Infra::PRODUCT} may continue the installation process." do
|
57
88
|
converge_by("rebooting the system immediately") do
|
58
89
|
logger.warn "Rebooting system immediately, requested by '#{new_resource.name}'"
|
59
90
|
request_reboot
|
@@ -61,9 +92,7 @@ class Chef
|
|
61
92
|
end
|
62
93
|
end
|
63
94
|
|
64
|
-
action :cancel do
|
65
|
-
description "Cancel a pending reboot request."
|
66
|
-
|
95
|
+
action :cancel, description: "Cancel a pending reboot request." do
|
67
96
|
converge_by("cancel any existing end-of-run reboot request") do
|
68
97
|
logger.warn "Reboot canceled: '#{new_resource.name}'"
|
69
98
|
node.run_context.cancel_reboot
|
@@ -71,7 +71,7 @@ class Chef
|
|
71
71
|
desired_state: false
|
72
72
|
|
73
73
|
property :files_group, [String, Integer],
|
74
|
-
description: "Configure group permissions for files. A string or ID that identifies the group owner by group name, including fully qualified group names such as domain\\group or group@domain
|
74
|
+
description: "Configure group permissions for files. A string or ID that identifies the group owner by group name, including fully qualified group names such as `domain\\group` or `group@domain`. If this value is not specified, existing groups remain unchanged and new group assignments use the default POSIX group (if available).",
|
75
75
|
regex: Chef::Config[:group_valid_regex]
|
76
76
|
|
77
77
|
property :files_mode, [String, Integer, nil],
|
@@ -80,7 +80,7 @@ class Chef
|
|
80
80
|
regex: /^\d{3,4}$/, default: lazy { 0644 unless Chef::Platform.windows? }
|
81
81
|
|
82
82
|
property :files_owner, [String, Integer],
|
83
|
-
description: "Configure owner permissions for files. A string or ID that identifies the group owner by user name, including fully qualified user names such as domain\\user or user@domain
|
83
|
+
description: "Configure owner permissions for files. A string or ID that identifies the group owner by user name, including fully qualified user names such as `domain\\user` or `user@domain`. If this value is not specified, existing owners remain unchanged and new owner assignments use the current user (when necessary).",
|
84
84
|
regex: Chef::Config[:user_valid_regex]
|
85
85
|
end
|
86
86
|
end
|
@@ -46,8 +46,6 @@ class Chef
|
|
46
46
|
name_property: true
|
47
47
|
|
48
48
|
action :install, description: "Install a package for a specific errata ID." do
|
49
|
-
description "Installs a package for a specific errata ID."
|
50
|
-
|
51
49
|
execute "Install errata packages for #{new_resource.errata_id}" do
|
52
50
|
command "#{package_manager_command} update --advisory #{new_resource.errata_id} -y"
|
53
51
|
default_env true
|
@@ -42,11 +42,7 @@ class Chef
|
|
42
42
|
name_property: true
|
43
43
|
|
44
44
|
action :install, description: "Install all packages of the specified errata level." do
|
45
|
-
|
46
|
-
|
47
|
-
if rhel6?
|
48
|
-
yum_package "yum-plugin-security"
|
49
|
-
end
|
45
|
+
yum_package "yum-plugin-security" if rhel6?
|
50
46
|
|
51
47
|
execute "Install any #{new_resource.errata_level} errata" do
|
52
48
|
command "#{package_manager_command} update --sec-severity=#{new_resource.errata_level.capitalize} -y"
|
@@ -26,6 +26,21 @@ class Chef
|
|
26
26
|
|
27
27
|
description "Use the **rhsm_repo** resource to enable or disable Red Hat Subscription Manager repositories that are made available via attached subscriptions."
|
28
28
|
introduced "14.0"
|
29
|
+
examples <<~DOC
|
30
|
+
**Enable an RHSM repository**
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
rhsm_repo 'rhel-7-server-extras-rpms'
|
34
|
+
```
|
35
|
+
|
36
|
+
**Disable an RHSM repository**
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
rhsm_repo 'rhel-7-server-extras-rpms' do
|
40
|
+
action :disable
|
41
|
+
end
|
42
|
+
```
|
43
|
+
DOC
|
29
44
|
|
30
45
|
property :repo_name, String,
|
31
46
|
description: "An optional property for specifying the repository name if it differs from the resource block's name.",
|
@@ -75,7 +75,8 @@ class Chef
|
|
75
75
|
|
76
76
|
property :group, [String, Integer],
|
77
77
|
description: "The file group for the ssh_known_hosts file.",
|
78
|
-
default: lazy { node["root_group"] }
|
78
|
+
default: lazy { node["root_group"] },
|
79
|
+
default_description: "The root user's group depending on platform."
|
79
80
|
|
80
81
|
property :hash_entries, [TrueClass, FalseClass],
|
81
82
|
description: "Hash the hostname and addresses in the ssh_known_hosts file for privacy.",
|
@@ -85,9 +86,7 @@ class Chef
|
|
85
86
|
description: "The location of the ssh known hosts file. Change this to set a known host file for a particular user.",
|
86
87
|
default: "/etc/ssh/ssh_known_hosts"
|
87
88
|
|
88
|
-
action :create do
|
89
|
-
description "Create an entry in the ssh_known_hosts file."
|
90
|
-
|
89
|
+
action :create, description: "Create an entry in the ssh_known_hosts file." do
|
91
90
|
key =
|
92
91
|
if new_resource.key
|
93
92
|
hoststr = (new_resource.port != 22) ? "[#{new_resource.host}]:#{new_resource.port}" : new_resource.host
|
@@ -129,9 +128,7 @@ class Chef
|
|
129
128
|
end
|
130
129
|
|
131
130
|
# all this does is send an immediate run_action(:create) to the template resource
|
132
|
-
action :flush do
|
133
|
-
description "Immediately flush the entries to the config file. Without this the actual writing of the file is delayed in the #{ChefUtils::Dist::Infra::PRODUCT} run so all entries can be accumulated before writing the file out."
|
134
|
-
|
131
|
+
action :flush, description: "Immediately flush the entries to the config file. Without this the actual writing of the file is delayed in the #{ChefUtils::Dist::Infra::PRODUCT} run so all entries can be accumulated before writing the file out." do
|
135
132
|
with_run_context :root do
|
136
133
|
# if you haven't ever called ssh_known_hosts_entry before you're definitely doing it wrong so we blow up hard.
|
137
134
|
find_resource!(:template, "update ssh known hosts file #{new_resource.file_location}").run_action(:create)
|
data/lib/chef/resource/sudo.rb
CHANGED
@@ -170,9 +170,7 @@ class Chef
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
|
-
action :create do
|
174
|
-
description "Create a single sudoers config in the sudoers.d directory"
|
175
|
-
|
173
|
+
action :create, description: "Create a single sudoers configuration file in the `sudoers.d` directory." do
|
176
174
|
validate_properties
|
177
175
|
|
178
176
|
if docker? # don't even put this into resource collection unless we're in docker
|
@@ -230,9 +228,7 @@ class Chef
|
|
230
228
|
end
|
231
229
|
|
232
230
|
# Removes a user from the sudoers group
|
233
|
-
action :delete do
|
234
|
-
description "Remove a sudoers config from the sudoers.d directory"
|
235
|
-
|
231
|
+
action :delete, description: "Remove a sudoers configuration file from the `sudoers.d` directory." do
|
236
232
|
file "#{new_resource.config_prefix}/sudoers.d/#{new_resource.filename}" do
|
237
233
|
action :delete
|
238
234
|
end
|
@@ -63,9 +63,7 @@ class Chef
|
|
63
63
|
property :swappiness, Integer,
|
64
64
|
description: "The swappiness value to set on the system."
|
65
65
|
|
66
|
-
action :create do
|
67
|
-
description "Create a swapfile."
|
68
|
-
|
66
|
+
action :create, description: "Create a swapfile." do
|
69
67
|
if swap_enabled?
|
70
68
|
Chef::Log.debug("#{new_resource} already created - nothing to do")
|
71
69
|
else
|
@@ -85,9 +83,7 @@ class Chef
|
|
85
83
|
end
|
86
84
|
end
|
87
85
|
|
88
|
-
action :remove do
|
89
|
-
description "Remove a swapfile and disable swap."
|
90
|
-
|
86
|
+
action :remove, description: "Remove a swapfile and disable swap." do
|
91
87
|
swapoff if swap_enabled?
|
92
88
|
remove_swapfile if ::File.exist?(new_resource.path)
|
93
89
|
end
|
data/lib/chef/resource/sysctl.rb
CHANGED
@@ -131,7 +131,7 @@ class Chef
|
|
131
131
|
|
132
132
|
end
|
133
133
|
|
134
|
-
action :apply, description: "Apply a sysctl value" do
|
134
|
+
action :apply, description: "Apply a sysctl value." do
|
135
135
|
converge_if_changed do
|
136
136
|
# set it temporarily
|
137
137
|
set_sysctl_param(new_resource.key, new_resource.value)
|
@@ -150,7 +150,7 @@ class Chef
|
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
|
-
action :remove, description: "Remove a sysctl value" do
|
153
|
+
action :remove, description: "Remove a sysctl value." do
|
154
154
|
# only converge the resource if the file actually exists to delete
|
155
155
|
if ::File.exist?("#{new_resource.conf_dir}/99-chef-#{new_resource.key.tr("/", ".")}.conf")
|
156
156
|
converge_by "removing sysctl config at #{new_resource.conf_dir}/99-chef-#{new_resource.key.tr("/", ".")}.conf" do
|
@@ -119,7 +119,7 @@ class Chef
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
action :set, description: "Set the system timezone" do
|
122
|
+
action :set, description: "Set the system timezone." do
|
123
123
|
# we have to check windows first since the value isn't case sensitive here
|
124
124
|
if windows?
|
125
125
|
unless current_windows_tz.casecmp?(new_resource.timezone)
|
@@ -78,7 +78,7 @@ class Chef
|
|
78
78
|
coerce: proc { |m| m.end_with?(".conf") ? m : m + ".conf" },
|
79
79
|
default: lazy { |r| r.username == "*" ? "00_all_limits.conf" : "#{r.username}_limits.conf" }
|
80
80
|
|
81
|
-
action :create, description: "Create a ulimit configuration file" do
|
81
|
+
action :create, description: "Create a ulimit configuration file." do
|
82
82
|
template "/etc/security/limits.d/#{new_resource.filename}" do
|
83
83
|
source ::File.expand_path("support/ulimit.erb", __dir__)
|
84
84
|
local true
|
@@ -106,7 +106,7 @@ class Chef
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
-
action :delete, description: "Delete an existing ulimit configuration file" do
|
109
|
+
action :delete, description: "Delete an existing ulimit configuration file." do
|
110
110
|
file "/etc/security/limits.d/#{new_resource.filename}" do
|
111
111
|
action :delete
|
112
112
|
end
|