From b3057cc7f55fadd57e54dba45242f692806bc2ba Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Mon, 15 Feb 2021 13:01:38 -0800 Subject: Improve automatic docs generation Signed-off-by: Tim Smith --- lib/chef/resource/apt_package.rb | 2 +- lib/chef/resource/apt_repository.rb | 4 ++-- lib/chef/resource/chef_client_cron.rb | 4 ++-- lib/chef/resource/chef_client_launchd.rb | 4 ++-- lib/chef/resource/chef_client_scheduled_task.rb | 2 +- lib/chef/resource/chef_client_systemd_timer.rb | 4 ++-- lib/chef/resource/chef_handler.rb | 2 +- lib/chef/resource/cron/_cron_shared.rb | 4 ++-- lib/chef/resource/dpkg_package.rb | 2 +- lib/chef/resource/file.rb | 2 +- lib/chef/resource/group.rb | 4 ++-- lib/chef/resource/http_request.rb | 2 +- lib/chef/resource/locale.rb | 2 +- lib/chef/resource/mdadm.rb | 2 +- lib/chef/resource/openssl_x509_certificate.rb | 4 ++-- lib/chef/resource/remote_file.rb | 2 +- lib/chef/resource/scm/git.rb | 2 +- lib/chef/resource/sudo.rb | 12 ++++++------ lib/chef/resource/template.rb | 2 +- lib/chef/resource/windows_feature.rb | 12 +++--------- lib/chef/resource/windows_feature_dism.rb | 8 ++------ lib/chef/resource/windows_feature_powershell.rb | 6 +++--- lib/chef/resource/windows_firewall_profile.rb | 4 ++-- lib/chef/resource/windows_firewall_rule.rb | 7 ++----- lib/chef/resource/windows_font.rb | 4 +--- lib/chef/resource/windows_pagefile.rb | 8 ++------ lib/chef/resource/windows_path.rb | 4 ++-- lib/chef/resource/windows_printer.rb | 4 ++-- lib/chef/resource/windows_printer_port.rb | 4 ++-- lib/chef/resource/windows_share.rb | 6 +++--- spec/unit/property_spec.rb | 2 +- 31 files changed, 56 insertions(+), 75 deletions(-) diff --git a/lib/chef/resource/apt_package.rb b/lib/chef/resource/apt_package.rb index 0a31f89af3..331d411373 100644 --- a/lib/chef/resource/apt_package.rb +++ b/lib/chef/resource/apt_package.rb @@ -72,7 +72,7 @@ class Chef property :response_file_variables, Hash, description: "A Hash of response file variables in the form of {'VARIABLE' => 'VALUE'}.", - default: lazy { {} }, desired_state: false + default: {}, desired_state: false end end diff --git a/lib/chef/resource/apt_repository.rb b/lib/chef/resource/apt_repository.rb index 843c699f4c..1ba21c2f9b 100644 --- a/lib/chef/resource/apt_repository.rb +++ b/lib/chef/resource/apt_repository.rb @@ -128,7 +128,7 @@ class Chef property :components, Array, description: "Package groupings, such as 'main' and 'stable'.", - default: lazy { [] }, default_description: "`main` if using a PPA repository." + default: [], default_description: "`main` if using a PPA repository." property :arch, [String, nil, FalseClass], description: "Constrain packages to a particular CPU architecture such as `i386` or `amd64`." @@ -147,7 +147,7 @@ class Chef property :key, [String, Array, nil, FalseClass], description: "If a keyserver is provided, this is assumed to be the fingerprint; otherwise it can be either the URI of GPG key for the repo, or a cookbook_file.", - default: lazy { [] }, coerce: proc { |x| x ? Array(x) : x } + default: [], coerce: proc { |x| x ? Array(x) : x } property :key_proxy, [String, nil, FalseClass], description: "If set, a specified proxy is passed to GPG via `http-proxy=`." diff --git a/lib/chef/resource/chef_client_cron.rb b/lib/chef/resource/chef_client_cron.rb index 222b4043bb..dc6c2cbebd 100644 --- a/lib/chef/resource/chef_client_cron.rb +++ b/lib/chef/resource/chef_client_cron.rb @@ -131,11 +131,11 @@ class Chef description: "The path to the #{ChefUtils::Dist::Infra::CLIENT} binary." property :daemon_options, Array, - default: lazy { [] }, default_description: "Empty Array", + default: [], description: "An array of options to pass to the #{ChefUtils::Dist::Infra::CLIENT} command." property :environment, Hash, - default: lazy { {} }, default_description: "Empty Hash", + default: {}, description: "A Hash containing additional arbitrary environment variables under which the cron job will be run in the form of `({'ENV_VARIABLE' => 'VALUE'})`." property :nice, [Integer, String], diff --git a/lib/chef/resource/chef_client_launchd.rb b/lib/chef/resource/chef_client_launchd.rb index c44b80d480..04b88aa550 100644 --- a/lib/chef/resource/chef_client_launchd.rb +++ b/lib/chef/resource/chef_client_launchd.rb @@ -86,11 +86,11 @@ class Chef property :daemon_options, Array, description: "An array of options to pass to the #{ChefUtils::Dist::Infra::CLIENT} command.", - default: lazy { [] } + default: [] property :environment, Hash, description: "A Hash containing additional arbitrary environment variables under which the launchd daemon will be run in the form of `({'ENV_VARIABLE' => 'VALUE'})`.", - default: lazy { {} } + default: {} property :nice, [Integer, String], description: "The process priority to run the #{ChefUtils::Dist::Infra::CLIENT} process at. A value of -20 is the highest priority and 19 is the lowest priority.", diff --git a/lib/chef/resource/chef_client_scheduled_task.rb b/lib/chef/resource/chef_client_scheduled_task.rb index 25780afdf4..7c6b9079fa 100644 --- a/lib/chef/resource/chef_client_scheduled_task.rb +++ b/lib/chef/resource/chef_client_scheduled_task.rb @@ -127,7 +127,7 @@ class Chef property :daemon_options, Array, description: "An array of options to pass to the #{ChefUtils::Dist::Infra::CLIENT} command.", - default: lazy { [] } + default: [] action :add do # TODO: Replace this with a :create_if_missing action on directory when that exists diff --git a/lib/chef/resource/chef_client_systemd_timer.rb b/lib/chef/resource/chef_client_systemd_timer.rb index e911fc2cb0..bc338fa85a 100644 --- a/lib/chef/resource/chef_client_systemd_timer.rb +++ b/lib/chef/resource/chef_client_systemd_timer.rb @@ -92,11 +92,11 @@ class Chef property :daemon_options, Array, description: "An array of options to pass to the #{ChefUtils::Dist::Infra::CLIENT} command.", - default: lazy { [] } + default: [] property :environment, Hash, description: "A Hash containing additional arbitrary environment variables under which the systemd timer will be run in the form of `({'ENV_VARIABLE' => 'VALUE'})`.", - default: lazy { {} } + default: {} property :cpu_quota, [Integer, String], description: "The systemd CPUQuota to run the #{ChefUtils::Dist::Infra::CLIENT} process with. This is a percentage value of the total CPU time available on the system. If the system has more than 1 core this may be a value greater than 100.", diff --git a/lib/chef/resource/chef_handler.rb b/lib/chef/resource/chef_handler.rb index a66d290380..a07ba77d64 100644 --- a/lib/chef/resource/chef_handler.rb +++ b/lib/chef/resource/chef_handler.rb @@ -182,7 +182,7 @@ class Chef property :arguments, [Array, Hash], description: "Arguments to pass the handler's class initializer.", - default: lazy { [] } + default: [] property :type, Hash, description: "The type of handler to register as, i.e. :report, :exception or both.", diff --git a/lib/chef/resource/cron/_cron_shared.rb b/lib/chef/resource/cron/_cron_shared.rb index 6d11035862..3dba74e77f 100644 --- a/lib/chef/resource/cron/_cron_shared.rb +++ b/lib/chef/resource/cron/_cron_shared.rb @@ -61,7 +61,7 @@ property :user, String, property :environment, Hash, description: "A Hash containing additional arbitrary environment variables under which the cron job will be run in the form of `({'ENV_VARIABLE' => 'VALUE'})`. **Note**: These variables must exist for a command to be run successfully.", - default: lazy { {} } + default: {} property :time_out, Hash, description: "A Hash of timeouts in the form of `({'OPTION' => 'VALUE'})`. Accepted valid options are: @@ -69,7 +69,7 @@ property :time_out, Hash, - `foreground` (BOOL, default: 'false'), - `kill-after` (in seconds), - `signal` (a name like 'HUP' or a number)", - default: lazy { {} }, + default: {}, introduced: "15.7", coerce: proc { |h| if h.is_a?(Hash) diff --git a/lib/chef/resource/dpkg_package.rb b/lib/chef/resource/dpkg_package.rb index 466b17d702..1ad460e591 100644 --- a/lib/chef/resource/dpkg_package.rb +++ b/lib/chef/resource/dpkg_package.rb @@ -36,7 +36,7 @@ class Chef property :response_file_variables, Hash, description: "A Hash of response file variables in the form of {'VARIABLE' => 'VALUE'}.", - default: lazy { {} }, desired_state: false + default: {}, desired_state: false end end end diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index b2bba06185..5cc510571a 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -81,7 +81,7 @@ class Chef property :manage_symlink_source, [ TrueClass, FalseClass ], desired_state: false, description: "Change the behavior of the file resource if it is pointed at a symlink. When this value is set to true, #{ChefUtils::Dist::Infra::PRODUCT} will manage the symlink's permissions or will replace the symlink with a normal file if the resource has content. When this value is set to false, #{ChefUtils::Dist::Infra::PRODUCT} will follow the symlink and will manage the permissions and content of symlink's target file. The default behavior is true but emits a warning that the default value will be changed to false in a future version; setting this explicitly to true or false suppresses this warning." - property :verifications, Array, default: lazy { [] } + property :verifications, Array, default: [] def verify(command = nil, opts = {}, &block) unless command.nil? || [String, Symbol].include?(command.class) diff --git a/lib/chef/resource/group.rb b/lib/chef/resource/group.rb index 3a129592d0..b76d546b60 100644 --- a/lib/chef/resource/group.rb +++ b/lib/chef/resource/group.rb @@ -37,11 +37,11 @@ class Chef property :gid, [ String, Integer ], description: "The identifier for the group." - property :members, [String, Array], default: lazy { [] }, + property :members, [String, Array], default: [], coerce: proc { |arg| arg.is_a?(String) ? arg.split(/\s*,\s*/) : arg }, description: "Which users should be set or appended to a group. When more than one group member is identified, the list of members should be an array: members ['user1', 'user2']." - property :excluded_members, [String, Array], default: lazy { [] }, + property :excluded_members, [String, Array], default: [], coerce: proc { |arg| arg.is_a?(String) ? arg.split(/\s*,\s*/) : arg }, description: "Remove users from a group. May only be used when append is set to true." diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb index f53d3e731f..8a1354e6cd 100644 --- a/lib/chef/resource/http_request.rb +++ b/lib/chef/resource/http_request.rb @@ -34,7 +34,7 @@ class Chef property :url, String, identity: true, description: "The URL to which an HTTP request is sent." - property :headers, Hash, default: lazy { {} }, + property :headers, Hash, default: {}, description: "A Hash of custom headers." def initialize(name, run_context = nil) diff --git a/lib/chef/resource/locale.rb b/lib/chef/resource/locale.rb index 8800ec04f2..552b654867 100644 --- a/lib/chef/resource/locale.rb +++ b/lib/chef/resource/locale.rb @@ -49,7 +49,7 @@ class Chef property :lc_env, Hash, description: "A Hash of LC_* env variables in the form of `({ 'LC_ENV_VARIABLE' => 'VALUE' })`.", - default: lazy { {} }, + default: {}, coerce: proc { |h| if h.respond_to?(:keys) invalid_keys = h.keys - LC_VARIABLES diff --git a/lib/chef/resource/mdadm.rb b/lib/chef/resource/mdadm.rb index f2e610c1cf..b66b8bbfc4 100644 --- a/lib/chef/resource/mdadm.rb +++ b/lib/chef/resource/mdadm.rb @@ -39,7 +39,7 @@ class Chef description: "The chunk size. This property should not be used for a RAID 1 mirrored pair (i.e. when the `level` property is set to `1`)." property :devices, Array, - default: lazy { [] }, + default: [], description: "The devices to be part of a RAID array." # @todo this should get refactored away diff --git a/lib/chef/resource/openssl_x509_certificate.rb b/lib/chef/resource/openssl_x509_certificate.rb index c723f47d61..e8ad9b62b7 100644 --- a/lib/chef/resource/openssl_x509_certificate.rb +++ b/lib/chef/resource/openssl_x509_certificate.rb @@ -108,11 +108,11 @@ class Chef property :extensions, Hash, description: "Hash of X509 Extensions entries, in format `{ 'keyUsage' => { 'values' => %w( keyEncipherment digitalSignature), 'critical' => true } }`.", - default: lazy { {} } + default: {} property :subject_alt_name, Array, description: "Array of Subject Alternative Name entries, in format `DNS:example.com` or `IP:1.2.3.4`.", - default: lazy { [] } + default: [] property :key_file, String, description: "The path to a certificate key file on the filesystem. If the key_file property is specified, the resource will attempt to source a key from this location. If no key file is found, the resource will generate a new key file at this location. If the key_file property is not specified, the resource will generate a key file in the same directory as the generated certificate, with the same name as the generated certificate." diff --git a/lib/chef/resource/remote_file.rb b/lib/chef/resource/remote_file.rb index ac0b2fe6a7..f47a8ba2c9 100644 --- a/lib/chef/resource/remote_file.rb +++ b/lib/chef/resource/remote_file.rb @@ -95,7 +95,7 @@ class Chef property :ftp_active_mode, [ TrueClass, FalseClass ], default: false, description: "Whether #{ChefUtils::Dist::Infra::PRODUCT} uses active or passive FTP. Set to `true` to use active FTP." - property :headers, Hash, default: lazy { {} }, + property :headers, Hash, default: {}, description: "A Hash of custom HTTP headers." property :show_progress, [ TrueClass, FalseClass ], default: false diff --git a/lib/chef/resource/scm/git.rb b/lib/chef/resource/scm/git.rb index 8293d1ed4a..af49704ee6 100644 --- a/lib/chef/resource/scm/git.rb +++ b/lib/chef/resource/scm/git.rb @@ -112,7 +112,7 @@ class Chef property :additional_remotes, Hash, description: "A Hash of additional remotes that are added to the git repository configuration.", - default: lazy { {} } + default: {} property :depth, Integer, description: "The number of past revisions to be included in the git shallow clone. Unless specified the default behavior will do a full clone." diff --git a/lib/chef/resource/sudo.rb b/lib/chef/resource/sudo.rb index d6587bd441..f7405f2270 100644 --- a/lib/chef/resource/sudo.rb +++ b/lib/chef/resource/sudo.rb @@ -71,12 +71,12 @@ class Chef property :users, [String, Array], description: "User(s) to provide sudo privileges to. This property accepts either an array or a comma separated list.", - default: lazy { [] }, + default: [], coerce: proc { |x| x.is_a?(Array) ? x : x.split(/\s*,\s*/) } property :groups, [String, Array], description: "Group(s) to provide sudo privileges to. This property accepts either an array or a comma separated list. Leading % on group names is optional.", - default: lazy { [] }, + default: [], coerce: proc { |x| coerce_groups(x) } property :commands, Array, @@ -108,11 +108,11 @@ class Chef property :defaults, Array, description: "An array of defaults for the user/group.", - default: lazy { [] } + default: [] property :command_aliases, Array, description: "Command aliases that can be used as allowed commands later in the configuration.", - default: lazy { [] } + default: [] property :setenv, [TrueClass, FalseClass], description: "Determines whether or not to permit preservation of the environment with `sudo -E`.", @@ -120,11 +120,11 @@ class Chef property :env_keep_add, Array, description: "An array of strings to add to `env_keep`.", - default: lazy { [] } + default: [] property :env_keep_subtract, Array, description: "An array of strings to remove from `env_keep`.", - default: lazy { [] } + default: [] property :visudo_path, String, deprecated: true diff --git a/lib/chef/resource/template.rb b/lib/chef/resource/template.rb index e3f266740d..60b431ab8e 100644 --- a/lib/chef/resource/template.rb +++ b/lib/chef/resource/template.rb @@ -61,7 +61,7 @@ class Chef property :variables, Hash, description: "The variables property of the template resource can be used to reference a partial template file by using a Hash.", - default: lazy { {} } + default: {} property :cookbook, String, description: "The cookbook in which a file is located (if it is not located in the current cookbook). The default value is the current cookbook.", diff --git a/lib/chef/resource/windows_feature.rb b/lib/chef/resource/windows_feature.rb index 760a7fe3f1..0e7a61e8f1 100644 --- a/lib/chef/resource/windows_feature.rb +++ b/lib/chef/resource/windows_feature.rb @@ -108,21 +108,15 @@ class Chef default: 600, desired_state: false - action :install do - description "Install a Windows role/feature" - + action :install, description: "Install a Windows role / feature" do run_default_subresource :install end - action :remove do - description "Remove a Windows role/feature" - + action :remove, description: "Remove a Windows role / feature" do run_default_subresource :remove end - action :delete do - description "Remove a Windows role/feature from the image" - + action :delete, description: "Remove a Windows role/feature from the image" do run_default_subresource :delete end diff --git a/lib/chef/resource/windows_feature_dism.rb b/lib/chef/resource/windows_feature_dism.rb index c9e2f355dc..7a0aef9197 100644 --- a/lib/chef/resource/windows_feature_dism.rb +++ b/lib/chef/resource/windows_feature_dism.rb @@ -91,9 +91,7 @@ class Chef end end - action :remove do - description "Remove a Windows role/feature using DISM" - + action :remove, description: "Remove a Windows role / feature using DISM" do reload_cached_dism_data unless node["dism_features_cache"] logger.trace("Windows features needing removal: #{features_to_remove.empty? ? "none" : features_to_remove.join(",")}") @@ -108,9 +106,7 @@ class Chef end end - action :delete do - description "Remove a Windows role/feature from the image using DISM" - + action :delete, description: "Remove a Windows role / feature from the image using DISM" do reload_cached_dism_data unless node["dism_features_cache"] fail_if_unavailable # fail if the features don't exist diff --git a/lib/chef/resource/windows_feature_powershell.rb b/lib/chef/resource/windows_feature_powershell.rb index 735ed080ff..229ceff6ea 100644 --- a/lib/chef/resource/windows_feature_powershell.rb +++ b/lib/chef/resource/windows_feature_powershell.rb @@ -87,7 +87,7 @@ class Chef x.map(&:downcase) end - action :install do + action :install, description: "Install a Windows role / feature using PowerShell" do reload_cached_powershell_data unless node["powershell_features_cache"] fail_if_unavailable # fail if the features don't exist fail_if_removed # fail if the features are in removed state @@ -108,7 +108,7 @@ class Chef end end - action :remove do + action :remove, description: "Remove a Windows role / feature using PowerShell" do reload_cached_powershell_data unless node["powershell_features_cache"] Chef::Log.debug("Windows features needing removal: #{features_to_remove.empty? ? "none" : features_to_remove.join(",")}") @@ -123,7 +123,7 @@ class Chef end end - action :delete do + action :delete, description: "Delete a Windows role / feature from the image using PowerShell" do reload_cached_powershell_data unless node["powershell_features_cache"] fail_if_unavailable # fail if the features don't exist diff --git a/lib/chef/resource/windows_firewall_profile.rb b/lib/chef/resource/windows_firewall_profile.rb index ada9729699..c56942ed72 100644 --- a/lib/chef/resource/windows_firewall_profile.rb +++ b/lib/chef/resource/windows_firewall_profile.rb @@ -121,7 +121,7 @@ class Chef end end - action :enable do + action :enable, description: "Enable and optionally configure a Windows Firewall profile" do converge_if_changed :default_inbound_action, :default_outbound_action, :allow_inbound_rules, :allow_local_firewall_rules, :allow_local_ipsec_rules, :allow_user_apps, :allow_user_ports, :allow_unicast_response, :display_notification do fw_cmd = firewall_command(new_resource.profile) @@ -135,7 +135,7 @@ class Chef end end - action :disable do + action :disable, description: "Disable a Windows Firewall profile" do if firewall_enabled?(new_resource.profile) converge_by "Disable the #{new_resource.profile} Firewall Profile" do cmd = "Set-NetFirewallProfile -Profile #{new_resource.profile} -Enabled \"False\"" diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb index a6f0614362..8256ea6df9 100644 --- a/lib/chef/resource/windows_firewall_rule.rb +++ b/lib/chef/resource/windows_firewall_rule.rb @@ -185,8 +185,7 @@ class Chef enabled state["enabled"] end - action :create do - description "Create a Windows firewall entry." + action :create, description: "Create a Windows firewall entry" do if current_resource converge_if_changed :rule_name, :description, :displayname, :local_address, :local_port, :remote_address, :remote_port, :direction, :protocol, :icmp_type, :firewall_action, :profile, :program, :service, @@ -207,9 +206,7 @@ class Chef end end - action :delete do - description "Delete an existing Windows firewall entry." - + action :delete, description: "Delete an existing Windows firewall entry" do if current_resource converge_by("delete firewall rule #{new_resource.rule_name}") do powershell_exec!("Remove-NetFirewallRule -Name '#{new_resource.rule_name}'") diff --git a/lib/chef/resource/windows_font.rb b/lib/chef/resource/windows_font.rb index c9128aa4b0..d57720b704 100644 --- a/lib/chef/resource/windows_font.rb +++ b/lib/chef/resource/windows_font.rb @@ -45,9 +45,7 @@ class Chef description: "A local filesystem path or URI that is used to source the font file.", coerce: proc { |x| /^.:.*/.match?(x) ? x.tr('\\', "/").gsub("//", "/") : x } - action :install do - description "Install a font to the system fonts directory." - + action :install, description: "Install a font to the system fonts directory" do if font_exists? logger.trace("Not installing font: #{new_resource.font_name} as font already installed.") else diff --git a/lib/chef/resource/windows_pagefile.rb b/lib/chef/resource/windows_pagefile.rb index 4dfaae3be3..6b39bfc35b 100644 --- a/lib/chef/resource/windows_pagefile.rb +++ b/lib/chef/resource/windows_pagefile.rb @@ -73,9 +73,7 @@ class Chef property :maximum_size, Integer, description: "Maximum size of the pagefile in megabytes." - action :set do - description "Configures the default pagefile, creating if it doesn't exist." - + action :set, description: "Configures the default pagefile, creating if it doesn't exist" do pagefile = new_resource.path initial_size = new_resource.initial_size maximum_size = new_resource.maximum_size @@ -103,9 +101,7 @@ class Chef end end - action :delete do - description "Deletes the specified pagefile." - + action :delete, description: "Deletes the specified pagefile" do validate_name delete(new_resource.path) if exists?(new_resource.path) end diff --git a/lib/chef/resource/windows_path.rb b/lib/chef/resource/windows_path.rb index 870ffdef3f..f0cc316e66 100644 --- a/lib/chef/resource/windows_path.rb +++ b/lib/chef/resource/windows_path.rb @@ -64,7 +64,7 @@ class Chef end end - action :add do + action :add, description: "Add an item to the system path" do # The windows Env provider does not correctly expand variables in # the PATH environment variable. Ruby expects these to be expanded. # @@ -76,7 +76,7 @@ class Chef end end - action :remove do + action :remove, description: "Remove an item from the system path" do # The windows Env provider does not correctly expand variables in # the PATH environment variable. Ruby expects these to be expanded. # diff --git a/lib/chef/resource/windows_printer.rb b/lib/chef/resource/windows_printer.rb index dea15ba112..7c298db5da 100644 --- a/lib/chef/resource/windows_printer.rb +++ b/lib/chef/resource/windows_printer.rb @@ -90,7 +90,7 @@ class Chef name desired.name end - action :create do + action :create, description: "Create a new printer and printer port, if one doesn't already" do description "Create a new printer and a printer port if one doesn't already exist." if printer_exists? @@ -102,7 +102,7 @@ class Chef end end - action :delete do + action :delete, description: "Delete an existing printer. Note that this resource does not delete the associated printer port." do description "Delete an existing printer. Note this does not delete the associated printer port." if printer_exists? diff --git a/lib/chef/resource/windows_printer_port.rb b/lib/chef/resource/windows_printer_port.rb index 2a4eaa09b3..e61785d50b 100644 --- a/lib/chef/resource/windows_printer_port.rb +++ b/lib/chef/resource/windows_printer_port.rb @@ -95,7 +95,7 @@ class Chef port_name desired.port_name || "IP_#{desired.ipv4_address}" end - action :create do + action :create, description: "Create the printer port, if one doesn't already exist" do description "Create the new printer port if it does not already exist." if port_exists? @@ -107,7 +107,7 @@ class Chef end end - action :delete do + action :delete, description: "Delete an existing printer port" do description "Delete an existing printer port." if port_exists? diff --git a/lib/chef/resource/windows_share.rb b/lib/chef/resource/windows_share.rb index fca63ade05..0984fab924 100644 --- a/lib/chef/resource/windows_share.rb +++ b/lib/chef/resource/windows_share.rb @@ -70,17 +70,17 @@ class Chef # Specifies which accounts are granted full permission to access the share. Use a comma-separated list to specify multiple accounts. An account may not be specified more than once in the FullAccess, ChangeAccess, or ReadAccess parameter lists, but may be specified once in the FullAccess, ChangeAccess, or ReadAccess parameter list and once in the NoAccess parameter list. property :full_users, Array, description: "The users that should have 'Full control' permissions on the share in domain\\username format.", - default: lazy { [] }, coerce: proc { |u| u.sort } + default: [], coerce: proc { |u| u.sort } # Specifies which users are granted modify permission to access the share property :change_users, Array, description: "The users that should have 'modify' permission on the share in domain\\username format.", - default: lazy { [] }, coerce: proc { |u| u.sort } + default: [], coerce: proc { |u| u.sort } # Specifies which users are granted read permission to access the share. Multiple users can be specified by supplying a comma-separated list. property :read_users, Array, description: "The users that should have 'read' permission on the share in domain\\username format.", - default: lazy { [] }, coerce: proc { |u| u.sort } + default: [], coerce: proc { |u| u.sort } # Specifies the lifetime of the new SMB share. A temporary share does not persist beyond the next restart of the computer. By default, new SMB shares are persistent, and non-temporary. property :temporary, [TrueClass, FalseClass], diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb index 6c64a961b4..d223c14c39 100644 --- a/spec/unit/property_spec.rb +++ b/spec/unit/property_spec.rb @@ -574,7 +574,7 @@ describe "Chef::Resource.property" do end end - with_property ":x, default: lazy { {} }" do + with_property ":x, default: {}" do it "when x is not set, it returns {}" do expect(resource.x).to eq({}) end -- cgit v1.2.1