diff options
author | Tim Smith <tsmith@chef.io> | 2020-03-06 12:00:50 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-06 12:00:50 -0800 |
commit | 78f43727ac4c14467270488e6109eeddb755fcee (patch) | |
tree | 11950f76a13ae01ade3c36e18da204cd00434ce3 /lib | |
parent | 2ca9781c9e0c38ca246f80df08f3d5565159850f (diff) | |
parent | e6167aa5fe2decfe2395012c302360fc50054b9c (diff) | |
download | chef-78f43727ac4c14467270488e6109eeddb755fcee.tar.gz |
Merge pull request #9441 from chef/lcg/remove-canonical-dsl
Remove the canonical DSL
Diffstat (limited to 'lib')
143 files changed, 185 insertions, 326 deletions
diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb index 3c78d6cb9b..8a858315b9 100644 --- a/lib/chef/node_map.rb +++ b/lib/chef/node_map.rb @@ -1,6 +1,6 @@ # # Author:: Lamont Granquist (<lamont@chef.io>) -# Copyright:: Copyright 2014-2019, Chef Software Inc. +# Copyright:: Copyright 2014-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -55,14 +55,13 @@ class Chef # # @return [NodeMap] Returns self for possible chaining # - def set(key, klass, platform: nil, platform_version: nil, platform_family: nil, os: nil, canonical: nil, override: nil, chef_version: nil, target_mode: nil, &block) + def set(key, klass, platform: nil, platform_version: nil, platform_family: nil, os: nil, override: nil, chef_version: nil, target_mode: nil, &block) new_matcher = { klass: klass } new_matcher[:platform] = platform if platform new_matcher[:platform_version] = platform_version if platform_version new_matcher[:platform_family] = platform_family if platform_family new_matcher[:os] = os if os new_matcher[:block] = block if block - new_matcher[:canonical] = canonical if canonical new_matcher[:override] = override if override new_matcher[:target_mode] = target_mode @@ -113,16 +112,14 @@ class Chef # @param node [Chef::Node] The Chef::Node object for the run, or `nil` to # ignore all filters. # @param key [Object] Key to look up - # @param canonical [Boolean] `true` or `false` to match canonical or - # non-canonical values only. `nil` to ignore canonicality. Default: `nil` # # @return [Object] Class # - def get(node, key, canonical: nil) + def get(node, key) return nil unless map.key?(key) map[key].map do |matcher| - return matcher[:klass] if node_matches?(node, matcher) && canonical_matches?(canonical, matcher) + return matcher[:klass] if node_matches?(node, matcher) end nil end @@ -134,16 +131,14 @@ class Chef # @param node [Chef::Node] The Chef::Node object for the run, or `nil` to # ignore all filters. # @param key [Object] Key to look up - # @param canonical [Boolean] `true` or `false` to match canonical or - # non-canonical values only. `nil` to ignore canonicality. Default: `nil` # # @return [Object] Class # - def list(node, key, canonical: nil) + def list(node, key) return [] unless map.key?(key) map[key].select do |matcher| - node_matches?(node, matcher) && canonical_matches?(canonical, matcher) + node_matches?(node, matcher) end.map { |matcher| matcher[:klass] } end @@ -174,21 +169,6 @@ class Chef deleted end - # Seriously, don't use this, it's nearly certain to change on you - # @return remaining - # @api private - def delete_canonical(key, klass) - remaining = map[key] - if remaining - remaining.delete_if { |matcher| matcher[:canonical] && Array(matcher[:klass]) == Array(klass) } - if remaining.empty? - map.delete(key) - remaining = nil - end - end - remaining - end - # Check if this map has been locked. # # @api internal @@ -299,12 +279,6 @@ class Chef filters_match?(node, matcher) && block_matches?(node, matcher[:block]) end - def canonical_matches?(canonical, matcher) - return true if canonical.nil? - - !!canonical == !!matcher[:canonical] - end - # # "provides" lines with identical filters sort by class name (ascending). # diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index ca1736aef9..ad2862c70b 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -940,13 +940,7 @@ class Chef # # The display name of this resource type, for printing purposes. # - # This also automatically calls "provides" to provide DSL with the given - # name. - # - # resource_name defaults to your class name. - # - # Call `resource_name nil` to remove the resource name (and any - # corresponding DSL). + # Call `resource_name nil` to remove the resource name # # @param value [Symbol] The desired name of this resource type (e.g. # `execute`), or `nil` if this class is abstract and has no resource_name. @@ -956,16 +950,13 @@ class Chef def self.resource_name(name = NOT_PASSED) # Setter if name != NOT_PASSED - remove_canonical_dsl - - # Set the resource_name and call provides if name + @resource_name = name.to_sym name = name.to_sym - # If our class is not already providing this name, provide it. + # FIXME: determine a way to deprecate this magic behavior unless Chef::ResourceResolver.includes_handler?(name, self) - provides name, canonical: true + provides name end - @resource_name = name else @resource_name = nil end @@ -977,19 +968,6 @@ class Chef resource_name(name) end - # - # Use the class name as the resource name. - # - # Munges the last part of the class name from camel case to snake case, - # and sets the resource_name to that: - # - # A::B::BlahDBlah -> blah_d_blah - # - def self.use_automatic_resource_name - automatic_name = convert_to_snake_case(name.split("::")[-1]) - resource_name automatic_name - end - # If the resource's action should run in separated compile/converge mode. # # @param flag [Boolean] value to set unified_mode to @@ -1321,12 +1299,6 @@ class Chef def self.inherited(child) super @@sorted_descendants = nil - # set resource_name automatically if it's not set - if child.name && !child.resource_name - if child.name =~ /^Chef::Resource::(\w+)$/ - child.resource_name(convert_to_snake_case($1)) - end - end end # If an unknown method is invoked, determine whether the enclosing Provider's @@ -1348,9 +1320,7 @@ class Chef # # Since resource_name calls provides the generally correct way of doing this is # to do `chef_version_for_provides` first, then `resource_name` and then - # any additional options `provides` lines. Calling `resource_name` is somewhat - # important to have the canonical_dsl removed or else that'll stick around - # and chef_version won't get applied to it. + # any additional options `provides` lines. # # Once we no longer care about supporting chef < 14.4 then we can deprecate # this API. @@ -1371,11 +1341,8 @@ class Chef def self.provides(name, **options, &block) name = name.to_sym - # `provides :resource_name, os: 'linux'`) needs to remove the old - # canonical DSL before adding the new one. - if @resource_name && name == @resource_name - remove_canonical_dsl - end + # deliberately do not go through the accessor here + @resource_name = name if resource_name.nil? if @chef_version_for_provides && !options.include?(:chef_version) options[:chef_version] = @chef_version_for_provides @@ -1585,7 +1552,7 @@ class Chef # <Chef::Resource>:: returns the proper Chef::Resource class # def self.resource_matching_short_name(short_name) - Chef::ResourceResolver.resolve(short_name, canonical: true) + Chef::ResourceResolver.resolve(short_name) end # @api private @@ -1599,15 +1566,6 @@ class Chef # can't/won't support. self.class.resource_for_node(name, node).new("name", run_context).provider_for_action(action).class end - - def self.remove_canonical_dsl - if @resource_name - remaining = Chef.resource_handler_map.delete_canonical(@resource_name, self) - unless remaining - Chef::DSL::Resources.remove_resource_dsl(@resource_name) - end - end - end end end diff --git a/lib/chef/resource/apt_package.rb b/lib/chef/resource/apt_package.rb index f362c0f21a..2aa4fef704 100644 --- a/lib/chef/resource/apt_package.rb +++ b/lib/chef/resource/apt_package.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ class Chef class AptPackage < Chef::Resource::Package unified_mode true - resource_name :apt_package provides :apt_package, target_mode: true provides :package, platform_family: "debian", target_mode: true diff --git a/lib/chef/resource/apt_preference.rb b/lib/chef/resource/apt_preference.rb index 2c8debcb10..cef5c73bc8 100644 --- a/lib/chef/resource/apt_preference.rb +++ b/lib/chef/resource/apt_preference.rb @@ -1,6 +1,6 @@ # # Author:: Tim Smith (<tsmith@chef.io>) -# Copyright:: 2016-2019, Chef Software Inc. +# Copyright:: 2016-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,6 @@ class Chef class AptPreference < Chef::Resource unified_mode true - resource_name :apt_preference provides(:apt_preference) { true } description "The apt_preference resource allows for the creation of APT preference files. Preference files are used to control which package versions and sources are prioritized during installation." diff --git a/lib/chef/resource/apt_repository.rb b/lib/chef/resource/apt_repository.rb index 902c026c57..cef8f7495e 100644 --- a/lib/chef/resource/apt_repository.rb +++ b/lib/chef/resource/apt_repository.rb @@ -26,7 +26,6 @@ class Chef class AptRepository < Chef::Resource unified_mode true - resource_name :apt_repository provides(:apt_repository) { true } description "Use the apt_repository resource to specify additional APT repositories. Adding a new repository will update the APT package cache immediately." diff --git a/lib/chef/resource/apt_update.rb b/lib/chef/resource/apt_update.rb index b0d0df2e15..f6916ac681 100644 --- a/lib/chef/resource/apt_update.rb +++ b/lib/chef/resource/apt_update.rb @@ -1,6 +1,6 @@ # # Author:: Thom May (<thom@chef.io>) -# Copyright:: Copyright (c) 2016-2019, Chef Software Inc. +# Copyright:: Copyright (c) 2016-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ class Chef class AptUpdate < Chef::Resource unified_mode true - resource_name :apt_update provides(:apt_update) { true } description "Use the apt_update resource to manage APT repository updates on Debian and Ubuntu platforms." diff --git a/lib/chef/resource/archive_file.rb b/lib/chef/resource/archive_file.rb index da59ccf0ba..006a9c5599 100644 --- a/lib/chef/resource/archive_file.rb +++ b/lib/chef/resource/archive_file.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2017-2019, Chef Software Inc. +# Copyright:: Copyright 2017-2020, Chef Software Inc. # Author:: Jamie Winsor (<jamie@vialstudios.com>) # Author:: Tim Smith (<tsmith@chef.io>) # @@ -25,7 +25,6 @@ class Chef class ArchiveFile < Chef::Resource unified_mode true - resource_name :archive_file provides :archive_file provides :libarchive_file # legacy cookbook name diff --git a/lib/chef/resource/bash.rb b/lib/chef/resource/bash.rb index a3502310e7..b06c1c1d36 100644 --- a/lib/chef/resource/bash.rb +++ b/lib/chef/resource/bash.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,6 +24,8 @@ class Chef class Bash < Chef::Resource::Script unified_mode true + provides :bash + description "Use the bash resource to execute scripts using the Bash interpreter. This resource may also use any of the actions and properties that are available to the execute resource. Commands that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the environment in which they are run. Use not_if and only_if to guard this resource for idempotence." def initialize(name, run_context = nil) diff --git a/lib/chef/resource/bff_package.rb b/lib/chef/resource/bff_package.rb index d6a59c0bd0..2ab0ce77be 100644 --- a/lib/chef/resource/bff_package.rb +++ b/lib/chef/resource/bff_package.rb @@ -1,6 +1,6 @@ # # Author:: Deepali Jagtap (<deepali.jagtap@clogeny.com>) -# Copyright:: Copyright 2013-2019, Chef Software Inc. +# Copyright:: Copyright 2013-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ class Chef class BffPackage < Chef::Resource::Package unified_mode true - resource_name :bff_package provides :bff_package description "Use the bff_package resource to manage packages for the AIX platform using the installp utility. When a package is installed from a local file, it must be added to the node using the remote_file or cookbook_file resources." diff --git a/lib/chef/resource/breakpoint.rb b/lib/chef/resource/breakpoint.rb index 409e14f04f..d55f35cda4 100644 --- a/lib/chef/resource/breakpoint.rb +++ b/lib/chef/resource/breakpoint.rb @@ -1,6 +1,6 @@ # # Author:: Daniel DeLeo (<dan@kallistec.com>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,7 +25,6 @@ class Chef unified_mode true provides :breakpoint, target_mode: true - resource_name :breakpoint description "Use the breakpoint resource to add breakpoints to recipes. Run the #{Chef::Dist::SHELL} in #{Chef::Dist::PRODUCT} mode, and then use those breakpoints to debug recipes. Breakpoints are ignored by the #{Chef::Dist::CLIENT} during an actual #{Chef::Dist::CLIENT} run. That said, breakpoints are typically used to debug recipes only when running them in a non-production environment, after which they are removed from those recipes before the parent cookbook is uploaded to the Chef server." introduced "12.0" diff --git a/lib/chef/resource/build_essential.rb b/lib/chef/resource/build_essential.rb index d3e98e9bb3..a01449792d 100644 --- a/lib/chef/resource/build_essential.rb +++ b/lib/chef/resource/build_essential.rb @@ -21,7 +21,6 @@ class Chef class BuildEssential < Chef::Resource unified_mode true - resource_name :build_essential provides(:build_essential) { true } description "Use the build_essential resource to install the packages required for compiling C software from source." diff --git a/lib/chef/resource/cab_package.rb b/lib/chef/resource/cab_package.rb index b5c2c5cbc9..16f8bf64c4 100644 --- a/lib/chef/resource/cab_package.rb +++ b/lib/chef/resource/cab_package.rb @@ -1,6 +1,6 @@ # # Author:: Vasundhara Jagdale (<vasundhara.jagdale@msystechnologies.com>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,7 +25,6 @@ class Chef include Chef::Mixin::Uris unified_mode true - resource_name :cab_package provides :cab_package description "Use the cab_package resource to install or remove Microsoft Windows cabinet (.cab) packages." diff --git a/lib/chef/resource/chef_gem.rb b/lib/chef/resource/chef_gem.rb index 01cecb2e65..af8d63bc60 100644 --- a/lib/chef/resource/chef_gem.rb +++ b/lib/chef/resource/chef_gem.rb @@ -36,7 +36,7 @@ class Chef # immediately after it is installed class ChefGem < Chef::Resource::Package::GemPackage unified_mode true - resource_name :chef_gem + provides :chef_gem property :gem_binary, default: "#{RbConfig::CONFIG["bindir"]}/gem", default_description: "Chef's built-in gem binary.", description: "The path of a gem binary to use for the installation. By default, the same version of Ruby that is used by the #{Chef::Dist::CLIENT} will be installed.", diff --git a/lib/chef/resource/chef_handler.rb b/lib/chef/resource/chef_handler.rb index b8272cddea..aa4eac7a37 100644 --- a/lib/chef/resource/chef_handler.rb +++ b/lib/chef/resource/chef_handler.rb @@ -1,6 +1,6 @@ # # Author:: Seth Chisamore <schisamo@chef.io> -# Copyright:: 2011-2019, Chef Software Inc.<legal@chef.io> +# Copyright:: 2011-2020, Chef Software Inc.<legal@chef.io> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,7 +23,6 @@ class Chef class ChefHandler < Chef::Resource unified_mode true - resource_name :chef_handler provides(:chef_handler) { true } description "Use the chef_handler resource to install or uninstall reporting/exception handlers." diff --git a/lib/chef/resource/chef_sleep.rb b/lib/chef/resource/chef_sleep.rb index 51778f5fa5..9e31b53d03 100644 --- a/lib/chef/resource/chef_sleep.rb +++ b/lib/chef/resource/chef_sleep.rb @@ -1,5 +1,5 @@ # -# Copyright:: 2019-2019, Chef Software Inc. +# Copyright:: 2019-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ require_relative "../dist" class Chef class Resource class ChefSleep < Chef::Resource - resource_name :chef_sleep provides :chef_sleep unified_mode true diff --git a/lib/chef/resource/chef_vault_secret.rb b/lib/chef/resource/chef_vault_secret.rb index 598b494afc..b1272df6f2 100644 --- a/lib/chef/resource/chef_vault_secret.rb +++ b/lib/chef/resource/chef_vault_secret.rb @@ -21,7 +21,6 @@ require "chef-vault" class Chef class Resource class ChefVaultSecret < Chef::Resource - resource_name :chef_vault_secret provides :chef_vault_secret introduced "16.0" diff --git a/lib/chef/resource/chocolatey_config.rb b/lib/chef/resource/chocolatey_config.rb index 3c49061f25..788479caca 100644 --- a/lib/chef/resource/chocolatey_config.rb +++ b/lib/chef/resource/chocolatey_config.rb @@ -1,5 +1,5 @@ # -# Copyright:: 2018-2019, Chef Software Inc. +# Copyright:: 2018-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,9 +17,10 @@ class Chef class Resource class ChocolateyConfig < Chef::Resource - resource_name :chocolatey_config unified_mode true + provides :chocolatey_config + description "Use the chocolatey_config resource to add or remove Chocolatey configuration keys." introduced "14.3" examples <<~DOC diff --git a/lib/chef/resource/chocolatey_feature.rb b/lib/chef/resource/chocolatey_feature.rb index 3789247f57..9a79d1cffe 100644 --- a/lib/chef/resource/chocolatey_feature.rb +++ b/lib/chef/resource/chocolatey_feature.rb @@ -1,5 +1,5 @@ # -# Copyright:: 2019-2019, Chef Software Inc. +# Copyright:: 2019-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ class Chef class Resource class ChocolateyFeature < Chef::Resource unified_mode true - resource_name :chocolatey_feature + provides :chocolatey_feature description "Use the chocolatey_feature resource to enable and disable Chocolatey features." introduced "15.1" diff --git a/lib/chef/resource/chocolatey_package.rb b/lib/chef/resource/chocolatey_package.rb index d80a79d65b..dd62aab8bb 100644 --- a/lib/chef/resource/chocolatey_package.rb +++ b/lib/chef/resource/chocolatey_package.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ class Chef class ChocolateyPackage < Chef::Resource::Package unified_mode true - resource_name :chocolatey_package provides :chocolatey_package description "Use the chocolatey_package resource to manage packages using Chocolatey on the Microsoft Windows platform." diff --git a/lib/chef/resource/chocolatey_source.rb b/lib/chef/resource/chocolatey_source.rb index b79443ae67..5c52ec5b64 100644 --- a/lib/chef/resource/chocolatey_source.rb +++ b/lib/chef/resource/chocolatey_source.rb @@ -1,5 +1,5 @@ # -# Copyright:: 2018-2019, Chef Software Inc. +# Copyright:: 2018-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ class Chef class Resource class ChocolateySource < Chef::Resource unified_mode true - resource_name :chocolatey_source + provides :chocolatey_source description "Use the chocolatey_source resource to add, remove, enable, or disable Chocolatey sources." introduced "14.3" diff --git a/lib/chef/resource/cookbook_file.rb b/lib/chef/resource/cookbook_file.rb index 338c387008..aa81e5a4fa 100644 --- a/lib/chef/resource/cookbook_file.rb +++ b/lib/chef/resource/cookbook_file.rb @@ -2,7 +2,7 @@ # Author:: Adam Jacob (<adam@chef.io>) # Author:: Seth Chisamore (<schisamo@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,7 +29,7 @@ class Chef include Chef::Mixin::Securable unified_mode true - resource_name :cookbook_file + provides :cookbook_file description "Use the cookbook_file resource to transfer files from a sub-directory of COOKBOOK_NAME/files/ to a specified path located on a host that is running the #{Chef::Dist::PRODUCT}. The file is selected according to file specificity, which allows different source files to be used based on the hostname, host platform (operating system, distro, or as appropriate), or platform version. Files that are located in the COOKBOOK_NAME/files/default sub-directory may be used on any platform.\n\nDuring a #{Chef::Dist::PRODUCT} run, the checksum for each local file is calculated and then compared against the checksum for the same file as it currently exists in the cookbook on the #{Chef::Dist::SERVER_PRODUCT}. A file is not transferred when the checksums match. Only files that require an update are transferred from the #{Chef::Dist::SERVER_PRODUCT} to a node." diff --git a/lib/chef/resource/cron.rb b/lib/chef/resource/cron.rb index 1c48fd42b5..ff28550001 100644 --- a/lib/chef/resource/cron.rb +++ b/lib/chef/resource/cron.rb @@ -24,7 +24,6 @@ class Chef class Resource class Cron < Chef::Resource unified_mode true - resource_name :cron provides :cron description "Use the cron resource to manage cron entries for time-based job scheduling. Properties for a schedule will default to * if not provided. The cron resource requires access to a crontab program, typically cron." diff --git a/lib/chef/resource/cron_access.rb b/lib/chef/resource/cron_access.rb index 1d5b2dc358..2000d76291 100644 --- a/lib/chef/resource/cron_access.rb +++ b/lib/chef/resource/cron_access.rb @@ -3,7 +3,7 @@ # Author:: Tim Smith <tsmith@chef.io> # # Copyright:: 2014-2018, Sander Botman -# Copyright:: 2018-2019, Chef Software Inc. +# Copyright:: 2018-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ class Chef class Resource class CronAccess < Chef::Resource unified_mode true - resource_name :cron_access + provides :cron_access provides(:cron_manage) # legacy name @todo in Chef 15 we should { true } this so it wins over the cookbook introduced "14.4" diff --git a/lib/chef/resource/cron_d.rb b/lib/chef/resource/cron_d.rb index 39c86c1192..befe951a35 100644 --- a/lib/chef/resource/cron_d.rb +++ b/lib/chef/resource/cron_d.rb @@ -1,5 +1,5 @@ # -# Copyright:: 2008-2019, Chef Software Inc. +# Copyright:: 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ class Chef class Resource class CronD < Chef::Resource unified_mode true - resource_name :cron_d + provides :cron_d introduced "14.4" description "Use the cron_d resource to manage cron definitions in /etc/cron.d. This is similar to the 'cron' resource, but it does not use the monolithic /etc/crontab file." diff --git a/lib/chef/resource/csh.rb b/lib/chef/resource/csh.rb index b04f7f9cee..4e4d7d9bda 100644 --- a/lib/chef/resource/csh.rb +++ b/lib/chef/resource/csh.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,6 +24,8 @@ class Chef class Csh < Chef::Resource::Script unified_mode true + provides :csh + description "Use the csh resource to execute scripts using the csh interpreter."\ " This resource may also use any of the actions and properties that are"\ " available to the execute resource. Commands that are executed with this"\ diff --git a/lib/chef/resource/directory.rb b/lib/chef/resource/directory.rb index f072584121..c8356f64ac 100644 --- a/lib/chef/resource/directory.rb +++ b/lib/chef/resource/directory.rb @@ -2,7 +2,7 @@ # Author:: Adam Jacob (<adam@chef.io>) # Author:: Seth Chisamore (<schisamo@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +26,7 @@ class Chef class Directory < Chef::Resource unified_mode true - resource_name :directory + provides :directory description "Use the directory resource to manage a directory, which is a hierarchy"\ " of folders that comprises all of the information stored on a computer."\ diff --git a/lib/chef/resource/dmg_package.rb b/lib/chef/resource/dmg_package.rb index 07ab920411..63895a1b9b 100644 --- a/lib/chef/resource/dmg_package.rb +++ b/lib/chef/resource/dmg_package.rb @@ -1,6 +1,6 @@ # # Author:: Joshua Timberman (<jtimberman@chef.io>) -# Copyright:: 2011-2019, Chef Software Inc. +# Copyright:: 2011-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ class Chef class Resource class DmgPackage < Chef::Resource unified_mode true - resource_name :dmg_package + provides(:dmg_package) { true } description "Use the dmg_package resource to install a package from a .dmg file. The resource will retrieve the dmg file from a remote URL, mount it using OS X's hdidutil, copy the application (.app directory) to the specified destination (/Applications), and detach the image using hdiutil. The dmg file will be stored in the Chef::Config[:file_cache_path]." diff --git a/lib/chef/resource/dnf_package.rb b/lib/chef/resource/dnf_package.rb index 6d0810ab2a..987ca8b89c 100644 --- a/lib/chef/resource/dnf_package.rb +++ b/lib/chef/resource/dnf_package.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2016-2019, Chef Software Inc. +# Copyright:: Copyright 2016-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,7 +27,7 @@ class Chef extend Chef::Mixin::ShellOut unified_mode true - resource_name :dnf_package + provides :dnf_package # all rhel variants >= 8 will use DNF provides :package, platform_family: "rhel", platform_version: ">= 8" @@ -40,8 +40,6 @@ class Chef which("dnf") end - provides :dnf_package - 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" diff --git a/lib/chef/resource/dpkg_package.rb b/lib/chef/resource/dpkg_package.rb index 7ce4da6b85..87739aaf48 100644 --- a/lib/chef/resource/dpkg_package.rb +++ b/lib/chef/resource/dpkg_package.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ class Chef class DpkgPackage < Chef::Resource::Package unified_mode true - resource_name :dpkg_package provides :dpkg_package description "Use the dpkg_package resource to manage packages for the dpkg platform. When a package is installed from a local file, it must be added to the node using the remote_file or cookbook_file resources." diff --git a/lib/chef/resource/dsc_resource.rb b/lib/chef/resource/dsc_resource.rb index 796009d896..686f09a157 100644 --- a/lib/chef/resource/dsc_resource.rb +++ b/lib/chef/resource/dsc_resource.rb @@ -23,7 +23,6 @@ class Chef class DscResource < Chef::Resource unified_mode true - resource_name :dsc_resource provides :dsc_resource description "The dsc_resource resource allows any DSC resource to be used in a recipe, as well as any custom resources that have been added to your Windows PowerShell environment. Microsoft frequently adds new resources to the DSC resource collection." diff --git a/lib/chef/resource/dsc_script.rb b/lib/chef/resource/dsc_script.rb index 34662ff3b9..9229c3c541 100644 --- a/lib/chef/resource/dsc_script.rb +++ b/lib/chef/resource/dsc_script.rb @@ -1,6 +1,6 @@ # # Author:: Adam Edwards (<adamed@chef.io>) -# Copyright:: Copyright 2014-2019, Chef Software Inc. +# Copyright:: Copyright 2014-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,7 +27,6 @@ class Chef include Chef::DSL::Powershell unified_mode true - resource_name :dsc_script provides :dsc_script description "Many DSC resources are comparable to built-in #{Chef::Dist::PRODUCT} resources. For example, both DSC and #{Chef::Dist::PRODUCT} have file, package, and service resources. The dsc_script resource is most useful for those DSC resources that do not have a direct comparison to a resource in #{Chef::Dist::PRODUCT}, such as the Archive resource, a custom DSC resource, an existing DSC script that performs an important task, and so on. Use the dsc_script resource to embed the code that defines a DSC configuration directly within a #{Chef::Dist::PRODUCT} recipe." diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb index 0f61aaf4c8..7073ddc604 100644 --- a/lib/chef/resource/execute.rb +++ b/lib/chef/resource/execute.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,7 +25,6 @@ class Chef class Execute < Chef::Resource unified_mode true - resource_name :execute provides :execute, target_mode: true description "Use the execute resource to execute a single command. Commands that"\ diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index a8e3bd3a88..73d6f2de27 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Seth Chisamore (<schisamo@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,6 +30,8 @@ class Chef include Chef::Mixin::Securable unified_mode true + provides :file + description "Use the file resource to manage files directly on a node." if ChefUtils.windows? diff --git a/lib/chef/resource/freebsd_package.rb b/lib/chef/resource/freebsd_package.rb index 224896c8c0..ae7c9ebb21 100644 --- a/lib/chef/resource/freebsd_package.rb +++ b/lib/chef/resource/freebsd_package.rb @@ -26,7 +26,7 @@ class Chef class Resource class FreebsdPackage < Chef::Resource::Package unified_mode true - resource_name :freebsd_package + provides :freebsd_package provides :package, platform: "freebsd" description "Use the freebsd_package resource to manage packages for the FreeBSD platform." diff --git a/lib/chef/resource/gem_package.rb b/lib/chef/resource/gem_package.rb index 8497923a50..a8e16841dc 100644 --- a/lib/chef/resource/gem_package.rb +++ b/lib/chef/resource/gem_package.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ class Chef class Resource class GemPackage < Chef::Resource::Package unified_mode true - resource_name :gem_package + provides :gem_package description "Use the gem_package resource to manage gem packages that are only included in recipes. When a package is installed from a local file, it must be added to the node using the remote_file or cookbook_file resources." diff --git a/lib/chef/resource/git.rb b/lib/chef/resource/git.rb index a59febbacc..b6d914b8f5 100644 --- a/lib/chef/resource/git.rb +++ b/lib/chef/resource/git.rb @@ -1,6 +1,6 @@ # # Author:: Daniel DeLeo (<dan@kallistec.com>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,6 +23,8 @@ class Chef class Git < Chef::Resource::Scm unified_mode true + provides :git + description "Use the git resource to manage source control resources that exist in a git repository. git version 1.6.5 (or higher) is required to use all of the functionality in the git resource." property :additional_remotes, Hash, diff --git a/lib/chef/resource/group.rb b/lib/chef/resource/group.rb index b7f44cd239..d2948b36c7 100644 --- a/lib/chef/resource/group.rb +++ b/lib/chef/resource/group.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,6 +24,8 @@ class Chef description "Use the group resource to manage a local group." + provides :group + allowed_actions :create, :remove, :modify, :manage default_action :create diff --git a/lib/chef/resource/homebrew_cask.rb b/lib/chef/resource/homebrew_cask.rb index c8d6fa6bda..347e1ca435 100644 --- a/lib/chef/resource/homebrew_cask.rb +++ b/lib/chef/resource/homebrew_cask.rb @@ -25,7 +25,6 @@ class Chef class HomebrewCask < Chef::Resource unified_mode true - resource_name :homebrew_cask provides(:homebrew_cask) { true } description "Use the homebrew_cask resource to install binaries distributed via the Homebrew package manager." diff --git a/lib/chef/resource/homebrew_package.rb b/lib/chef/resource/homebrew_package.rb index 2261979c09..3a091241db 100644 --- a/lib/chef/resource/homebrew_package.rb +++ b/lib/chef/resource/homebrew_package.rb @@ -26,7 +26,7 @@ class Chef class HomebrewPackage < Chef::Resource::Package unified_mode true - resource_name :homebrew_package + provides :homebrew_package provides :package, os: "darwin" description "Use the homebrew_package resource to manage packages for the macOS platform." diff --git a/lib/chef/resource/homebrew_tap.rb b/lib/chef/resource/homebrew_tap.rb index 15374f5a15..3990d90179 100644 --- a/lib/chef/resource/homebrew_tap.rb +++ b/lib/chef/resource/homebrew_tap.rb @@ -25,7 +25,6 @@ class Chef class HomebrewTap < Chef::Resource unified_mode true - resource_name :homebrew_tap provides(:homebrew_tap) { true } description "Use the homebrew_tap resource to add additional formula repositories to the Homebrew package manager." diff --git a/lib/chef/resource/hostname.rb b/lib/chef/resource/hostname.rb index e3897b6bef..e2d3465d96 100644 --- a/lib/chef/resource/hostname.rb +++ b/lib/chef/resource/hostname.rb @@ -21,7 +21,6 @@ class Chef class Hostname < Chef::Resource unified_mode true - resource_name :hostname provides :hostname description "Use the hostname resource to set the system's hostname, configure hostname and hosts config file, and re-run the Ohai hostname plugin so the hostname will be available in subsequent cookbooks." diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb index bf03d6b917..8042db4c9e 100644 --- a/lib/chef/resource/http_request.rb +++ b/lib/chef/resource/http_request.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,6 @@ class Chef class HttpRequest < Chef::Resource unified_mode true - resource_name :http_request provides :http_request 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." diff --git a/lib/chef/resource/ifconfig.rb b/lib/chef/resource/ifconfig.rb index 6b64ed0fa1..72e918b1e9 100644 --- a/lib/chef/resource/ifconfig.rb +++ b/lib/chef/resource/ifconfig.rb @@ -28,7 +28,7 @@ class Chef class Ifconfig < Chef::Resource unified_mode true - resource_name :ifconfig + provides :ifconfig description "Use the ifconfig resource to manage interfaces on Unix and Linux systems." diff --git a/lib/chef/resource/ips_package.rb b/lib/chef/resource/ips_package.rb index 341e459c09..0504a430ef 100644 --- a/lib/chef/resource/ips_package.rb +++ b/lib/chef/resource/ips_package.rb @@ -24,9 +24,8 @@ class Chef class IpsPackage < ::Chef::Resource::Package unified_mode true - resource_name :ips_package - provides :package, os: "solaris2" provides :ips_package + provides :package, os: "solaris2" description "Use the ips_package resource to manage packages (using Image Packaging System (IPS)) on the Solaris 11 platform." diff --git a/lib/chef/resource/kernel_module.rb b/lib/chef/resource/kernel_module.rb index 9b732c0218..be8b007035 100644 --- a/lib/chef/resource/kernel_module.rb +++ b/lib/chef/resource/kernel_module.rb @@ -13,7 +13,7 @@ class Chef class KernelModule < Chef::Resource unified_mode true - resource_name :kernel_module + provides :kernel_module description "Use the kernel_module resource to manage kernel modules on Linux systems. This resource can load, unload, blacklist, disable, install, and uninstall modules." introduced "14.3" diff --git a/lib/chef/resource/ksh.rb b/lib/chef/resource/ksh.rb index 0ebcfaaba6..c80a373b17 100644 --- a/lib/chef/resource/ksh.rb +++ b/lib/chef/resource/ksh.rb @@ -1,6 +1,6 @@ # # Author:: Nolan Davidson (<nolan.davidson@gmail.com>) -# Copyright:: Copyright 2015-2016, Chef Software, Inc. +# Copyright:: Copyright 2015-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,6 +23,8 @@ class Chef class Ksh < Chef::Resource::Script unified_mode true + provides :ksh + description "Use the ksh resource to execute scripts using the Korn shell (ksh)"\ " interpreter. This resource may also use any of the actions and properties"\ " that are available to the execute resource. Commands that are executed"\ diff --git a/lib/chef/resource/launchd.rb b/lib/chef/resource/launchd.rb index 39d95bbf69..87addde5d7 100644 --- a/lib/chef/resource/launchd.rb +++ b/lib/chef/resource/launchd.rb @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class Launchd < Chef::Resource - resource_name :launchd provides :launchd description "Use the launchd resource to manage system-wide services (daemons) and per-user services (agents) on the macOS platform." diff --git a/lib/chef/resource/link.rb b/lib/chef/resource/link.rb index df4ab81dd1..134f02fde9 100644 --- a/lib/chef/resource/link.rb +++ b/lib/chef/resource/link.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +26,6 @@ class Chef include Chef::Mixin::Securable unified_mode true - resource_name :link provides :link description "Use the link resource to create symbolic or hard links.\n\n"\ diff --git a/lib/chef/resource/locale.rb b/lib/chef/resource/locale.rb index ea62a0d6b2..4e8cfaf96a 100644 --- a/lib/chef/resource/locale.rb +++ b/lib/chef/resource/locale.rb @@ -22,7 +22,7 @@ class Chef class Resource class Locale < Chef::Resource unified_mode true - resource_name :locale + provides :locale description "Use the locale resource to set the system's locale." introduced "14.5" diff --git a/lib/chef/resource/log.rb b/lib/chef/resource/log.rb index 969b448b17..32c9b8a931 100644 --- a/lib/chef/resource/log.rb +++ b/lib/chef/resource/log.rb @@ -1,7 +1,7 @@ # # Author:: Cary Penniman (<cary@rightscale.com>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,7 +31,6 @@ class Chef class Log < Chef::Resource unified_mode true - resource_name :log provides :log, target_mode: true description "Use the log resource to create log entries. The log resource behaves"\ diff --git a/lib/chef/resource/lwrp_base.rb b/lib/chef/resource/lwrp_base.rb index 0e19e59d6f..152482434f 100644 --- a/lib/chef/resource/lwrp_base.rb +++ b/lib/chef/resource/lwrp_base.rb @@ -2,7 +2,7 @@ # Author:: Adam Jacob (<adam@chef.io>) # Author:: Christopher Walters (<cw@chef.io>) # Author:: Daniel DeLeo (<dan@chef.io>) -# Copyright:: Copyright 2008-2018, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -51,6 +51,7 @@ class Chef resource_class = Class.new(self) resource_class.run_context = run_context + resource_class.provides resource_name.to_sym resource_class.class_from_file(filename) # Make a useful string for the class (rather than <Class:312894723894>) @@ -65,10 +66,6 @@ class Chef LWRPBase.loaded_lwrps[filename] = true - # wire up the default resource name after the class is parsed only if we haven't declared one. - # (this ordering is important for MapCollision deprecation warnings) - resource_class.resource_name resource_name.to_sym if resource_class.resource_name.nil? - resource_class end diff --git a/lib/chef/resource/macos_userdefaults.rb b/lib/chef/resource/macos_userdefaults.rb index 4197f3a0a8..659dd1dde8 100644 --- a/lib/chef/resource/macos_userdefaults.rb +++ b/lib/chef/resource/macos_userdefaults.rb @@ -23,9 +23,8 @@ class Chef unified_mode true # align with apple's marketing department - resource_name :macos_userdefaults - provides(:mac_os_x_userdefaults) { true } provides(:macos_userdefaults) { true } + provides(:mac_os_x_userdefaults) { true } description "Use the macos_userdefaults resource to manage the macOS user defaults system. The properties of this resource are passed to the defaults command, and the parameters follow the convention of that command. See the defaults(1) man page for details on how the tool works." introduced "14.0" diff --git a/lib/chef/resource/macosx_service.rb b/lib/chef/resource/macosx_service.rb index fc3b269c24..c3a4588b5b 100644 --- a/lib/chef/resource/macosx_service.rb +++ b/lib/chef/resource/macosx_service.rb @@ -23,7 +23,6 @@ class Chef class MacosxService < Chef::Resource::Service unified_mode true - resource_name :macosx_service provides :macosx_service provides :service, os: "darwin" diff --git a/lib/chef/resource/macports_package.rb b/lib/chef/resource/macports_package.rb index a1eff28051..256048928a 100644 --- a/lib/chef/resource/macports_package.rb +++ b/lib/chef/resource/macports_package.rb @@ -1,6 +1,6 @@ # # Author:: David Balatero (<dbalatero@gmail.com>) -# Copyright:: Copyright 2009-2016, Chef Software Inc. +# Copyright:: Copyright 2009-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ require_relative "package" class Chef class Resource class MacportsPackage < Chef::Resource::Package - resource_name :macports_package + provides :macports_package description "Use the macports_package resource to manage packages for the macOS platform." end diff --git a/lib/chef/resource/mdadm.rb b/lib/chef/resource/mdadm.rb index e226644f5e..6ec547d133 100644 --- a/lib/chef/resource/mdadm.rb +++ b/lib/chef/resource/mdadm.rb @@ -24,7 +24,7 @@ class Chef class Mdadm < Chef::Resource unified_mode true - resource_name :mdadm + provides :mdadm description "Use the mdadm resource to manage RAID devices in a Linux environment using the mdadm utility. The mdadm resource"\ " will create and assemble an array, but it will not create the config file that is used to persist the array upon"\ diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb index a9e6b3374b..15fabf2982 100644 --- a/lib/chef/resource/mount.rb +++ b/lib/chef/resource/mount.rb @@ -1,7 +1,7 @@ # # Author:: Joshua Timberman (<joshua@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2009-2018, Chef Software Inc. +# Copyright:: Copyright 2009-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,6 +24,8 @@ class Chef class Mount < Chef::Resource description "Use the mount resource to manage a mounted file system." + provides :mount + default_action :mount allowed_actions :mount, :umount, :unmount, :remount, :enable, :disable diff --git a/lib/chef/resource/msu_package.rb b/lib/chef/resource/msu_package.rb index a69f72001f..7ccd28ba95 100644 --- a/lib/chef/resource/msu_package.rb +++ b/lib/chef/resource/msu_package.rb @@ -1,6 +1,6 @@ # # Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,6 @@ class Chef class MsuPackage < Chef::Resource::Package include Chef::Mixin::Uris - resource_name :msu_package provides :msu_package description "Use the msu_package resource to install Microsoft Update(MSU) packages on Microsoft Windows machines." diff --git a/lib/chef/resource/notify_group.rb b/lib/chef/resource/notify_group.rb index b452ed569a..3930ece967 100644 --- a/lib/chef/resource/notify_group.rb +++ b/lib/chef/resource/notify_group.rb @@ -20,7 +20,6 @@ require_relative "../dist" class Chef class Resource class NotifyGroup < Chef::Resource - resource_name :notify_group provides :notify_group unified_mode true diff --git a/lib/chef/resource/ohai.rb b/lib/chef/resource/ohai.rb index b0559c84d4..d48743b9ac 100644 --- a/lib/chef/resource/ohai.rb +++ b/lib/chef/resource/ohai.rb @@ -25,7 +25,6 @@ class Chef class Ohai < Chef::Resource unified_mode true - resource_name :ohai provides :ohai description "Use the ohai resource to reload the Ohai configuration on a node. This allows recipes that change system attributes (like a recipe that adds a user) to refer to those attributes later on during the #{Chef::Dist::CLIENT} run." diff --git a/lib/chef/resource/ohai_hint.rb b/lib/chef/resource/ohai_hint.rb index bf3c344cb0..f96d79da3e 100644 --- a/lib/chef/resource/ohai_hint.rb +++ b/lib/chef/resource/ohai_hint.rb @@ -22,7 +22,6 @@ class Chef class OhaiHint < Chef::Resource unified_mode true - resource_name :ohai_hint provides(:ohai_hint) { true } description "Use the ohai_hint resource to aid in configuration detection by passing hint data to Ohai." diff --git a/lib/chef/resource/openbsd_package.rb b/lib/chef/resource/openbsd_package.rb index 7e0d61e43f..05d77b44dc 100644 --- a/lib/chef/resource/openbsd_package.rb +++ b/lib/chef/resource/openbsd_package.rb @@ -2,7 +2,7 @@ # Authors:: AJ Christensen (<aj@chef.io>) # Richard Manyanza (<liseki@nyikacraftsmen.com>) # Scott Bonds (<scott@ggr.com>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # Copyright:: Copyright 2014-2016, Richard Manyanza, Scott Bonds # License:: Apache License, Version 2.0 # @@ -25,7 +25,7 @@ require_relative "../provider/package/openbsd" class Chef class Resource class OpenbsdPackage < Chef::Resource::Package - resource_name :openbsd_package + provides :openbsd_package provides :package, os: "openbsd" description "Use the openbsd_package resource to manage packages for the OpenBSD platform." diff --git a/lib/chef/resource/openssl_dhparam.rb b/lib/chef/resource/openssl_dhparam.rb index 9d8d82c4ba..b4a8581595 100644 --- a/lib/chef/resource/openssl_dhparam.rb +++ b/lib/chef/resource/openssl_dhparam.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2009-2018, Chef Software Inc. +# Copyright:: Copyright 2009-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ class Chef require_relative "../mixin/openssl_helper" include Chef::Mixin::OpenSSLHelper - resource_name :openssl_dhparam provides(:openssl_dhparam) { true } description "Use the openssl_dhparam resource to generate dhparam.pem files. If a valid dhparam.pem file is found at the specified location, no new file will be created. If a file is found at the specified location but it is not a valid dhparam file, it will be overwritten." diff --git a/lib/chef/resource/openssl_ec_private_key.rb b/lib/chef/resource/openssl_ec_private_key.rb index 7d6d95f51b..de6953f336 100644 --- a/lib/chef/resource/openssl_ec_private_key.rb +++ b/lib/chef/resource/openssl_ec_private_key.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2018, Chef Software Inc. +# Copyright:: Copyright 2018-2020, Chef Software Inc. # Author:: Julien Huon # License:: Apache License, Version 2.0 # @@ -24,7 +24,7 @@ class Chef require_relative "../mixin/openssl_helper" include Chef::Mixin::OpenSSLHelper - resource_name :openssl_ec_private_key + provides :openssl_ec_private_key description "Use the openssl_ec_private_key resource to generate an elliptic curve (EC) private key file. If a valid EC key file can be opened at the specified location, no new file will be created. If the EC key file cannot be opened, either because it does not exist or because the password to the EC key file does not match the password in the recipe, then it will be overwritten." introduced "14.4" diff --git a/lib/chef/resource/openssl_ec_public_key.rb b/lib/chef/resource/openssl_ec_public_key.rb index d0208315bd..080e6976ce 100644 --- a/lib/chef/resource/openssl_ec_public_key.rb +++ b/lib/chef/resource/openssl_ec_public_key.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2018, Chef Software Inc. +# Copyright:: Copyright 2018-2020, Chef Software Inc. # Author:: Julien Huon # License:: Apache License, Version 2.0 # @@ -24,7 +24,7 @@ class Chef require_relative "../mixin/openssl_helper" include Chef::Mixin::OpenSSLHelper - resource_name :openssl_ec_public_key + provides :openssl_ec_public_key description "Use the openssl_ec_public_key resource to generate elliptic curve (EC) public key files from a given EC private key." introduced "14.4" diff --git a/lib/chef/resource/openssl_rsa_private_key.rb b/lib/chef/resource/openssl_rsa_private_key.rb index 7da6700764..805db33a39 100644 --- a/lib/chef/resource/openssl_rsa_private_key.rb +++ b/lib/chef/resource/openssl_rsa_private_key.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2009-2018, Chef Software Inc. +# Copyright:: Copyright 2009-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ class Chef require_relative "../mixin/openssl_helper" include Chef::Mixin::OpenSSLHelper - resource_name :openssl_rsa_private_key provides(:openssl_rsa_private_key) { true } provides(:openssl_rsa_key) { true } # legacy cookbook resource name diff --git a/lib/chef/resource/openssl_rsa_public_key.rb b/lib/chef/resource/openssl_rsa_public_key.rb index f62c382c27..145703aee2 100644 --- a/lib/chef/resource/openssl_rsa_public_key.rb +++ b/lib/chef/resource/openssl_rsa_public_key.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2009-2018, Chef Software Inc. +# Copyright:: Copyright 2009-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ class Chef require_relative "../mixin/openssl_helper" include Chef::Mixin::OpenSSLHelper - resource_name :openssl_rsa_public_key provides(:openssl_rsa_public_key) { true } examples <<~DOC diff --git a/lib/chef/resource/openssl_x509_certificate.rb b/lib/chef/resource/openssl_x509_certificate.rb index 1c0a2ee65d..4f89986ad3 100644 --- a/lib/chef/resource/openssl_x509_certificate.rb +++ b/lib/chef/resource/openssl_x509_certificate.rb @@ -1,7 +1,7 @@ # # License:: Apache License, Version 2.0 # Author:: Julien Huon -# Copyright:: Copyright 2018, Chef Software Inc. +# Copyright:: Copyright 2018-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ class Chef require_relative "../mixin/openssl_helper" include Chef::Mixin::OpenSSLHelper - resource_name :openssl_x509_certificate + provides :openssl_x509_certificate provides(:openssl_x509) { true } # legacy cookbook name. description "Use the openssl_x509_certificate resource to generate signed or self-signed, PEM-formatted x509 certificates. If no existing key is specified, the resource will automatically generate a passwordless key with the certificate. If a CA private key and certificate are provided, the certificate will be signed with them. Note: This resource was renamed from openssl_x509 to openssl_x509_certificate. The legacy name will continue to function, but cookbook code should be updated for the new resource name." diff --git a/lib/chef/resource/openssl_x509_crl.rb b/lib/chef/resource/openssl_x509_crl.rb index 73c4c79a4e..3fdbe0e180 100644 --- a/lib/chef/resource/openssl_x509_crl.rb +++ b/lib/chef/resource/openssl_x509_crl.rb @@ -1,7 +1,7 @@ # # License:: Apache License, Version 2.0 # Author:: Julien Huon -# Copyright:: Copyright 2018, Chef Software Inc. +# Copyright:: Copyright 2018-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ class Chef require_relative "../mixin/openssl_helper" include Chef::Mixin::OpenSSLHelper - resource_name :openssl_x509_crl + provides :openssl_x509_crl description "Use the openssl_x509_crl resource to generate PEM-formatted x509 certificate revocation list (CRL) files." introduced "14.4" diff --git a/lib/chef/resource/openssl_x509_request.rb b/lib/chef/resource/openssl_x509_request.rb index cac03f7d98..5c2193bd43 100644 --- a/lib/chef/resource/openssl_x509_request.rb +++ b/lib/chef/resource/openssl_x509_request.rb @@ -1,7 +1,7 @@ # # License:: Apache License, Version 2.0 # Author:: Julien Huon -# Copyright:: Copyright 2018, Chef Software Inc. +# Copyright:: Copyright 2018-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ class Chef require_relative "../mixin/openssl_helper" include Chef::Mixin::OpenSSLHelper - resource_name :openssl_x509_request + provides :openssl_x509_request description "Use the openssl_x509_request resource to generate PEM-formatted x509 certificates requests. If no existing key is specified, the resource will automatically generate a passwordless key with the certificate." introduced "14.4" diff --git a/lib/chef/resource/osx_profile.rb b/lib/chef/resource/osx_profile.rb index eb5ba07f83..2a350124f7 100644 --- a/lib/chef/resource/osx_profile.rb +++ b/lib/chef/resource/osx_profile.rb @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class OsxProfile < Chef::Resource - resource_name :osx_profile provides :osx_profile provides :osx_config_profile diff --git a/lib/chef/resource/package.rb b/lib/chef/resource/package.rb index 6f198c2b1f..9a7134aad9 100644 --- a/lib/chef/resource/package.rb +++ b/lib/chef/resource/package.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2018, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,7 @@ require_relative "../resource" class Chef class Resource class Package < Chef::Resource - resource_name :package + provides :package description "Use the package resource to manage packages. When the package is"\ " installed from a local file (such as with RubyGems, dpkg, or RPM"\ diff --git a/lib/chef/resource/pacman_package.rb b/lib/chef/resource/pacman_package.rb index 79627cd3ae..9600201905 100644 --- a/lib/chef/resource/pacman_package.rb +++ b/lib/chef/resource/pacman_package.rb @@ -23,7 +23,6 @@ class Chef class PacmanPackage < Chef::Resource::Package unified_mode true - resource_name :pacman_package provides :pacman_package description "Use the pacman_package resource to manage packages (using pacman) on the Arch Linux platform." diff --git a/lib/chef/resource/paludis_package.rb b/lib/chef/resource/paludis_package.rb index ee439b7e4e..8ee3c4d3db 100644 --- a/lib/chef/resource/paludis_package.rb +++ b/lib/chef/resource/paludis_package.rb @@ -24,7 +24,6 @@ class Chef class PaludisPackage < Chef::Resource::Package unified_mode true - resource_name :paludis_package provides :paludis_package description "Use the paludis_package resource to manage packages for the Paludis platform." diff --git a/lib/chef/resource/perl.rb b/lib/chef/resource/perl.rb index 42f17a602a..b13d34affa 100644 --- a/lib/chef/resource/perl.rb +++ b/lib/chef/resource/perl.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,6 +24,8 @@ class Chef class Perl < Chef::Resource::Script unified_mode true + provides :perl + def initialize(name, run_context = nil) super @interpreter = "perl" diff --git a/lib/chef/resource/portage_package.rb b/lib/chef/resource/portage_package.rb index ab79e9c789..fa8e83497f 100644 --- a/lib/chef/resource/portage_package.rb +++ b/lib/chef/resource/portage_package.rb @@ -23,7 +23,6 @@ class Chef class PortagePackage < Chef::Resource::Package unified_mode true - resource_name :portage_package provides :portage_package description "Use the portage_package resource to manage packages for the Gentoo platform." diff --git a/lib/chef/resource/powershell_package.rb b/lib/chef/resource/powershell_package.rb index ea8355d6f8..7fb926db7c 100644 --- a/lib/chef/resource/powershell_package.rb +++ b/lib/chef/resource/powershell_package.rb @@ -1,5 +1,5 @@ # Author:: Dheeraj Dubey(dheeraj.dubey@msystechnologies.com) -# Copyright:: Copyright 2008-2016, Chef Software, Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ class Chef class PowershellPackage < Chef::Resource::Package include Chef::Mixin::Uris - resource_name :powershell_package provides :powershell_package 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." diff --git a/lib/chef/resource/powershell_package_source.rb b/lib/chef/resource/powershell_package_source.rb index 5b3a6be049..2710974a73 100644 --- a/lib/chef/resource/powershell_package_source.rb +++ b/lib/chef/resource/powershell_package_source.rb @@ -21,7 +21,7 @@ require_relative "../json_compat" class Chef class Resource class PowershellPackageSource < Chef::Resource - resource_name "powershell_package_source" + provides :powershell_package_source description "Use the powershell_package_source resource to register a PowerShell package repository." introduced "14.3" diff --git a/lib/chef/resource/python.rb b/lib/chef/resource/python.rb index 3cee3d3432..37300a7757 100644 --- a/lib/chef/resource/python.rb +++ b/lib/chef/resource/python.rb @@ -1,5 +1,5 @@ # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,6 +23,8 @@ class Chef class Python < Chef::Resource::Script unified_mode true + provides :python + def initialize(name, run_context = nil) super @interpreter = "python" diff --git a/lib/chef/resource/reboot.rb b/lib/chef/resource/reboot.rb index 7af55dd242..337b627914 100644 --- a/lib/chef/resource/reboot.rb +++ b/lib/chef/resource/reboot.rb @@ -24,7 +24,6 @@ class Chef class Reboot < Chef::Resource unified_mode true - resource_name :reboot provides :reboot description "Use the reboot resource to reboot a node, a necessary step with some"\ diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb index 688fe016cc..1ecd631096 100644 --- a/lib/chef/resource/registry_key.rb +++ b/lib/chef/resource/registry_key.rb @@ -1,7 +1,7 @@ # Author:: Prajakta Purohit (<prajakta@chef.io>) # Author:: Lamont Granquist (<lamont@chef.io>) # -# Copyright:: Copyright 2011-2016, Chef Software Inc. +# Copyright:: Copyright 2011-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ class Chef class RegistryKey < Chef::Resource unified_mode true - resource_name :registry_key provides(:registry_key) { true } description "Use the registry_key resource to create and delete registry keys in Microsoft Windows." diff --git a/lib/chef/resource/remote_directory.rb b/lib/chef/resource/remote_directory.rb index d05c719ac1..32b3b3dfb2 100644 --- a/lib/chef/resource/remote_directory.rb +++ b/lib/chef/resource/remote_directory.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,6 +27,8 @@ class Chef include Chef::Mixin::Securable unified_mode true + provides :remote_directory + 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 diff --git a/lib/chef/resource/remote_file.rb b/lib/chef/resource/remote_file.rb index 54c7786cfd..2dbda21106 100644 --- a/lib/chef/resource/remote_file.rb +++ b/lib/chef/resource/remote_file.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Seth Chisamore (<schisamo@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,6 +29,8 @@ class Chef include Chef::Mixin::Securable unified_mode true + provides :remote_file + description "Use the remote_file resource to transfer a file from a remote location"\ " using file specificity. This resource is similar to the file resource." diff --git a/lib/chef/resource/rhsm_errata.rb b/lib/chef/resource/rhsm_errata.rb index aa08847d10..2dd4e1ba77 100644 --- a/lib/chef/resource/rhsm_errata.rb +++ b/lib/chef/resource/rhsm_errata.rb @@ -1,5 +1,5 @@ # -# Copyright:: 2015-2020 Chef Software, Inc. +# Copyright:: 2015-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,6 @@ class Chef class Resource class RhsmErrata < Chef::Resource unified_mode true - resource_name :rhsm_errata provides(:rhsm_errata) { true } description "Use the rhsm_errata resource to install packages associated with a given Red"\ diff --git a/lib/chef/resource/rhsm_errata_level.rb b/lib/chef/resource/rhsm_errata_level.rb index 4ab2d8662d..d49d9cd1ee 100644 --- a/lib/chef/resource/rhsm_errata_level.rb +++ b/lib/chef/resource/rhsm_errata_level.rb @@ -1,5 +1,5 @@ # -# Copyright:: 2015-2020 Chef Software, Inc. +# Copyright:: 2015-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,6 @@ class Chef class Resource class RhsmErrataLevel < Chef::Resource unified_mode true - resource_name :rhsm_errata_level provides(:rhsm_errata_level) { true } description "Use the rhsm_errata_level resource to install all packages of a specified errata level from the Red Hat Subscription Manager. For example, you can ensure that all packages associated with errata marked at a 'Critical' security level are installed." diff --git a/lib/chef/resource/rhsm_register.rb b/lib/chef/resource/rhsm_register.rb index aa3f47780e..2f522303ad 100644 --- a/lib/chef/resource/rhsm_register.rb +++ b/lib/chef/resource/rhsm_register.rb @@ -1,5 +1,5 @@ # -# Copyright:: 2015-2020 Chef Software, Inc. +# Copyright:: 2015-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,6 @@ class Chef class Resource class RhsmRegister < Chef::Resource unified_mode true - resource_name :rhsm_register provides(:rhsm_register) { true } description "Use the rhsm_register resource to register a node with the Red Hat Subscription Manager"\ diff --git a/lib/chef/resource/rhsm_repo.rb b/lib/chef/resource/rhsm_repo.rb index c593bd900f..b1a8d06d6f 100644 --- a/lib/chef/resource/rhsm_repo.rb +++ b/lib/chef/resource/rhsm_repo.rb @@ -1,5 +1,5 @@ # -# Copyright:: 2015-2018 Chef Software, Inc. +# Copyright:: 2015-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,7 +20,6 @@ require_relative "../resource" class Chef class Resource class RhsmRepo < Chef::Resource - resource_name :rhsm_repo provides(:rhsm_repo) { true } description "Use the rhsm_repo resource to enable or disable Red Hat Subscription Manager"\ diff --git a/lib/chef/resource/rhsm_subscription.rb b/lib/chef/resource/rhsm_subscription.rb index 7bbf53f07d..b7c84e95b4 100644 --- a/lib/chef/resource/rhsm_subscription.rb +++ b/lib/chef/resource/rhsm_subscription.rb @@ -1,5 +1,5 @@ # -# Copyright:: 2015-2018 Chef Software, Inc. +# Copyright:: 2015-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,7 +20,6 @@ require_relative "../resource" class Chef class Resource class RhsmSubscription < Chef::Resource - resource_name :rhsm_subscription provides(:rhsm_subscription) { true } description "Use the rhsm_subscription resource to add or remove Red Hat Subscription Manager"\ diff --git a/lib/chef/resource/route.rb b/lib/chef/resource/route.rb index 6ebdf8e11f..979dc12342 100644 --- a/lib/chef/resource/route.rb +++ b/lib/chef/resource/route.rb @@ -24,6 +24,8 @@ class Chef class Route < Chef::Resource unified_mode true + provides :route + default_action :add allowed_actions :add, :delete diff --git a/lib/chef/resource/rpm_package.rb b/lib/chef/resource/rpm_package.rb index c159ce5c08..3661ca1daa 100644 --- a/lib/chef/resource/rpm_package.rb +++ b/lib/chef/resource/rpm_package.rb @@ -23,7 +23,6 @@ class Chef class RpmPackage < Chef::Resource::Package unified_mode true - resource_name :rpm_package provides :rpm_package description "Use the rpm_package resource to manage packages for the RPM Package Manager platform." diff --git a/lib/chef/resource/ruby.rb b/lib/chef/resource/ruby.rb index ab193c659b..b1bd86c73f 100644 --- a/lib/chef/resource/ruby.rb +++ b/lib/chef/resource/ruby.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,6 +24,8 @@ class Chef class Ruby < Chef::Resource::Script unified_mode true + provides :ruby + description "Use the ruby resource to execute scripts using the Ruby interpreter. This"\ " resource may also use any of the actions and properties that are available"\ " to the execute resource. Commands that are executed with this resource are (by"\ diff --git a/lib/chef/resource/script.rb b/lib/chef/resource/script.rb index 056d2743cc..755fcdea63 100644 --- a/lib/chef/resource/script.rb +++ b/lib/chef/resource/script.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2017, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,7 @@ class Chef class Script < Chef::Resource::Execute unified_mode true - resource_name :script + provides :script identity_attr :name diff --git a/lib/chef/resource/smartos_package.rb b/lib/chef/resource/smartos_package.rb index 10ef027ef9..8e9b83985a 100644 --- a/lib/chef/resource/smartos_package.rb +++ b/lib/chef/resource/smartos_package.rb @@ -23,7 +23,6 @@ class Chef class SmartosPackage < Chef::Resource::Package unified_mode true - resource_name :smartos_package provides :smartos_package provides :package, platform_family: "smartos" diff --git a/lib/chef/resource/snap_package.rb b/lib/chef/resource/snap_package.rb index 263ab0161b..57708b5a02 100644 --- a/lib/chef/resource/snap_package.rb +++ b/lib/chef/resource/snap_package.rb @@ -23,7 +23,7 @@ class Chef class SnapPackage < Chef::Resource::Package unified_mode true - resource_name :snap_package + provides :snap_package description "Use the snap_package resource to manage snap packages on Debian and Ubuntu platforms." introduced "15.0" diff --git a/lib/chef/resource/solaris_package.rb b/lib/chef/resource/solaris_package.rb index 8cade4abba..30de484eb1 100644 --- a/lib/chef/resource/solaris_package.rb +++ b/lib/chef/resource/solaris_package.rb @@ -24,7 +24,6 @@ class Chef class SolarisPackage < Chef::Resource::Package unified_mode true - resource_name :solaris_package provides :solaris_package provides :package, os: "solaris2", platform_family: "nexentacore" provides :package, os: "solaris2", platform_family: "solaris2", platform_version: "<= 5.10" diff --git a/lib/chef/resource/ssh_known_hosts_entry.rb b/lib/chef/resource/ssh_known_hosts_entry.rb index b0fb926550..e652f82def 100644 --- a/lib/chef/resource/ssh_known_hosts_entry.rb +++ b/lib/chef/resource/ssh_known_hosts_entry.rb @@ -2,7 +2,7 @@ # Author:: Seth Vargo (<sethvargo@gmail.com>) # # Copyright:: 2013-2018, Seth Vargo -# Copyright:: 2017-2018, Chef Software, Inc. +# Copyright:: 2017-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ require_relative "../dist" class Chef class Resource class SshKnownHostsEntry < Chef::Resource - resource_name :ssh_known_hosts_entry + provides :ssh_known_hosts_entry description "Use the ssh_known_hosts_entry resource to add an entry for the specified host in /etc/ssh/ssh_known_hosts or a user's known hosts file if specified." introduced "14.3" diff --git a/lib/chef/resource/subversion.rb b/lib/chef/resource/subversion.rb index 26d887331e..61101362e6 100644 --- a/lib/chef/resource/subversion.rb +++ b/lib/chef/resource/subversion.rb @@ -1,7 +1,7 @@ # # Author:: Daniel DeLeo (<dan@kallistec.com>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,6 +25,8 @@ class Chef class Subversion < Chef::Resource::Scm unified_mode true + provides :subversion + description "Use the subversion resource to manage source control resources that exist in a Subversion repository." allowed_actions :force_export diff --git a/lib/chef/resource/sudo.rb b/lib/chef/resource/sudo.rb index c50dcd803b..c340478349 100644 --- a/lib/chef/resource/sudo.rb +++ b/lib/chef/resource/sudo.rb @@ -26,7 +26,6 @@ class Chef class Sudo < Chef::Resource unified_mode true - resource_name :sudo provides(:sudo) { true } description "Use the sudo resource to add or remove individual sudo entries using sudoers.d files."\ diff --git a/lib/chef/resource/swap_file.rb b/lib/chef/resource/swap_file.rb index 1d2713e12c..305727084c 100644 --- a/lib/chef/resource/swap_file.rb +++ b/lib/chef/resource/swap_file.rb @@ -1,6 +1,6 @@ # # Copyright:: 2012-2018, Seth Vargo -# Copyright:: 2017-2020, Chef Software, Inc. +# Copyright:: 2017-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ class Chef class SwapFile < Chef::Resource unified_mode true - resource_name :swap_file provides(:swap_file) { true } description "Use the swap_file resource to create or delete swap files on Linux systems, and optionally to manage the swappiness configuration for a host." diff --git a/lib/chef/resource/sysctl.rb b/lib/chef/resource/sysctl.rb index 9a36128ff2..240f45e60f 100644 --- a/lib/chef/resource/sysctl.rb +++ b/lib/chef/resource/sysctl.rb @@ -22,7 +22,6 @@ class Chef class Sysctl < Chef::Resource unified_mode true - resource_name :sysctl provides(:sysctl) { true } provides(:sysctl_param) { true } diff --git a/lib/chef/resource/systemd_unit.rb b/lib/chef/resource/systemd_unit.rb index a4f087b220..1c318ded5c 100644 --- a/lib/chef/resource/systemd_unit.rb +++ b/lib/chef/resource/systemd_unit.rb @@ -23,7 +23,7 @@ require "iniparse" class Chef class Resource class SystemdUnit < Chef::Resource - resource_name(:systemd_unit) { true } + provides(:systemd_unit) { true } description "Use the systemd_unit resource to create, manage, and run systemd units." introduced "12.11" diff --git a/lib/chef/resource/template.rb b/lib/chef/resource/template.rb index 876816cc81..c1115fb5b7 100644 --- a/lib/chef/resource/template.rb +++ b/lib/chef/resource/template.rb @@ -2,7 +2,7 @@ # Author:: Adam Jacob (<adam@chef.io>) # Author:: Seth Chisamore (<schisamo@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,7 +36,6 @@ class Chef class Template < Chef::Resource::File unified_mode true - resource_name :template provides :template include Chef::Mixin::Securable diff --git a/lib/chef/resource/timezone.rb b/lib/chef/resource/timezone.rb index afbef3818f..32727c1a75 100644 --- a/lib/chef/resource/timezone.rb +++ b/lib/chef/resource/timezone.rb @@ -24,7 +24,7 @@ class Chef class Timezone < Chef::Resource unified_mode true - resource_name :timezone + provides :timezone description "Use the timezone resource to change the system timezone on Windows, Linux, and macOS hosts. Timezones are specified in tz database format, with a complete list of available TZ values for Linux and macOS here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones and for Windows here: https://ss64.com/nt/timezones.html." introduced "14.6" diff --git a/lib/chef/resource/user.rb b/lib/chef/resource/user.rb index 05129ce97e..b72cc22b2d 100644 --- a/lib/chef/resource/user.rb +++ b/lib/chef/resource/user.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,8 +23,6 @@ class Chef class User < Chef::Resource unified_mode true - resource_name :user_resource_abstract_base_class # this prevents magickal class name DSL wiring - description "Use the user resource to add users, update existing users, remove users, and to lock/unlock user passwords." default_action :create diff --git a/lib/chef/resource/user/aix_user.rb b/lib/chef/resource/user/aix_user.rb index d64dd02f32..2c4da7a695 100644 --- a/lib/chef/resource/user/aix_user.rb +++ b/lib/chef/resource/user/aix_user.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2016-2017, Chef Software Inc. +# Copyright:: Copyright 2016-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,8 +23,6 @@ class Chef class AixUser < Chef::Resource::User unified_mode true - resource_name :aix_user - provides :aix_user provides :user, os: "aix" end diff --git a/lib/chef/resource/user/dscl_user.rb b/lib/chef/resource/user/dscl_user.rb index 34d8a4180c..089d82acc6 100644 --- a/lib/chef/resource/user/dscl_user.rb +++ b/lib/chef/resource/user/dscl_user.rb @@ -23,8 +23,6 @@ class Chef class DsclUser < Chef::Resource::User unified_mode true - resource_name :dscl_user - provides :dscl_user provides :user, platform: "mac_os_x", platform_version: "< 10.14" diff --git a/lib/chef/resource/user/linux_user.rb b/lib/chef/resource/user/linux_user.rb index 4f3622213d..ea4778bbc6 100644 --- a/lib/chef/resource/user/linux_user.rb +++ b/lib/chef/resource/user/linux_user.rb @@ -23,8 +23,6 @@ class Chef class LinuxUser < Chef::Resource::User unified_mode true - resource_name :linux_user - provides :linux_user provides :user, os: "linux" diff --git a/lib/chef/resource/user/mac_user.rb b/lib/chef/resource/user/mac_user.rb index 62245f8df1..6eebb3ec74 100644 --- a/lib/chef/resource/user/mac_user.rb +++ b/lib/chef/resource/user/mac_user.rb @@ -60,8 +60,6 @@ class Chef class MacUser < Chef::Resource::User unified_mode true - resource_name :mac_user - provides :mac_user provides :user, platform: "mac_os_x", platform_version: ">= 10.14" diff --git a/lib/chef/resource/user/pw_user.rb b/lib/chef/resource/user/pw_user.rb index a14fe7fd8b..ac5f8fe01d 100644 --- a/lib/chef/resource/user/pw_user.rb +++ b/lib/chef/resource/user/pw_user.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2016-2017, Chef Software Inc. +# Copyright:: Copyright 2016-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,8 +23,6 @@ class Chef class PwUser < Chef::Resource::User unified_mode true - resource_name :pw_user - provides :pw_user provides :user, os: "freebsd" end diff --git a/lib/chef/resource/user/solaris_user.rb b/lib/chef/resource/user/solaris_user.rb index 7a50da5ab1..2266f1537d 100644 --- a/lib/chef/resource/user/solaris_user.rb +++ b/lib/chef/resource/user/solaris_user.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2016-2017, Chef Software Inc. +# Copyright:: Copyright 2016-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,8 +23,6 @@ class Chef class SolarisUser < Chef::Resource::User unified_mode true - resource_name :solaris_user - provides :solaris_user provides :user, os: %w{omnios solaris2} end diff --git a/lib/chef/resource/user/windows_user.rb b/lib/chef/resource/user/windows_user.rb index 23b7b985f3..4c16b9dcc9 100644 --- a/lib/chef/resource/user/windows_user.rb +++ b/lib/chef/resource/user/windows_user.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2016-2017, Chef Software Inc. +# Copyright:: Copyright 2016-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,8 +23,6 @@ class Chef class WindowsUser < Chef::Resource::User unified_mode true - resource_name :windows_user - provides :windows_user provides :user, os: "windows" diff --git a/lib/chef/resource/whyrun_safe_ruby_block.rb b/lib/chef/resource/whyrun_safe_ruby_block.rb index 7d66147149..6dde0539a7 100644 --- a/lib/chef/resource/whyrun_safe_ruby_block.rb +++ b/lib/chef/resource/whyrun_safe_ruby_block.rb @@ -19,6 +19,7 @@ class Chef class Resource class WhyrunSafeRubyBlock < Chef::Resource::RubyBlock + provides :whyrun_safe_ruby_block unified_mode true end end diff --git a/lib/chef/resource/windows_ad_join.rb b/lib/chef/resource/windows_ad_join.rb index 84f7fa00fb..690cc914dc 100644 --- a/lib/chef/resource/windows_ad_join.rb +++ b/lib/chef/resource/windows_ad_join.rb @@ -21,7 +21,6 @@ require_relative "../dist" class Chef class Resource class WindowsAdJoin < Chef::Resource - resource_name :windows_ad_join provides :windows_ad_join description "Use the windows_ad_join resource to join a Windows Active Directory domain." diff --git a/lib/chef/resource/windows_auto_run.rb b/lib/chef/resource/windows_auto_run.rb index c0d0910e5f..e086bfc2ce 100644 --- a/lib/chef/resource/windows_auto_run.rb +++ b/lib/chef/resource/windows_auto_run.rb @@ -1,7 +1,7 @@ # # Author:: Paul Morton (<pmorton@biaprotect.com>) # Copyright:: 2011-2018, Business Intelligence Associates, Inc. -# Copyright:: 2017-2018, Chef Software, Inc. +# Copyright:: 2017-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class WindowsAutorun < Chef::Resource - resource_name :windows_auto_run provides(:windows_auto_run) { true } description "Use the windows_auto_run resource to set applications to run at login." diff --git a/lib/chef/resource/windows_certificate.rb b/lib/chef/resource/windows_certificate.rb index 474f9ad69c..64ac6bb3b0 100644 --- a/lib/chef/resource/windows_certificate.rb +++ b/lib/chef/resource/windows_certificate.rb @@ -2,7 +2,7 @@ # Author:: Richard Lavey (richard.lavey@calastone.com) # # Copyright:: 2015-2017, Calastone Ltd. -# Copyright:: 2018-2019, Chef Software Inc. +# Copyright:: 2018-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ require_relative "../dist" class Chef class Resource class WindowsCertificate < Chef::Resource - resource_name :windows_certificate + provides :windows_certificate description "Use the windows_certificate resource to install a certificate into the Windows certificate store from a file. The resource grants read-only access to the private key for designated accounts. Due to current limitations in WinRM, installing certificates remotely may not work if the operation requires a user profile. Operations on the local machine store should still work." introduced "14.7" diff --git a/lib/chef/resource/windows_dfs_folder.rb b/lib/chef/resource/windows_dfs_folder.rb index 8078f965fb..e66e6d7eb8 100644 --- a/lib/chef/resource/windows_dfs_folder.rb +++ b/lib/chef/resource/windows_dfs_folder.rb @@ -2,7 +2,7 @@ # Author:: Jason Field # # Copyright:: 2018, Calastone Ltd. -# Copyright:: 2019, Chef Software, Inc. +# Copyright:: 2019-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class WindowsDfsFolder < Chef::Resource - resource_name :windows_dfs_folder provides :windows_dfs_folder description "The windows_dfs_folder resources creates a folder within dfs as many levels deep as required." diff --git a/lib/chef/resource/windows_dfs_namespace.rb b/lib/chef/resource/windows_dfs_namespace.rb index 3b201d1028..b88dcc5683 100644 --- a/lib/chef/resource/windows_dfs_namespace.rb +++ b/lib/chef/resource/windows_dfs_namespace.rb @@ -2,7 +2,7 @@ # Author:: Jason Field # # Copyright:: 2018, Calastone Ltd. -# Copyright:: 2019, Chef Software, Inc. +# Copyright:: 2019-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class WindowsDfsNamespace < Chef::Resource - resource_name :windows_dfs_namespace provides :windows_dfs_namespace description "Creates a share and DFS namespace on the local server." diff --git a/lib/chef/resource/windows_dfs_server.rb b/lib/chef/resource/windows_dfs_server.rb index 89376a0877..ae613d931b 100644 --- a/lib/chef/resource/windows_dfs_server.rb +++ b/lib/chef/resource/windows_dfs_server.rb @@ -2,7 +2,7 @@ # Author:: Jason Field # # Copyright:: 2018, Calastone Ltd. -# Copyright:: 2019, Chef Software, Inc. +# Copyright:: 2019-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class WindowsDfsServer < Chef::Resource - resource_name :windows_dfs_server provides :windows_dfs_server description "The windows_dfs_server resource sets system-wide DFS settings." diff --git a/lib/chef/resource/windows_dns_record.rb b/lib/chef/resource/windows_dns_record.rb index 701656b34a..c6edc9129b 100644 --- a/lib/chef/resource/windows_dns_record.rb +++ b/lib/chef/resource/windows_dns_record.rb @@ -2,7 +2,7 @@ # Author:: Jason Field # # Copyright:: 2018, Calastone Ltd. -# Copyright:: 2019, Chef Software, Inc. +# Copyright:: 2019-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class WindowsDnsRecord < Chef::Resource - resource_name :windows_dns_record provides :windows_dns_record description "The windows_dns_record resource creates a DNS record for the given domain." diff --git a/lib/chef/resource/windows_dns_zone.rb b/lib/chef/resource/windows_dns_zone.rb index 9ac208fddc..f303deabb2 100644 --- a/lib/chef/resource/windows_dns_zone.rb +++ b/lib/chef/resource/windows_dns_zone.rb @@ -2,7 +2,7 @@ # Author:: Jason Field # # Copyright:: 2018, Calastone Ltd. -# Copyright:: 2019, Chef Software, Inc. +# Copyright:: 2019-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class WindowsDnsZone < Chef::Resource - resource_name :windows_dns_zone provides :windows_dns_zone description "The windows_dns_zone resource creates an Active Directory Integrated DNS Zone on the local server." diff --git a/lib/chef/resource/windows_env.rb b/lib/chef/resource/windows_env.rb index d1e14b1d04..4eda6e22b9 100644 --- a/lib/chef/resource/windows_env.rb +++ b/lib/chef/resource/windows_env.rb @@ -22,7 +22,6 @@ require_relative "../resource" class Chef class Resource class WindowsEnv < Chef::Resource - resource_name :windows_env provides :windows_env provides :env # backwards compat with the pre-Chef 14 resource name diff --git a/lib/chef/resource/windows_feature.rb b/lib/chef/resource/windows_feature.rb index c1edcc002b..7e5ad67dd2 100644 --- a/lib/chef/resource/windows_feature.rb +++ b/lib/chef/resource/windows_feature.rb @@ -1,7 +1,7 @@ # # Author:: Seth Chisamore (<schisamo@chef.io>) # -# Copyright:: 2011-2018, Chef Software, Inc. +# Copyright:: 2011-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class WindowsFeature < Chef::Resource - resource_name :windows_feature provides(:windows_feature) { true } description "Use the windows_feature resource to add, remove or entirely delete Windows features and roles. This resource calls the 'windows_feature_dism' or 'windows_feature_powershell' resources depending on the specified installation method, and defaults to DISM, which is available on both Workstation and Server editions of Windows." diff --git a/lib/chef/resource/windows_feature_dism.rb b/lib/chef/resource/windows_feature_dism.rb index 53275b062e..1ffffee886 100644 --- a/lib/chef/resource/windows_feature_dism.rb +++ b/lib/chef/resource/windows_feature_dism.rb @@ -1,7 +1,7 @@ # # Author:: Seth Chisamore (<schisamo@chef.io>) # -# Copyright:: 2011-2020, Chef Software, Inc. +# Copyright:: 2011-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ require_relative "../platform/query_helpers" class Chef class Resource class WindowsFeatureDism < Chef::Resource - resource_name :windows_feature_dism provides(:windows_feature_dism) { true } description "Use the windows_feature_dism resource to add, remove, or entirely delete Windows features and roles using DISM." diff --git a/lib/chef/resource/windows_feature_powershell.rb b/lib/chef/resource/windows_feature_powershell.rb index b390973851..dd41cb7c57 100644 --- a/lib/chef/resource/windows_feature_powershell.rb +++ b/lib/chef/resource/windows_feature_powershell.rb @@ -23,7 +23,6 @@ require_relative "../platform/query_helpers" class Chef class Resource class WindowsFeaturePowershell < Chef::Resource - resource_name :windows_feature_powershell provides(:windows_feature_powershell) { true } description "Use the windows_feature_powershell resource to add, remove, or entirely delete Windows features and roles using PowerShell. This resource offers significant speed benefits over the windows_feature_dism resource, but requires installation of the Remote Server Administration Tools on non-server releases of Windows." diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb index dedc2f8e2e..a040bdb06b 100644 --- a/lib/chef/resource/windows_firewall_rule.rb +++ b/lib/chef/resource/windows_firewall_rule.rb @@ -3,7 +3,7 @@ # Author:: Tor Magnus Rakvåg (tor.magnus@outlook.com) # Author:: Tim Smith (tsmith@chef.io) # Copyright:: 2013-2015 Matt Clifton -# Copyright:: 2018, Chef Software, Inc. +# Copyright:: 2018-2020, Chef Software Inc. # Copyright:: 2018, Intility AS # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,7 @@ require_relative "../json_compat" class Chef class Resource class WindowsFirewallRule < Chef::Resource - resource_name :windows_firewall_rule + provides :windows_firewall_rule description "Use the windows_firewall_rule resource to create, change or remove windows firewall rules." introduced "14.7" diff --git a/lib/chef/resource/windows_font.rb b/lib/chef/resource/windows_font.rb index 64644a815f..a1bccebfec 100644 --- a/lib/chef/resource/windows_font.rb +++ b/lib/chef/resource/windows_font.rb @@ -1,6 +1,6 @@ # # Copyright:: 2014-2018, Schuberg Philis BV. -# Copyright:: 2017-2018, Chef Software, Inc. +# Copyright:: 2017-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ class Chef class WindowsFont < Chef::Resource require_relative "../util/path_helper" - resource_name :windows_font provides(:windows_font) { true } description "Use the windows_font resource to install font files on Windows. By default, the font is sourced from the cookbook using the resource, but a URI source can be specified as well." diff --git a/lib/chef/resource/windows_package.rb b/lib/chef/resource/windows_package.rb index 9fac482f9b..5bfc9554df 100644 --- a/lib/chef/resource/windows_package.rb +++ b/lib/chef/resource/windows_package.rb @@ -1,6 +1,6 @@ # # Author:: Bryan McLellan <btm@loftninjas.org> -# Copyright:: Copyright 2014-2019, Chef Software Inc. +# Copyright:: Copyright 2014-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,7 +27,6 @@ class Chef class WindowsPackage < Chef::Resource::Package include Chef::Mixin::Uris - resource_name :windows_package provides(:windows_package) { true } provides :package, os: "windows" diff --git a/lib/chef/resource/windows_pagefile.rb b/lib/chef/resource/windows_pagefile.rb index 03a7511f47..3a4ccb6fe0 100644 --- a/lib/chef/resource/windows_pagefile.rb +++ b/lib/chef/resource/windows_pagefile.rb @@ -1,6 +1,6 @@ # # Copyright:: 2012-2018, Nordstrom, Inc. -# Copyright:: 2017-2018, Chef Software, Inc. +# Copyright:: 2017-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ require_relative "../resource" class Chef class Resource class WindowsPagefile < Chef::Resource - resource_name :windows_pagefile provides(:windows_pagefile) { true } description "Use the windows_pagefile resource to configure pagefile settings on Windows." diff --git a/lib/chef/resource/windows_path.rb b/lib/chef/resource/windows_path.rb index 0067de5baf..49199f460b 100644 --- a/lib/chef/resource/windows_path.rb +++ b/lib/chef/resource/windows_path.rb @@ -1,6 +1,6 @@ # # Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>) -# Copyright:: Copyright 2008-2017, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class WindowsPath < Chef::Resource - resource_name :windows_path provides(:windows_path) { true } description "Use the windows_path resource to manage the path environment variable on Microsoft Windows." diff --git a/lib/chef/resource/windows_printer.rb b/lib/chef/resource/windows_printer.rb index d782c1b360..d1b1538f6e 100644 --- a/lib/chef/resource/windows_printer.rb +++ b/lib/chef/resource/windows_printer.rb @@ -24,7 +24,6 @@ class Chef class WindowsPrinter < Chef::Resource require "resolv" - resource_name :windows_printer provides(:windows_printer) { true } description "Use the windows_printer resource to setup Windows printers. Note that this doesn't currently install a printer driver. You must already have the driver installed on the system." diff --git a/lib/chef/resource/windows_printer_port.rb b/lib/chef/resource/windows_printer_port.rb index cd1a5f55c2..e51969edfb 100644 --- a/lib/chef/resource/windows_printer_port.rb +++ b/lib/chef/resource/windows_printer_port.rb @@ -24,7 +24,6 @@ class Chef class WindowsPrinterPort < Chef::Resource require "resolv" - resource_name :windows_printer_port provides(:windows_printer_port) { true } description "Use the windows_printer_port resource to create and delete TCP/IPv4 printer ports on Windows." diff --git a/lib/chef/resource/windows_script.rb b/lib/chef/resource/windows_script.rb index dd146deecc..94c041eb26 100644 --- a/lib/chef/resource/windows_script.rb +++ b/lib/chef/resource/windows_script.rb @@ -1,6 +1,6 @@ # # Author:: Adam Edwards (<adamed@chef.io>) -# Copyright:: Copyright 2013-2019, Chef Software Inc. +# Copyright:: Copyright 2013-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,6 +25,8 @@ class Chef class WindowsScript < Chef::Resource::Script unified_mode true + provides :windows_script + # This is an abstract resource meant to be subclasses; thus no 'provides' set_guard_inherited_attributes(:architecture) diff --git a/lib/chef/resource/windows_share.rb b/lib/chef/resource/windows_share.rb index b4f344eb96..1b81eaf55f 100644 --- a/lib/chef/resource/windows_share.rb +++ b/lib/chef/resource/windows_share.rb @@ -4,7 +4,7 @@ # Author:: Tim Smith (tsmith@chef.io) # # Copyright:: 2014-2017, Sölvi Páll Ásgeirsson. -# Copyright:: 2018, Chef Software, Inc. +# Copyright:: 2018-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ require_relative "../util/path_helper" class Chef class Resource class WindowsShare < Chef::Resource - resource_name :windows_share + provides :windows_share description "Use the windows_share resource to create, modify and remove Windows shares." introduced "14.7" diff --git a/lib/chef/resource/windows_shortcut.rb b/lib/chef/resource/windows_shortcut.rb index 0c6dc63e6e..71e0f6be9b 100644 --- a/lib/chef/resource/windows_shortcut.rb +++ b/lib/chef/resource/windows_shortcut.rb @@ -1,7 +1,7 @@ # # Author:: Doug MacEachern <dougm@vmware.com> # Copyright:: 2010-2018, VMware, Inc. -# Copyright:: 2017-2018, Chef Software, Inc. +# Copyright:: 2017-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class WindowsShortcut < Chef::Resource - resource_name :windows_shortcut provides(:windows_shortcut) { true } description "Use the windows_shortcut resource to create shortcut files on Windows." diff --git a/lib/chef/resource/windows_task.rb b/lib/chef/resource/windows_task.rb index c29a951d74..2b866026ec 100644 --- a/lib/chef/resource/windows_task.rb +++ b/lib/chef/resource/windows_task.rb @@ -1,6 +1,6 @@ # # Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,6 @@ require_relative "../win32/security" if Chef::Platform.windows? class Chef class Resource class WindowsTask < Chef::Resource - resource_name :windows_task provides(:windows_task) { true } description "Use the windows_task resource to create, delete or run a Windows scheduled task. Requires Windows Server 2008 or later due to API usage." diff --git a/lib/chef/resource/windows_uac.rb b/lib/chef/resource/windows_uac.rb index c4d5b53c14..4e9b18ce43 100644 --- a/lib/chef/resource/windows_uac.rb +++ b/lib/chef/resource/windows_uac.rb @@ -1,6 +1,6 @@ # # Author:: Tim Smith (<tsmith@chef.io>) -# Copyright:: 2019, Chef Software, Inc. +# Copyright:: 2019-2020, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ require_relative "../resource" class Chef class Resource class WindowsUac < Chef::Resource - resource_name :windows_uac provides :windows_uac description 'The windows_uac resource configures UAC on Windows hosts by setting registry keys at \'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\'' diff --git a/lib/chef/resource/windows_user_privilege.rb b/lib/chef/resource/windows_user_privilege.rb index 685354cfb4..43dd3546a6 100644 --- a/lib/chef/resource/windows_user_privilege.rb +++ b/lib/chef/resource/windows_user_privilege.rb @@ -1,7 +1,7 @@ # # Author:: Jared Kauppila (<jared@kauppi.la>) # Author:: Vasundhara Jagdale(<vasundhara.jagdale@chef.io>) -# Copyright 2008-2020, Chef Software, Inc. +# Copyright 2008-2020, Chef Software Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ class Chef SeTakeOwnershipPrivilege } - resource_name :windows_user_privilege + provides :windows_user_privilege description "The windows_user_privilege resource allows to add and set principal (User/Group) to the specified privilege. \n Ref: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/user-rights-assignment" introduced "16.0" diff --git a/lib/chef/resource/windows_workgroup.rb b/lib/chef/resource/windows_workgroup.rb index b1ae5c2b95..bcb791af77 100644 --- a/lib/chef/resource/windows_workgroup.rb +++ b/lib/chef/resource/windows_workgroup.rb @@ -22,7 +22,6 @@ require_relative "../dist" class Chef class Resource class WindowsWorkgroup < Chef::Resource - resource_name :windows_workgroup provides :windows_workgroup include Chef::Mixin::PowershellOut diff --git a/lib/chef/resource/yum_package.rb b/lib/chef/resource/yum_package.rb index 0102a62a2f..0a0f4b3e71 100644 --- a/lib/chef/resource/yum_package.rb +++ b/lib/chef/resource/yum_package.rb @@ -24,7 +24,7 @@ class Chef class YumPackage < Chef::Resource::Package unified_mode true - resource_name :yum_package + provides :yum_package provides :package, platform_family: "fedora_derived" description "Use the yum_package resource to install, upgrade, and remove packages with Yum"\ diff --git a/lib/chef/resource/yum_repository.rb b/lib/chef/resource/yum_repository.rb index 05639842af..28e5c809c5 100644 --- a/lib/chef/resource/yum_repository.rb +++ b/lib/chef/resource/yum_repository.rb @@ -1,6 +1,6 @@ # # Author:: Thom May (<thom@chef.io>) -# Copyright:: Copyright (c) 2016-2017 Chef Software, Inc. +# Copyright:: Copyright (c) 2016-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class YumRepository < Chef::Resource - resource_name :yum_repository provides(:yum_repository) { true } description "Use the yum_repository resource to manage a Yum repository configuration"\ diff --git a/lib/chef/resource/zypper_package.rb b/lib/chef/resource/zypper_package.rb index d427ee60c8..4a56191a2a 100644 --- a/lib/chef/resource/zypper_package.rb +++ b/lib/chef/resource/zypper_package.rb @@ -23,7 +23,7 @@ class Chef class ZypperPackage < Chef::Resource::Package unified_mode true - resource_name :zypper_package + provides :zypper_package provides :package, platform_family: "suse" description "Use the zypper_package resource to install, upgrade, and remove packages with Zypper for the SUSE Enterprise and OpenSUSE platforms." diff --git a/lib/chef/resource/zypper_repository.rb b/lib/chef/resource/zypper_repository.rb index 447660e9ac..6cc0929fad 100644 --- a/lib/chef/resource/zypper_repository.rb +++ b/lib/chef/resource/zypper_repository.rb @@ -1,6 +1,6 @@ # # Author:: Tim Smith (<tsmith@chef.io>) -# Copyright:: Copyright (c) 2017 Chef Software, Inc. +# Copyright:: Copyright (c) 2017-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,6 @@ require_relative "../resource" class Chef class Resource class ZypperRepository < Chef::Resource - resource_name :zypper_repository provides(:zypper_repository) { true } provides(:zypper_repo) { true } diff --git a/lib/chef/resource_inspector.rb b/lib/chef/resource_inspector.rb index 8d92db04b6..187bd6338b 100644 --- a/lib/chef/resource_inspector.rb +++ b/lib/chef/resource_inspector.rb @@ -92,7 +92,7 @@ module ResourceInspector if File.directory?(arg) extract_cookbook(arg, complete).each { |k, v| acc[k] = v } else - r = Chef::ResourceResolver.resolve(arg.to_sym, canonical: nil) + r = Chef::ResourceResolver.resolve(arg.to_sym) acc[r.resource_name] = extract_resource(r, complete) end end diff --git a/lib/chef/resource_resolver.rb b/lib/chef/resource_resolver.rb index 410f7f0076..d6635559f0 100644 --- a/lib/chef/resource_resolver.rb +++ b/lib/chef/resource_resolver.rb @@ -1,6 +1,6 @@ # # Author:: Lamont Granquist (<lamont@chef.io>) -# Copyright:: Copyright 2015-2017, Chef Software Inc. +# Copyright:: Copyright 2015-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,8 +29,8 @@ class Chef # @param node [Chef::Node] The node against which to resolve. `nil` causes # platform filters to be ignored. # - def self.resolve(resource_name, node: nil, canonical: nil) - new(node, resource_name, canonical: canonical).resolve + def self.resolve(resource_name, node: nil) + new(node, resource_name).resolve end # @@ -40,11 +40,9 @@ class Chef # @param resource_name [Symbol] The resource DSL name (e.g. `:file`). # @param node [Chef::Node] The node against which to resolve. `nil` causes # platform filters to be ignored. - # @param canonical [Boolean] `true` or `false` to match canonical or - # non-canonical values only. `nil` to ignore canonicality. # - def self.list(resource_name, node: nil, canonical: nil) - new(node, resource_name, canonical: canonical).list + def self.list(resource_name, node: nil) + new(node, resource_name).list end include Chef::Mixin::ConvertToClassName @@ -55,8 +53,6 @@ class Chef attr_reader :resource_name # @api private attr_reader :action - # @api private - attr_reader :canonical # # Create a resolver. @@ -64,14 +60,11 @@ class Chef # @param node [Chef::Node] The node against which to resolve. `nil` causes # platform filters to be ignored. # @param resource_name [Symbol] The resource DSL name (e.g. `:file`). - # @param canonical [Boolean] `true` or `false` to match canonical or - # non-canonical values only. `nil` to ignore canonicality. Default: `nil` # # @api private use Chef::ResourceResolver.resolve or .list instead. - def initialize(node, resource_name, canonical: nil) + def initialize(node, resource_name) @node = node @resource_name = resource_name.to_sym - @canonical = canonical end # @api private use Chef::ResourceResolver.resolve instead. @@ -135,7 +128,7 @@ class Chef # @api private def potential_handlers - handler_map.list(node, resource_name, canonical: canonical).uniq + handler_map.list(node, resource_name).uniq end def enabled_handlers @@ -146,7 +139,7 @@ class Chef @prioritized_handlers ||= begin enabled_handlers = self.enabled_handlers - prioritized = priority_map.list(node, resource_name, canonical: canonical).flatten(1) + prioritized = priority_map.list(node, resource_name).flatten(1) prioritized &= enabled_handlers # Filter the priority map by the actual enabled handlers prioritized |= enabled_handlers # Bring back any handlers that aren't in the priority map, at the *end* (ordered set) prioritized |