diff options
author | Tim Smith <tsmith@chef.io> | 2018-07-10 11:11:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-10 11:11:02 -0700 |
commit | da49f2552a5c940356dd7b647f99191443cde887 (patch) | |
tree | ee7507f6fb0d3911f4a35e472b3636541a233901 | |
parent | d57a36eb9996697ebaf3240edafa801bb7664cdd (diff) | |
parent | 97cfef7bdf6448b342deec6825f945d6cfb55e7d (diff) | |
download | chef-da49f2552a5c940356dd7b647f99191443cde887.tar.gz |
Merge pull request #7444 from chef/resource_descriptions
Add missing descriptions and add periods after resource the descriptions
25 files changed, 74 insertions, 60 deletions
diff --git a/lib/chef/guard_interpreter/resource_guard_interpreter.rb b/lib/chef/guard_interpreter/resource_guard_interpreter.rb index b1d497181b..79134d3dfb 100644 --- a/lib/chef/guard_interpreter/resource_guard_interpreter.rb +++ b/lib/chef/guard_interpreter/resource_guard_interpreter.rb @@ -36,7 +36,7 @@ class Chef # Only execute and script resources and use guard attributes. # The command to be executed on them are passed via different attributes. # Script resources use code attribute and execute resources use - # command attribute. Moreover script resources are also execute + # command property. Moreover script resources are also execute # resources. Here we make sure @command is assigned to the right # attribute by checking the type of the resources. # We need to make sure we check for Script first because any resource diff --git a/lib/chef/provider/windows_task.rb b/lib/chef/provider/windows_task.rb index f10e4adb70..4fb4817020 100644 --- a/lib/chef/provider/windows_task.rb +++ b/lib/chef/provider/windows_task.rb @@ -563,7 +563,7 @@ class Chef new_resource.password.nil? ? TaskScheduler::TASK_LOGON_SERVICE_ACCOUNT : TaskScheduler::TASK_LOGON_PASSWORD end - # This method checks if task and command attributes exist since those two are mandatory attributes to create a schedules task. + # This method checks if task and command properties exist since those two are mandatory properties to create a schedules task. def basic_validation validate = [] validate << "Command" if new_resource.command.nil? || new_resource.command.empty? diff --git a/lib/chef/resource/chocolatey_config.rb b/lib/chef/resource/chocolatey_config.rb index bfa95ddd05..e9452e8f3c 100644 --- a/lib/chef/resource/chocolatey_config.rb +++ b/lib/chef/resource/chocolatey_config.rb @@ -24,7 +24,7 @@ class Chef introduced "14.3" property :config_key, String, name_property: true, - description: "The name of the config. We'll use the resource's name if this isn't provided." + description: "The name of the config. The resource's name will be used if this isn't provided." property :value, String, description: "The value to set." diff --git a/lib/chef/resource/chocolatey_source.rb b/lib/chef/resource/chocolatey_source.rb index 2a2948e986..5319f82ab4 100644 --- a/lib/chef/resource/chocolatey_source.rb +++ b/lib/chef/resource/chocolatey_source.rb @@ -23,10 +23,17 @@ class Chef description "Use the chocolatey_source resource to add or remove Chocolatey sources." introduced "14.3" - property :source_name, String, name_property: true - property :source, String - property :bypass_proxy, [TrueClass, FalseClass], default: false - property :priority, Integer, default: 0 + property :source_name, String, name_property: true, + description: "The name of the source to add. The resource's name will be used if this isn't provided." + + property :source, String, + description: "The source URL." + + property :bypass_proxy, [TrueClass, FalseClass], default: false, + description: "Whether or not to bypass the system's proxy settings to access the source." + + property :priority, Integer, default: 0, + description: "The priority level of the source." load_current_value do element = fetch_source_element(source_name) diff --git a/lib/chef/resource/homebrew_tap.rb b/lib/chef/resource/homebrew_tap.rb index 2028ce80c8..ab56f6a4c9 100644 --- a/lib/chef/resource/homebrew_tap.rb +++ b/lib/chef/resource/homebrew_tap.rb @@ -49,7 +49,7 @@ class Chef default: "/usr/local/bin/brew" property :owner, String, - description: "The owner of the homebrew installation", + description: "The owner of the homebrew installation.", default: lazy { find_homebrew_username } action :tap do diff --git a/lib/chef/resource/hostname.rb b/lib/chef/resource/hostname.rb index f213ae47ad..82240bd6fb 100644 --- a/lib/chef/resource/hostname.rb +++ b/lib/chef/resource/hostname.rb @@ -27,23 +27,23 @@ class Chef introduced "14.0" property :hostname, String, - description: "The hostname if different than the resource's name", + description: "The hostname if different than the resource's name.", name_property: true property :compile_time, [ TrueClass, FalseClass ], - description: "Should the resource run at compile time or not.", + description: "Whether the resource runs at compile time or not.", default: true property :ipaddress, String, - description: "The ip address to use when configuring the hosts file", + description: "The ip address to use when configuring the hosts file.", default: lazy { node["ipaddress"] } property :aliases, [ Array, nil ], - description: "An array of hostname aliases to use when configuring the hosts file", + description: "An array of hostname aliases to use when configuring the hosts file.", default: nil property :windows_reboot, [ TrueClass, FalseClass ], - description: "Should Windows nodes be rebooted upon changing the name so it can take effect", + description: "Whether Windows nodes will be rebooted upon changing the name so changes can take effect.", default: true action_class do @@ -80,7 +80,7 @@ class Chef end action :set do - description "Sets the node's hostname" + description "Sets the node's hostname." if node["platform_family"] != "windows" ohai "reload hostname" do diff --git a/lib/chef/resource/ifconfig.rb b/lib/chef/resource/ifconfig.rb index 84ee249ec4..d43b8c2d58 100644 --- a/lib/chef/resource/ifconfig.rb +++ b/lib/chef/resource/ifconfig.rb @@ -79,11 +79,11 @@ class Chef property :ethtool_opts, String, introduced: "13.4", - description: "Options to be passed to ethtool(8). For example: -A eth0 autoneg off rx off tx off" + description: "Options to be passed to ethtool(8). For example: -A eth0 autoneg off rx off tx off." property :bonding_opts, String, introduced: "13.4", - description: "Bonding options to pass via BONDING_OPTS on RHEL and CentOS. For example: mode=active-backup miimon=100" + description: "Bonding options to pass via BONDING_OPTS on RHEL and CentOS. For example: mode=active-backup miimon=100." property :master, String, introduced: "13.4", diff --git a/lib/chef/resource/kernel_module.rb b/lib/chef/resource/kernel_module.rb index bea56dedc2..54f213cd11 100644 --- a/lib/chef/resource/kernel_module.rb +++ b/lib/chef/resource/kernel_module.rb @@ -30,7 +30,7 @@ class Chef default: "/etc/modprobe.d" action :install do - description "Load kernel module, and ensure it loads on reboot" + description "Load kernel module, and ensure it loads on reboot." # load the module first before installing new_resource.run_action(:load) @@ -98,7 +98,7 @@ class Chef end action :unload do - description "Unload kernel module" + description "Unload kernel module." if module_loaded? converge_by("unload kernel module #{new_resource.modname}") do diff --git a/lib/chef/resource/ohai_hint.rb b/lib/chef/resource/ohai_hint.rb index f485222ec6..66146ff16a 100644 --- a/lib/chef/resource/ohai_hint.rb +++ b/lib/chef/resource/ohai_hint.rb @@ -34,11 +34,11 @@ class Chef description: "Values to include in the hint file." property :compile_time, [TrueClass, FalseClass], - description: "Should the resource execute during the compile time phase", + description: "Whether the resource will execute during the compile time phase or not.", default: true, desired_state: false action :create do - description "Create an Ohai hint file" + description "Create an Ohai hint file." declare_resource(:directory, ::Ohai::Config.ohai.hints_path.first) do action :create @@ -52,7 +52,7 @@ class Chef end action :delete do - description "Delete an Ohai hint file" + description "Delete an Ohai hint file." declare_resource(:file, ohai_hint_file_path(new_resource.hint_name)) do action :delete diff --git a/lib/chef/resource/openssl_dhparam.rb b/lib/chef/resource/openssl_dhparam.rb index ec98237a1b..b7bc8438f2 100644 --- a/lib/chef/resource/openssl_dhparam.rb +++ b/lib/chef/resource/openssl_dhparam.rb @@ -59,7 +59,7 @@ class Chef default: "0640" action :create do - description "Create the dhparam file" + description "Create the dhparam file." unless dhparam_pem_valid?(new_resource.path) converge_by("Create a dhparam file #{new_resource.path}") do diff --git a/lib/chef/resource/openssl_rsa_private_key.rb b/lib/chef/resource/openssl_rsa_private_key.rb index be4c85bcbb..1bc8f73f47 100644 --- a/lib/chef/resource/openssl_rsa_private_key.rb +++ b/lib/chef/resource/openssl_rsa_private_key.rb @@ -68,6 +68,8 @@ class Chef default: false, desired_state: false action :create do + description "Create the RSA private key." + return if new_resource.force || priv_key_file_valid?(new_resource.path, new_resource.key_pass) converge_by("create #{new_resource.key_length} bit RSA key #{new_resource.path}") do diff --git a/lib/chef/resource/powershell_package.rb b/lib/chef/resource/powershell_package.rb index ae6e410f21..ba5a03ef8b 100644 --- a/lib/chef/resource/powershell_package.rb +++ b/lib/chef/resource/powershell_package.rb @@ -37,7 +37,8 @@ class Chef property :package_name, [String, Array], coerce: proc { |x| [x].flatten } property :version, [String, Array], coerce: proc { |x| [x].flatten } property :source, [String] - property :skip_publisher_check, [true, false], default: false, introduced: "14.3", description: "Skip validating module author" + property :skip_publisher_check, [true, false], default: false, introduced: "14.3", + description: "Skip validating module author." end end end diff --git a/lib/chef/resource/powershell_package_source.rb b/lib/chef/resource/powershell_package_source.rb index 9fa4bc8497..1ed3b895a1 100644 --- a/lib/chef/resource/powershell_package_source.rb +++ b/lib/chef/resource/powershell_package_source.rb @@ -24,19 +24,19 @@ class Chef preview_resource true resource_name "powershell_package_source" - description "Use the powershell_package_source resource to register a powershell package repository" + description "Use the powershell_package_source resource to register a powershell package repository." introduced "14.3" property :source_name, String, - description: "The name of the package source", + description: "The name of the package source.", name_property: true property :url, String, - description: "The url to the package source", + description: "The url to the package source.", required: true property :trusted, [TrueClass, FalseClass], - description: "Whether or not to trust packages from this source", + description: "Whether or not to trust packages from this source.", default: false property :provider_name, String, diff --git a/lib/chef/resource/rhsm_errata.rb b/lib/chef/resource/rhsm_errata.rb index 96de1bafe7..15b6dab8bc 100644 --- a/lib/chef/resource/rhsm_errata.rb +++ b/lib/chef/resource/rhsm_errata.rb @@ -33,7 +33,7 @@ class Chef name_property: true action :install do - description "Installs a package for a specific errata ID" + description "Installs a package for a specific errata ID." execute "Install errata packages for #{new_resource.errata_id}" do command "yum update --advisory #{new_resource.errata_id} -y" diff --git a/lib/chef/resource/rhsm_errata_level.rb b/lib/chef/resource/rhsm_errata_level.rb index 73c9dc0423..ee94a3e60f 100644 --- a/lib/chef/resource/rhsm_errata_level.rb +++ b/lib/chef/resource/rhsm_errata_level.rb @@ -35,7 +35,7 @@ class Chef name_property: true action :install do - descripton "Install all packages of the specified errata level" + descripton "Install all packages of the specified errata level." yum_package "yum-plugin-security" do action :install diff --git a/lib/chef/resource/rhsm_register.rb b/lib/chef/resource/rhsm_register.rb index 0e478eff38..f0c86ccaac 100644 --- a/lib/chef/resource/rhsm_register.rb +++ b/lib/chef/resource/rhsm_register.rb @@ -36,10 +36,10 @@ class Chef description: "The FQDN of the Satellite host to register with. If not specified, the host will be registered with Red Hat's public RHSM service." property :organization, String, - description: "The organization to use when registering, required when using an activation key" + description: "The organization to use when registering, required when using an activation key." property :environment, String, - description: "The environment to use when registering, required when using username and password" + description: "The environment to use when registering, required when using username and password." property :username, String, description: "The username to use when registering. Not applicable if using an activation key. If specified, password and environment are also required." @@ -61,7 +61,7 @@ class Chef default: false, desired_state: false action :register do - description "Register the node with RHSM" + description "Register the node with RHSM." package "subscription-manager" @@ -98,7 +98,7 @@ class Chef end action :unregister do - description "Unregister the node from RHSM" + description "Unregister the node from RHSM." execute "Unregister from RHSM" do command "subscription-manager unregister" diff --git a/lib/chef/resource/rhsm_repo.rb b/lib/chef/resource/rhsm_repo.rb index 9eba096f51..54f829e79e 100644 --- a/lib/chef/resource/rhsm_repo.rb +++ b/lib/chef/resource/rhsm_repo.rb @@ -32,7 +32,7 @@ class Chef name_property: true action :enable do - description "Enable a RHSM repository" + description "Enable a RHSM repository." execute "Enable repository #{new_resource.repo_name}" do command "subscription-manager repos --enable=#{new_resource.repo_name}" @@ -42,7 +42,7 @@ class Chef end action :disable do - description "Disable a RHSM repository" + description "Disable a RHSM repository." execute "Enable repository #{new_resource.repo_name}" do command "subscription-manager repos --disable=#{new_resource.repo_name}" diff --git a/lib/chef/resource/rhsm_subscription.rb b/lib/chef/resource/rhsm_subscription.rb index 9f198dc917..1f6eb9edee 100644 --- a/lib/chef/resource/rhsm_subscription.rb +++ b/lib/chef/resource/rhsm_subscription.rb @@ -33,7 +33,7 @@ class Chef name_property: true action :attach do - description "Attach the node to a subscription pool" + description "Attach the node to a subscription pool." execute "Attach subscription pool #{new_resource.pool_id}" do command "subscription-manager attach --pool=#{new_resource.pool_id}" @@ -43,7 +43,7 @@ class Chef end action :remove do - description "Remove the node from a subscription pool" + description "Remove the node from a subscription pool." execute "Remove subscription pool #{new_resource.pool_id}" do command "subscription-manager remove --serial=#{pool_serial(new_resource.pool_id)}" diff --git a/lib/chef/resource/script.rb b/lib/chef/resource/script.rb index d3562ee6f5..ac3af619e5 100644 --- a/lib/chef/resource/script.rb +++ b/lib/chef/resource/script.rb @@ -40,7 +40,7 @@ class Chef # FIXME: remove this and use an execute sub-resource instead of inheriting from Execute def command(arg = nil) unless arg.nil? - raise Chef::Exceptions::Script, "Do not use the command attribute on a #{resource_name} resource, use the 'code' attribute instead." + raise Chef::Exceptions::Script, "Do not use the command property on a #{resource_name} resource, use the 'code' property instead." end super end diff --git a/lib/chef/resource/service.rb b/lib/chef/resource/service.rb index fe13c433cb..c5197d5f06 100644 --- a/lib/chef/resource/service.rb +++ b/lib/chef/resource/service.rb @@ -123,7 +123,7 @@ class Chef # distributions this is '/etc/init.d/SERVICE_NAME' by default. In # non-standard configurations setting this value will save having to # specify overrides for the start_command, stop_command and - # restart_command attributes. + # restart_command properties. def init_command(arg = nil) set_or_return( :init_command, diff --git a/lib/chef/resource/sudo.rb b/lib/chef/resource/sudo.rb index af26bde595..87799e5bbb 100644 --- a/lib/chef/resource/sudo.rb +++ b/lib/chef/resource/sudo.rb @@ -37,7 +37,7 @@ class Chef # acording to the sudo man pages sudo will ignore files in an include dir that have a `.` or `~` # We convert either to `__` property :filename, String, - description: "The name of the sudoers.d file", + description: "The name of the sudoers.d file.", name_property: true, coerce: proc { |x| x.gsub(/[\.~]/, "__") } @@ -60,11 +60,11 @@ class Chef default: "ALL" property :runas, String, - description: "User the command(s) can be run as", + description: "User the command(s) can be run as.", default: "ALL" property :nopasswd, [TrueClass, FalseClass], - description: "Allow running sudo without specifying a password sudo", + description: "Allow running sudo without specifying a password sudo.", default: false property :noexec, [TrueClass, FalseClass], @@ -83,7 +83,7 @@ class Chef default: lazy { [] } property :command_aliases, Array, - description: "Command aliases that can be used as allowed commands later in the config", + description: "Command aliases that can be used as allowed commands later in the config.", default: lazy { [] } property :setenv, [TrueClass, FalseClass], diff --git a/lib/chef/resource/sysctl.rb b/lib/chef/resource/sysctl.rb index 496eb05cb8..e03b7a362c 100644 --- a/lib/chef/resource/sysctl.rb +++ b/lib/chef/resource/sysctl.rb @@ -50,8 +50,8 @@ class Chef default: "/etc/sysctl.d" def after_created - raise "The systctl resource requires Linux as it needs sysctl and the systctl.d directory functionality." unless node["os"] == "linux" - raise "The systctl resource does not support SLES releases less than 12 as it requires a systctl.d directory" if platform_family?("suse") && node["platform_version"].to_i < 12 + raise "The sysctl resource requires Linux as it needs sysctl and the sysctl.d directory functionality." unless node["os"] == "linux" + raise "The sysctl resource does not support SLES releases less than 12 as it requires a sysctl.d directory" if platform_family?("suse") && node["platform_version"].to_i < 12 end def coerce_value(v) @@ -63,15 +63,17 @@ class Chef end end - # shellout to systctl to get the current value + # shellout to sysctl to get the current value # ignore missing keys by using '-e' - # convert tabs to spaces since systctl tab deliminates multivalue parameters + # convert tabs to spaces since sysctl tab deliminates multivalue parameters # strip the newline off the end of the output as well load_current_value do value shell_out!("sysctl -n -e #{key}").stdout.tr("\t", " ").strip end action :apply do + description "Apply a sysctl value." + converge_if_changed do # set it temporarily set_sysctl_param(new_resource.key, new_resource.value) @@ -91,9 +93,11 @@ class Chef end action :remove do + description "Remove a sysctl value." + # only converge the resource if the file actually exists to delete if ::File.exist?("#{new_resource.conf_dir}/99-chef-#{new_resource.key}.conf") - converge_by "removing systctl config at #{new_resource.conf_dir}/99-chef-#{new_resource.key}.conf" do + converge_by "removing sysctl config at #{new_resource.conf_dir}/99-chef-#{new_resource.key}.conf" do file "#{new_resource.conf_dir}/99-chef-#{new_resource.key}.conf" do action :delete end diff --git a/spec/functional/resource/bash_spec.rb b/spec/functional/resource/bash_spec.rb index 4a5fee64bc..969ed8f605 100644 --- a/spec/functional/resource/bash_spec.rb +++ b/spec/functional/resource/bash_spec.rb @@ -27,7 +27,7 @@ describe Chef::Resource::Bash, :unix_only do resource end - describe "when setting the command attribute" do + describe "when setting the command property" do let (:command) { "wizard racket" } it "should raise an exception when trying to set the command" do diff --git a/spec/unit/provider/execute_spec.rb b/spec/unit/provider/execute_spec.rb index 48cee78462..622d54af37 100644 --- a/spec/unit/provider/execute_spec.rb +++ b/spec/unit/provider/execute_spec.rb @@ -102,7 +102,7 @@ describe Chef::Provider::Execute do expect(new_resource).to be_updated end - it "if you pass a command attribute, it runs the command" do + it "if you pass a command property, it runs the command" do new_resource.command "/usr/argelbargle/bin/oogachacka 12345" expect(provider).to receive(:shell_out!).with(new_resource.command, opts) expect(provider).to receive(:converge_by).with("execute #{new_resource.command}").and_call_original diff --git a/spec/unit/resource/dsc_script_spec.rb b/spec/unit/resource/dsc_script_spec.rb index d5ebcaca5c..26a1c7cca0 100644 --- a/spec/unit/resource/dsc_script_spec.rb +++ b/spec/unit/resource/dsc_script_spec.rb @@ -45,27 +45,27 @@ describe Chef::Resource::DscScript do expect { resource.action :run }.not_to raise_error end - it "allows the code attribute to be set" do + it "allows the code property to be set" do resource.code(configuration_code) expect(resource.code).to eq(configuration_code) end - it "allows the command attribute to be set" do + it "allows the command property to be set" do resource.command(configuration_path) expect(resource.command).to eq(configuration_path) end - it "allows the configuration_name attribute to be set" do + it "allows the configuration_name property to be set" do resource.configuration_name(configuration_name) expect(resource.configuration_name).to eq(configuration_name) end - it "allows the configuration_data attribute to be set" do + it "allows the configuration_data property to be set" do resource.configuration_data(configuration_data) expect(resource.configuration_data).to eq(configuration_data) end - it "allows the configuration_data_script attribute to be set" do + it "allows the configuration_data_script property to be set" do resource.configuration_data_script(configuration_data_script) expect(resource.configuration_data_script).to eq(configuration_data_script) end @@ -106,27 +106,27 @@ describe Chef::Resource::DscScript do end end - it "raises an ArgumentError exception if an attempt is made to set the code attribute when the command attribute is already set" do + it "raises an ArgumentError exception if an attempt is made to set the code property when the command property is already set" do resource.command(configuration_path) expect { resource.code(configuration_code) }.to raise_error(ArgumentError) end - it "raises an ArgumentError exception if an attempt is made to set the command attribute when the code attribute is already set" do + it "raises an ArgumentError exception if an attempt is made to set the command property when the code property is already set" do resource.code(configuration_code) expect { resource.command(configuration_path) }.to raise_error(ArgumentError) end - it "raises an ArgumentError exception if an attempt is made to set the configuration_name attribute when the code attribute is already set" do + it "raises an ArgumentError exception if an attempt is made to set the configuration_name property when the code property is already set" do resource.code(configuration_code) expect { resource.configuration_name(configuration_name) }.to raise_error(ArgumentError) end - it "raises an ArgumentError exception if an attempt is made to set the configuration_data attribute when the configuration_data_script attribute is already set" do + it "raises an ArgumentError exception if an attempt is made to set the configuration_data property when the configuration_data_script property is already set" do resource.configuration_data_script(configuration_data_script) expect { resource.configuration_data(configuration_data) }.to raise_error(ArgumentError) end - it "raises an ArgumentError exception if an attempt is made to set the configuration_data_script attribute when the configuration_data attribute is already set" do + it "raises an ArgumentError exception if an attempt is made to set the configuration_data_script property when the configuration_data property is already set" do resource.configuration_data(configuration_data) expect { resource.configuration_data_script(configuration_data_script) }.to raise_error(ArgumentError) end |