From 1539ebfd364801f41b7e2d62c2fef1b9d1e935b7 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 16 Oct 2020 12:08:55 -0700 Subject: Use action not the alias of allowed_actions Use the actual method not the aliases method name. Signed-off-by: Tim Smith --- lib/chef/resource/apt_preference.rb | 2 +- lib/chef/resource/apt_repository.rb | 2 +- lib/chef/resource/apt_update.rb | 2 +- lib/chef/resource/cab_package.rb | 2 +- lib/chef/resource/chocolatey_package.rb | 2 +- lib/chef/resource/cron/cron.rb | 2 +- lib/chef/resource/directory.rb | 2 +- lib/chef/resource/dnf_package.rb | 2 +- lib/chef/resource/file.rb | 2 +- lib/chef/resource/group.rb | 2 +- lib/chef/resource/homebrew_update.rb | 2 +- lib/chef/resource/http_request.rb | 2 +- lib/chef/resource/ifconfig.rb | 2 +- lib/chef/resource/ips_package.rb | 2 +- lib/chef/resource/launchd.rb | 2 +- lib/chef/resource/link.rb | 2 +- lib/chef/resource/log.rb | 2 +- lib/chef/resource/lwrp_base.rb | 4 ++-- lib/chef/resource/mdadm.rb | 2 +- lib/chef/resource/mount.rb | 2 +- lib/chef/resource/msu_package.rb | 2 +- lib/chef/resource/package.rb | 2 +- lib/chef/resource/paludis_package.rb | 2 +- lib/chef/resource/powershell_package.rb | 2 +- lib/chef/resource/registry_key.rb | 2 +- lib/chef/resource/remote_directory.rb | 2 +- lib/chef/resource/route.rb | 2 +- lib/chef/resource/ruby_block.rb | 2 +- lib/chef/resource/scm/_scm.rb | 2 +- lib/chef/resource/scm/subversion.rb | 2 +- lib/chef/resource/service.rb | 2 +- lib/chef/resource/systemd_unit.rb | 2 +- lib/chef/resource/user.rb | 2 +- lib/chef/resource/windows_env.rb | 2 +- lib/chef/resource/windows_package.rb | 2 +- lib/chef/resource/windows_path.rb | 2 +- lib/chef/resource/windows_service.rb | 2 +- lib/chef/resource/windows_task.rb | 2 +- lib/chef/resource/yum_repository.rb | 2 +- lib/chef/resource/zypper_repository.rb | 2 +- lib/chef/resource_inspector.rb | 2 +- 41 files changed, 42 insertions(+), 42 deletions(-) diff --git a/lib/chef/resource/apt_preference.rb b/lib/chef/resource/apt_preference.rb index fd987466ea..bdbfc06c8f 100644 --- a/lib/chef/resource/apt_preference.rb +++ b/lib/chef/resource/apt_preference.rb @@ -76,7 +76,7 @@ class Chef required: [:add] default_action :add - allowed_actions :add, :remove + actions :add, :remove APT_PREFERENCE_DIR = "/etc/apt/preferences.d".freeze diff --git a/lib/chef/resource/apt_repository.rb b/lib/chef/resource/apt_repository.rb index da8ca78413..6101d3d77a 100644 --- a/lib/chef/resource/apt_repository.rb +++ b/lib/chef/resource/apt_repository.rb @@ -161,7 +161,7 @@ class Chef default: true, desired_state: false default_action :add - allowed_actions :add, :remove + actions :add, :remove action_class do LIST_APT_KEY_FINGERPRINTS = %w{apt-key adv --list-public-keys --with-fingerprint --with-colons}.freeze diff --git a/lib/chef/resource/apt_update.rb b/lib/chef/resource/apt_update.rb index e5f75143bb..e3a4f26cf2 100644 --- a/lib/chef/resource/apt_update.rb +++ b/lib/chef/resource/apt_update.rb @@ -52,7 +52,7 @@ class Chef default: 86_400 default_action :periodic - allowed_actions :update, :periodic + actions :update, :periodic action_class do APT_CONF_DIR = "/etc/apt/apt.conf.d".freeze diff --git a/lib/chef/resource/cab_package.rb b/lib/chef/resource/cab_package.rb index 904fe81701..c54a4da5ae 100644 --- a/lib/chef/resource/cab_package.rb +++ b/lib/chef/resource/cab_package.rb @@ -59,7 +59,7 @@ class Chef ``` DOC - allowed_actions :install, :remove + actions :install, :remove property :package_name, String, description: "An optional property to set the package name if it differs from the resource block's name.", diff --git a/lib/chef/resource/chocolatey_package.rb b/lib/chef/resource/chocolatey_package.rb index e0568e586a..c8188864db 100644 --- a/lib/chef/resource/chocolatey_package.rb +++ b/lib/chef/resource/chocolatey_package.rb @@ -46,7 +46,7 @@ class Chef ``` DOC - allowed_actions :install, :upgrade, :remove, :purge, :reconfig + actions :install, :upgrade, :remove, :purge, :reconfig # windows can't take Array options yet property :options, [String, Array], diff --git a/lib/chef/resource/cron/cron.rb b/lib/chef/resource/cron/cron.rb index 31d6efcfde..fe79a34cb2 100644 --- a/lib/chef/resource/cron/cron.rb +++ b/lib/chef/resource/cron/cron.rb @@ -35,7 +35,7 @@ class Chef state_attrs :minute, :hour, :day, :month, :weekday, :user default_action :create - allowed_actions :create, :delete + actions :create, :delete property :time, Symbol, description: "A time interval.", diff --git a/lib/chef/resource/directory.rb b/lib/chef/resource/directory.rb index d51fb144f7..0dae4048cf 100644 --- a/lib/chef/resource/directory.rb +++ b/lib/chef/resource/directory.rb @@ -40,7 +40,7 @@ class Chef include Chef::Mixin::Securable default_action :create - allowed_actions :create, :delete + actions :create, :delete property :path, String, name_property: true, description: "The path to the directory. Using a fully qualified path is recommended, but is not always required." diff --git a/lib/chef/resource/dnf_package.rb b/lib/chef/resource/dnf_package.rb index 80727de7d0..1b42cbb36b 100644 --- a/lib/chef/resource/dnf_package.rb +++ b/lib/chef/resource/dnf_package.rb @@ -43,7 +43,7 @@ class Chef description "Use the **dnf_package** resource to install, upgrade, and remove packages with DNF for Fedora and RHEL 8+. The dnf_package resource is able to resolve provides data for packages much like DNF can do when it is run from the command line. This allows a variety of options for installing packages, like minimum versions, virtual provides and library names." introduced "12.18" - allowed_actions :install, :upgrade, :remove, :purge, :reconfig, :lock, :unlock, :flush_cache + actions :install, :upgrade, :remove, :purge, :reconfig, :lock, :unlock, :flush_cache # Install a specific arch property :arch, [String, Array], diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index 214f8018ab..1df1072039 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -53,7 +53,7 @@ class Chef attr_accessor :final_checksum default_action :create - allowed_actions :create, :delete, :touch, :create_if_missing + actions :create, :delete, :touch, :create_if_missing property :path, String, name_property: true, description: "The full path to the file, including the file name and its extension. For example: /files/file.txt. Default value: the name of the resource block. Microsoft Windows: A path that begins with a forward slash `/` will point to the root of the current working directory of the #{ChefUtils::Dist::Infra::PRODUCT} process. This path can vary from system to system. Therefore, using a path that begins with a forward slash `/` is not recommended." diff --git a/lib/chef/resource/group.rb b/lib/chef/resource/group.rb index 3a129592d0..23420a7f36 100644 --- a/lib/chef/resource/group.rb +++ b/lib/chef/resource/group.rb @@ -27,7 +27,7 @@ class Chef provides :group - allowed_actions :create, :remove, :modify, :manage + actions :create, :remove, :modify, :manage default_action :create property :group_name, String, diff --git a/lib/chef/resource/homebrew_update.rb b/lib/chef/resource/homebrew_update.rb index cc191cbbdb..cac08ee4ea 100644 --- a/lib/chef/resource/homebrew_update.rb +++ b/lib/chef/resource/homebrew_update.rb @@ -52,7 +52,7 @@ class Chef default: 86_400 default_action :periodic - allowed_actions :update, :periodic + actions :update, :periodic action_class do BREW_STAMP_DIR = "/var/lib/homebrew/periodic".freeze diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb index de714ab4ab..97dc4f6539 100644 --- a/lib/chef/resource/http_request.rb +++ b/lib/chef/resource/http_request.rb @@ -29,7 +29,7 @@ class Chef description "Use the **http_request** resource to send an HTTP request (GET, PUT, POST, DELETE, HEAD, or OPTIONS) with an arbitrary message. This resource is often useful when custom callbacks are necessary." default_action :get - allowed_actions :get, :patch, :put, :post, :delete, :head, :options + actions :get, :patch, :put, :post, :delete, :head, :options property :url, String, identity: true, description: "The URL to which an HTTP request is sent." diff --git a/lib/chef/resource/ifconfig.rb b/lib/chef/resource/ifconfig.rb index ed62ab5952..103f3917b0 100644 --- a/lib/chef/resource/ifconfig.rb +++ b/lib/chef/resource/ifconfig.rb @@ -35,7 +35,7 @@ class Chef state_attrs :inet_addr, :mask default_action :add - allowed_actions :add, :delete, :enable, :disable + actions :add, :delete, :enable, :disable property :target, String, name_property: true, diff --git a/lib/chef/resource/ips_package.rb b/lib/chef/resource/ips_package.rb index a579a5a5a2..b10957463f 100644 --- a/lib/chef/resource/ips_package.rb +++ b/lib/chef/resource/ips_package.rb @@ -29,7 +29,7 @@ class Chef description "Use the **ips_package** resource to manage packages (using Image Packaging System (IPS)) on the Solaris 11 platform." - allowed_actions :install, :remove, :upgrade + actions :install, :remove, :upgrade property :package_name, String, description: "An optional property to set the package name if it differs from the resource block's name.", diff --git a/lib/chef/resource/launchd.rb b/lib/chef/resource/launchd.rb index c8e3d93afc..e26b9d13b2 100644 --- a/lib/chef/resource/launchd.rb +++ b/lib/chef/resource/launchd.rb @@ -28,7 +28,7 @@ class Chef introduced "12.8" default_action :create - allowed_actions :create, :create_if_missing, :delete, :enable, :disable, :restart + actions :create, :create_if_missing, :delete, :enable, :disable, :restart property :label, String, name_property: true, diff --git a/lib/chef/resource/link.rb b/lib/chef/resource/link.rb index e1422d0d61..413877b2b6 100644 --- a/lib/chef/resource/link.rb +++ b/lib/chef/resource/link.rb @@ -41,7 +41,7 @@ class Chef state_attrs :owner # required since it's not a property below default_action :create - allowed_actions :create, :delete + actions :create, :delete property :target_file, String, description: "An optional property to set the target file if it differs from the resource block's name.", diff --git a/lib/chef/resource/log.rb b/lib/chef/resource/log.rb index e9f8bc315a..9a0e577856 100644 --- a/lib/chef/resource/log.rb +++ b/lib/chef/resource/log.rb @@ -47,7 +47,7 @@ class Chef equal_to: %i{debug info warn error fatal}, default: :info, description: "The logging level to display this message at." - allowed_actions :write + actions :write default_action :write def suppress_up_to_date_messages? diff --git a/lib/chef/resource/lwrp_base.rb b/lib/chef/resource/lwrp_base.rb index a1d2afd791..1bd127079a 100644 --- a/lib/chef/resource/lwrp_base.rb +++ b/lib/chef/resource/lwrp_base.rb @@ -88,8 +88,8 @@ class Chef # @deprecated def valid_actions(*args) - Chef::Log.warn("`valid_actions' is deprecated, please use allowed_actions `instead'!") - allowed_actions(*args) + Chef::Log.warn("`valid_actions` is deprecated, please use `actions` instead!") + actions(*args) end # Set the run context on the class. Used to provide access to the node diff --git a/lib/chef/resource/mdadm.rb b/lib/chef/resource/mdadm.rb index 7c1d066488..245ccf2ca8 100644 --- a/lib/chef/resource/mdadm.rb +++ b/lib/chef/resource/mdadm.rb @@ -32,7 +32,7 @@ class Chef " and then by using the mount provider to create a file systems table (fstab) entry." default_action :create - allowed_actions :create, :assemble, :stop + actions :create, :assemble, :stop property :chunk, Integer, default: 16, diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb index ed5d9a0e0b..e291c005ab 100644 --- a/lib/chef/resource/mount.rb +++ b/lib/chef/resource/mount.rb @@ -28,7 +28,7 @@ class Chef provides :mount default_action :mount - allowed_actions :mount, :umount, :unmount, :remount, :enable, :disable + actions :mount, :umount, :unmount, :remount, :enable, :disable # this is a poor API please do not re-use this pattern property :supports, [Array, Hash], diff --git a/lib/chef/resource/msu_package.rb b/lib/chef/resource/msu_package.rb index 23e92b2dd1..247683aa4f 100644 --- a/lib/chef/resource/msu_package.rb +++ b/lib/chef/resource/msu_package.rb @@ -30,7 +30,7 @@ class Chef description "Use the **msu_package** resource to install Microsoft Update(MSU) packages on Microsoft Windows machines." introduced "12.17" - allowed_actions :install, :remove + actions :install, :remove default_action :install property :package_name, String, diff --git a/lib/chef/resource/package.rb b/lib/chef/resource/package.rb index db3b12d289..5bd7c0215d 100644 --- a/lib/chef/resource/package.rb +++ b/lib/chef/resource/package.rb @@ -34,7 +34,7 @@ class Chef " recommended to use the package resource as often as possible." default_action :install - allowed_actions :install, :upgrade, :remove, :purge, :reconfig, :lock, :unlock + actions :install, :upgrade, :remove, :purge, :reconfig, :lock, :unlock def initialize(name, *args) # We capture name here, before it gets coerced to name diff --git a/lib/chef/resource/paludis_package.rb b/lib/chef/resource/paludis_package.rb index 385922c940..8dfc3a932c 100644 --- a/lib/chef/resource/paludis_package.rb +++ b/lib/chef/resource/paludis_package.rb @@ -29,7 +29,7 @@ class Chef description "Use the **paludis_package** resource to manage packages for the Paludis platform." introduced "12.1" - allowed_actions :install, :remove, :upgrade + actions :install, :remove, :upgrade property :package_name, String, description: "An optional property to set the package name if it differs from the resource block's name.", diff --git a/lib/chef/resource/powershell_package.rb b/lib/chef/resource/powershell_package.rb index 7d013eac4c..de0d830374 100644 --- a/lib/chef/resource/powershell_package.rb +++ b/lib/chef/resource/powershell_package.rb @@ -27,7 +27,7 @@ class Chef description "Use the **powershell_package** resource to install and manage packages via the PowerShell Package Manager for the Microsoft Windows platform. The powershell_package resource requires administrative access, and a source must be configured in the PowerShell Package Manager via the powershell_package_source resource." introduced "12.16" - allowed_actions :install, :remove + actions :install, :remove property :package_name, [String, Array], description: "The name of the package. Default value: the name of the resource block.", diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb index 7e51ea1ef6..0296f3bca1 100644 --- a/lib/chef/resource/registry_key.rb +++ b/lib/chef/resource/registry_key.rb @@ -31,7 +31,7 @@ class Chef state_attrs :values default_action :create - allowed_actions :create, :create_if_missing, :delete, :delete_key + actions :create, :create_if_missing, :delete, :delete_key # Some registry key data types may not be safely reported as json. # Example (CHEF-5323): diff --git a/lib/chef/resource/remote_directory.rb b/lib/chef/resource/remote_directory.rb index b6dc0b7a98..c35b6d52d9 100644 --- a/lib/chef/resource/remote_directory.rb +++ b/lib/chef/resource/remote_directory.rb @@ -32,7 +32,7 @@ class Chef description "Use the **remote_directory** resource to incrementally transfer a directory from a cookbook to a node. The director that is copied from the cookbook should be located under COOKBOOK_NAME/files/default/REMOTE_DIRECTORY. The remote_directory resource will obey file specificity." default_action :create - allowed_actions :create, :create_if_missing, :delete + actions :create, :create_if_missing, :delete def initialize(name, run_context = nil) super diff --git a/lib/chef/resource/route.rb b/lib/chef/resource/route.rb index 82f961679b..bd42cf881e 100644 --- a/lib/chef/resource/route.rb +++ b/lib/chef/resource/route.rb @@ -27,7 +27,7 @@ class Chef provides :route default_action :add - allowed_actions :add, :delete + actions :add, :delete description "Use the **route** resource to manage the system routing table in a Linux environment." diff --git a/lib/chef/resource/ruby_block.rb b/lib/chef/resource/ruby_block.rb index 427c3e25da..03c6bb9ae5 100644 --- a/lib/chef/resource/ruby_block.rb +++ b/lib/chef/resource/ruby_block.rb @@ -31,7 +31,7 @@ class Chef description "Use the **ruby_block** resource to execute Ruby code during a #{ChefUtils::Dist::Infra::PRODUCT} run. Ruby code in the ruby_block resource is evaluated with other resources during convergence, whereas Ruby code outside of a ruby_block resource is evaluated before other resources, as the recipe is compiled." default_action :run - allowed_actions :create, :run + actions :create, :run def block(&block) if block_given? && block diff --git a/lib/chef/resource/scm/_scm.rb b/lib/chef/resource/scm/_scm.rb index c939246ba1..09a6e203da 100644 --- a/lib/chef/resource/scm/_scm.rb +++ b/lib/chef/resource/scm/_scm.rb @@ -19,7 +19,7 @@ unified_mode true default_action :sync -allowed_actions :checkout, :export, :sync, :diff, :log +actions :checkout, :export, :sync, :diff, :log property :destination, String, description: "The location path to which the source is to be cloned, checked out, or exported. Default value: the name of the resource block.", diff --git a/lib/chef/resource/scm/subversion.rb b/lib/chef/resource/scm/subversion.rb index f5637b04ad..d750e893d2 100644 --- a/lib/chef/resource/scm/subversion.rb +++ b/lib/chef/resource/scm/subversion.rb @@ -30,7 +30,7 @@ class Chef description "Use the **subversion** resource to manage source control resources that exist in a Subversion repository." - allowed_actions :force_export + actions :force_export property :svn_arguments, [String, nil, FalseClass], description: "The extra arguments that are passed to the Subversion command.", diff --git a/lib/chef/resource/service.rb b/lib/chef/resource/service.rb index 63674a3c93..ea6f9164e6 100644 --- a/lib/chef/resource/service.rb +++ b/lib/chef/resource/service.rb @@ -34,7 +34,7 @@ class Chef description "Use the **service** resource to manage a service." default_action :nothing - allowed_actions :enable, :disable, :start, :stop, :restart, :reload, + actions :enable, :disable, :start, :stop, :restart, :reload, :mask, :unmask # this is a poor API please do not re-use this pattern diff --git a/lib/chef/resource/systemd_unit.rb b/lib/chef/resource/systemd_unit.rb index fc9aa4d40f..4a779cd842 100644 --- a/lib/chef/resource/systemd_unit.rb +++ b/lib/chef/resource/systemd_unit.rb @@ -31,7 +31,7 @@ class Chef introduced "12.11" default_action :nothing - allowed_actions :create, :delete, + actions :create, :delete, :preset, :revert, :enable, :disable, :reenable, :mask, :unmask, diff --git a/lib/chef/resource/user.rb b/lib/chef/resource/user.rb index 408932175d..8aa8620a64 100644 --- a/lib/chef/resource/user.rb +++ b/lib/chef/resource/user.rb @@ -26,7 +26,7 @@ class Chef description "Use the **user** resource to add users, update existing users, remove users, and to lock/unlock user passwords." default_action :create - allowed_actions :create, :remove, :modify, :manage, :lock, :unlock + actions :create, :remove, :modify, :manage, :lock, :unlock property :username, String, description: "An optional property to set the username value if it differs from the resource block's name.", diff --git a/lib/chef/resource/windows_env.rb b/lib/chef/resource/windows_env.rb index 35070d6623..46f46b5b15 100644 --- a/lib/chef/resource/windows_env.rb +++ b/lib/chef/resource/windows_env.rb @@ -37,7 +37,7 @@ class Chef DOC default_action :create - allowed_actions :create, :delete, :modify + actions :create, :delete, :modify property :key_name, String, description: "An optional property to set the name of the key that is to be created, deleted, or modified if it differs from the resource block's name.", diff --git a/lib/chef/resource/windows_package.rb b/lib/chef/resource/windows_package.rb index 2e10dde43d..bc3dd656a6 100644 --- a/lib/chef/resource/windows_package.rb +++ b/lib/chef/resource/windows_package.rb @@ -116,7 +116,7 @@ class Chef ``` DOC - allowed_actions :install, :remove + actions :install, :remove def initialize(name, run_context = nil) super diff --git a/lib/chef/resource/windows_path.rb b/lib/chef/resource/windows_path.rb index 850be66ba0..2a1e0d1681 100644 --- a/lib/chef/resource/windows_path.rb +++ b/lib/chef/resource/windows_path.rb @@ -43,7 +43,7 @@ class Chef ``` DOC - allowed_actions :add, :remove + actions :add, :remove default_action :add property :path, String, diff --git a/lib/chef/resource/windows_service.rb b/lib/chef/resource/windows_service.rb index defdf9fe29..54eea7fba4 100644 --- a/lib/chef/resource/windows_service.rb +++ b/lib/chef/resource/windows_service.rb @@ -39,7 +39,7 @@ class Chef description "Use the **windows_service** resource to create, delete, or manage a service on the Microsoft Windows platform." introduced "12.0" - allowed_actions :configure_startup, :create, :delete, :configure + actions :configure_startup, :create, :delete, :configure property :timeout, Integer, description: "The amount of time (in seconds) to wait before timing out.", diff --git a/lib/chef/resource/windows_task.rb b/lib/chef/resource/windows_task.rb index 4b6b9ba9cf..2f1995f032 100644 --- a/lib/chef/resource/windows_task.rb +++ b/lib/chef/resource/windows_task.rb @@ -140,7 +140,7 @@ class Chef ``` DOC - allowed_actions :create, :delete, :run, :end, :enable, :disable, :change + actions :create, :delete, :run, :end, :enable, :disable, :change default_action :create property :task_name, String, regex: [%r{\A[^/\:\*\?\<\>\|]+\z}], diff --git a/lib/chef/resource/yum_repository.rb b/lib/chef/resource/yum_repository.rb index 3070075959..5fabb8dc4a 100644 --- a/lib/chef/resource/yum_repository.rb +++ b/lib/chef/resource/yum_repository.rb @@ -194,7 +194,7 @@ class Chef description: "Username to use for basic authentication to a repository." default_action :create - allowed_actions :create, :remove, :makecache, :add, :delete + actions :create, :remove, :makecache, :add, :delete # provide compatibility with the yum cookbook < 3.0 properties alias_method :url, :baseurl diff --git a/lib/chef/resource/zypper_repository.rb b/lib/chef/resource/zypper_repository.rb index 05856cc9bc..9d87b85d8f 100644 --- a/lib/chef/resource/zypper_repository.rb +++ b/lib/chef/resource/zypper_repository.rb @@ -106,7 +106,7 @@ class Chef default: true default_action :create - allowed_actions :create, :remove, :add, :refresh + actions :create, :remove, :add, :refresh # provide compatibility with the zypper cookbook alias_method :key, :gpgkey diff --git a/lib/chef/resource_inspector.rb b/lib/chef/resource_inspector.rb index 53c0fbd913..00e82ecd03 100644 --- a/lib/chef/resource_inspector.rb +++ b/lib/chef/resource_inspector.rb @@ -40,7 +40,7 @@ module ResourceInspector data[:description] = resource.description # data[:deprecated] = resource.deprecated || false data[:default_action] = resource.default_action - data[:actions] = resource.allowed_actions + data[:actions] = resource.actions data[:examples] = resource.examples data[:introduced] = resource.introduced data[:preview] = resource.preview_resource -- cgit v1.2.1