diff options
author | Tim Smith <tsmith@chef.io> | 2018-03-06 19:55:22 -0800 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-03-07 11:19:20 -0800 |
commit | bbd87e035bb966e1b4134b809db6bb0c850272a6 (patch) | |
tree | 7329c00c3209ea1ab380d5120548b632831f8aa3 | |
parent | d63980c156c042d2badcfc83b9dbe00c8e5cdccb (diff) | |
download | chef-bbd87e035bb966e1b4134b809db6bb0c850272a6.tar.gz |
Remove platfom restrictions in provides and don't require providers
Don't require providers in the resources since we map these automatically. Also remove or simplify the platform restrictions in the provides lines in the resources. We're not really getting anything from these the way we wire up resources.
Signed-off-by: Tim Smith <tsmith@chef.io>
53 files changed, 74 insertions, 70 deletions
diff --git a/lib/chef/provider/batch.rb b/lib/chef/provider/batch.rb index 83218e4f76..dae1513a51 100644 --- a/lib/chef/provider/batch.rb +++ b/lib/chef/provider/batch.rb @@ -22,7 +22,7 @@ class Chef class Provider class Batch < Chef::Provider::WindowsScript - provides :batch, os: "windows" + provides :batch def initialize(new_resource, run_context) super(new_resource, run_context, ".bat") diff --git a/lib/chef/provider/dsc_resource.rb b/lib/chef/provider/dsc_resource.rb index 959227b408..f16c91640b 100644 --- a/lib/chef/provider/dsc_resource.rb +++ b/lib/chef/provider/dsc_resource.rb @@ -24,7 +24,7 @@ class Chef class Provider class DscResource < Chef::Provider include Chef::Mixin::PowershellTypeCoercions - provides :dsc_resource, os: "windows" + provides :dsc_resource def initialize(new_resource, run_context) super @new_resource = new_resource diff --git a/lib/chef/provider/dsc_script.rb b/lib/chef/provider/dsc_script.rb index db7a5442ed..b568a3bab9 100644 --- a/lib/chef/provider/dsc_script.rb +++ b/lib/chef/provider/dsc_script.rb @@ -25,7 +25,7 @@ class Chef class Provider class DscScript < Chef::Provider - provides :dsc_script, os: "windows" + provides :dsc_script def initialize(dsc_resource, run_context) super(dsc_resource, run_context) diff --git a/lib/chef/provider/ifconfig/aix.rb b/lib/chef/provider/ifconfig/aix.rb index 788b609fcf..b68c5d5364 100644 --- a/lib/chef/provider/ifconfig/aix.rb +++ b/lib/chef/provider/ifconfig/aix.rb @@ -22,7 +22,7 @@ class Chef class Provider class Ifconfig class Aix < Chef::Provider::Ifconfig - provides :ifconfig, platform: %w{aix} + provides :ifconfig, platform: "aix" def load_current_resource @current_resource = Chef::Resource::Ifconfig.new(new_resource.name) diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb index 6f38edeb44..240b71f747 100644 --- a/lib/chef/provider/mount/aix.rb +++ b/lib/chef/provider/mount/aix.rb @@ -21,7 +21,7 @@ class Chef class Provider class Mount class Aix < Chef::Provider::Mount::Mount - provides :mount, platform: %w{aix} + provides :mount, platform: "aix" # Override for aix specific handling def initialize(new_resource, run_context) diff --git a/lib/chef/provider/osx_profile.rb b/lib/chef/provider/osx_profile.rb index 1d87f29eb2..326534c4bd 100644 --- a/lib/chef/provider/osx_profile.rb +++ b/lib/chef/provider/osx_profile.rb @@ -25,8 +25,8 @@ require "uuidtools" class Chef class Provider class OsxProfile < Chef::Provider - provides :osx_profile, os: "darwin" - provides :osx_config_profile, os: "darwin" + provides :osx_profile + provides :osx_config_profile def load_current_resource @current_resource = Chef::Resource::OsxProfile.new(new_resource.name) diff --git a/lib/chef/provider/package/apt.rb b/lib/chef/provider/package/apt.rb index d307ba5003..38dd7398c9 100644 --- a/lib/chef/provider/package/apt.rb +++ b/lib/chef/provider/package/apt.rb @@ -26,7 +26,7 @@ class Chef use_multipackage_api provides :package, platform_family: "debian" - provides :apt_package, os: "linux" + provides :apt_package def initialize(new_resource, run_context) super diff --git a/lib/chef/provider/package/chocolatey.rb b/lib/chef/provider/package/chocolatey.rb index 2932654962..a6abdd5b46 100644 --- a/lib/chef/provider/package/chocolatey.rb +++ b/lib/chef/provider/package/chocolatey.rb @@ -25,7 +25,7 @@ class Chef class Chocolatey < Chef::Provider::Package include Chef::Mixin::PowershellOut - provides :chocolatey_package, os: "windows" + provides :chocolatey_package # Declare that our arguments should be arrays use_multipackage_api diff --git a/lib/chef/provider/package/dpkg.rb b/lib/chef/provider/package/dpkg.rb index cf92e6d3e7..cc79f9fc3a 100644 --- a/lib/chef/provider/package/dpkg.rb +++ b/lib/chef/provider/package/dpkg.rb @@ -27,7 +27,7 @@ class Chef DPKG_INSTALLED = /^Status: install ok installed/ DPKG_VERSION = /^Version: (.+)$/ - provides :dpkg_package, os: "linux" + provides :dpkg_package use_multipackage_api use_package_name_for_source diff --git a/lib/chef/provider/package/ips.rb b/lib/chef/provider/package/ips.rb index d0c8bed175..255a4a2508 100644 --- a/lib/chef/provider/package/ips.rb +++ b/lib/chef/provider/package/ips.rb @@ -27,7 +27,7 @@ class Chef class Ips < Chef::Provider::Package provides :package, platform: %w{openindiana opensolaris omnios solaris2} - provides :ips_package, os: "solaris2" + provides :ips_package attr_accessor :virtual diff --git a/lib/chef/provider/package/msu.rb b/lib/chef/provider/package/msu.rb index 5c398149ba..8e00a10169 100644 --- a/lib/chef/provider/package/msu.rb +++ b/lib/chef/provider/package/msu.rb @@ -36,7 +36,7 @@ class Chef include Chef::Mixin::Uris include Chef::Mixin::Checksum - provides :msu_package, os: "windows" + provides :msu_package def load_current_resource @current_resource = Chef::Resource::MsuPackage.new(new_resource.name) diff --git a/lib/chef/provider/package/pacman.rb b/lib/chef/provider/package/pacman.rb index d1830bdefa..62460d6869 100644 --- a/lib/chef/provider/package/pacman.rb +++ b/lib/chef/provider/package/pacman.rb @@ -25,7 +25,7 @@ class Chef class Pacman < Chef::Provider::Package provides :package, platform: "arch" - provides :pacman_package, os: "linux" + provides :pacman_package def load_current_resource @current_resource = Chef::Resource::Package.new(new_resource.name) diff --git a/lib/chef/provider/package/paludis.rb b/lib/chef/provider/package/paludis.rb index 0b57d05adf..092c7a0d00 100644 --- a/lib/chef/provider/package/paludis.rb +++ b/lib/chef/provider/package/paludis.rb @@ -25,7 +25,7 @@ class Chef class Paludis < Chef::Provider::Package provides :package, platform: "exherbo" - provides :paludis_package, os: "linux" + provides :paludis_package def load_current_resource @current_resource = Chef::Resource::Package.new(new_resource.package_name) diff --git a/lib/chef/provider/package/powershell.rb b/lib/chef/provider/package/powershell.rb index f553aada0a..02ae114f55 100644 --- a/lib/chef/provider/package/powershell.rb +++ b/lib/chef/provider/package/powershell.rb @@ -25,7 +25,7 @@ class Chef class Powershell < Chef::Provider::Package include Chef::Mixin::PowershellOut - provides :powershell_package, os: "windows" + provides :powershell_package def load_current_resource @current_resource = Chef::Resource::PowershellPackage.new(new_resource.name) diff --git a/lib/chef/provider/package/rpm.rb b/lib/chef/provider/package/rpm.rb index 07617c814e..d3f9b2f5f0 100644 --- a/lib/chef/provider/package/rpm.rb +++ b/lib/chef/provider/package/rpm.rb @@ -24,8 +24,7 @@ class Chef class Provider class Package class Rpm < Chef::Provider::Package - - provides :rpm_package, os: %w{linux aix} + provides :rpm_package include Chef::Mixin::GetSourceFromPackage diff --git a/lib/chef/provider/package/smartos.rb b/lib/chef/provider/package/smartos.rb index 66d23554df..f18dc1e1e5 100644 --- a/lib/chef/provider/package/smartos.rb +++ b/lib/chef/provider/package/smartos.rb @@ -30,7 +30,7 @@ class Chef attr_accessor :is_virtual_package provides :package, platform: "smartos" - provides :smartos_package, platform_family: "smartos" + provides :smartos_package def load_current_resource Chef::Log.debug("#{new_resource} loading current resource") diff --git a/lib/chef/provider/package/solaris.rb b/lib/chef/provider/package/solaris.rb index f6e66c050a..86197023e0 100644 --- a/lib/chef/provider/package/solaris.rb +++ b/lib/chef/provider/package/solaris.rb @@ -28,7 +28,7 @@ class Chef provides :package, platform: "nexentacore" provides :package, platform: "solaris2", platform_version: "< 5.11" - provides :solaris_package, os: "solaris2" + provides :solaris_package # def initialize(*args) # super diff --git a/lib/chef/provider/package/zypper.rb b/lib/chef/provider/package/zypper.rb index 05e6dbd8fc..f12fa270ac 100644 --- a/lib/chef/provider/package/zypper.rb +++ b/lib/chef/provider/package/zypper.rb @@ -29,7 +29,7 @@ class Chef use_multipackage_api provides :package, platform_family: "suse" - provides :zypper_package, os: "linux" + provides :zypper_package def get_versions(package_name) candidate_version = current_version = nil diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb index 87705ef59a..ae14738bdf 100644 --- a/lib/chef/provider/powershell_script.rb +++ b/lib/chef/provider/powershell_script.rb @@ -23,7 +23,7 @@ class Chef class Provider class PowershellScript < Chef::Provider::WindowsScript - provides :powershell_script, os: "windows" + provides :powershell_script def initialize(new_resource, run_context) super(new_resource, run_context, ".ps1") diff --git a/lib/chef/provider/service/macosx.rb b/lib/chef/provider/service/macosx.rb index 9dc7b81a29..a0ae03a717 100644 --- a/lib/chef/provider/service/macosx.rb +++ b/lib/chef/provider/service/macosx.rb @@ -28,7 +28,7 @@ class Chef class Service class Macosx < Chef::Provider::Service::Simple - provides :macosx_service, os: "darwin" + provides :macosx_service provides :service, os: "darwin" def self.gather_plist_dirs diff --git a/lib/chef/provider/service/windows.rb b/lib/chef/provider/service/windows.rb index d370ecff51..ce84f7c4ee 100644 --- a/lib/chef/provider/service/windows.rb +++ b/lib/chef/provider/service/windows.rb @@ -27,7 +27,7 @@ end class Chef::Provider::Service::Windows < Chef::Provider::Service provides :service, os: "windows" - provides :windows_service, os: "windows" + provides :windows_service include Chef::Mixin::ShellOut include Chef::ReservedNames::Win32::API::Error rescue LoadError diff --git a/lib/chef/provider/systemd_unit.rb b/lib/chef/provider/systemd_unit.rb index 420438775c..18ea8ea92c 100644 --- a/lib/chef/provider/systemd_unit.rb +++ b/lib/chef/provider/systemd_unit.rb @@ -30,7 +30,7 @@ class Chef include Chef::Mixin::Which include Chef::Mixin::ShellOut - provides :systemd_unit, os: "linux" + provides :systemd_unit def load_current_resource @current_resource = Chef::Resource::SystemdUnit.new(new_resource.name) diff --git a/lib/chef/provider/windows_env.rb b/lib/chef/provider/windows_env.rb index b5b06666f3..085783d750 100644 --- a/lib/chef/provider/windows_env.rb +++ b/lib/chef/provider/windows_env.rb @@ -26,8 +26,8 @@ class Chef include Chef::Mixin::WindowsEnvHelper attr_accessor :key_exists - provides :env, os: "windows" - provides :windows_env, os: "windows" + provides :env + provides :windows_env def whyrun_supported? false diff --git a/lib/chef/provider/windows_task.rb b/lib/chef/provider/windows_task.rb index d8754e7d5d..c52d520373 100644 --- a/lib/chef/provider/windows_task.rb +++ b/lib/chef/provider/windows_task.rb @@ -27,7 +27,7 @@ class Chef include Chef::Mixin::ShellOut include Chef::Mixin::PowershellOut - provides :windows_task, os: "windows" + provides :windows_task def load_current_resource self.current_resource = Chef::Resource::WindowsTask.new(new_resource.name) diff --git a/lib/chef/resource/apt_package.rb b/lib/chef/resource/apt_package.rb index 22680d5b44..485210090d 100644 --- a/lib/chef/resource/apt_package.rb +++ b/lib/chef/resource/apt_package.rb @@ -17,7 +17,6 @@ # require "chef/resource/package" -require "chef/provider/package/apt" class Chef class Resource diff --git a/lib/chef/resource/batch.rb b/lib/chef/resource/batch.rb index 1c666a46ba..4e6d67aa2d 100644 --- a/lib/chef/resource/batch.rb +++ b/lib/chef/resource/batch.rb @@ -21,7 +21,7 @@ require "chef/resource/windows_script" class Chef class Resource class Batch < Chef::Resource::WindowsScript - provides :batch, os: "windows" + provides :batch description "Use the batch resource to execute a batch script using the cmd.exe"\ " interpreter on Windows. The batch resource creates and executes a"\ diff --git a/lib/chef/resource/cab_package.rb b/lib/chef/resource/cab_package.rb index 06c84fa559..7c5da016c9 100644 --- a/lib/chef/resource/cab_package.rb +++ b/lib/chef/resource/cab_package.rb @@ -25,7 +25,7 @@ class Chef include Chef::Mixin::Uris resource_name :cab_package - provides :cab_package, os: "windows" + provides :cab_package description "Use the cab_package resource to install or remove Microsoft Windows"\ " cabinet (.cab) packages." diff --git a/lib/chef/resource/chocolatey_package.rb b/lib/chef/resource/chocolatey_package.rb index dbd72b9dc7..cf8e67d708 100644 --- a/lib/chef/resource/chocolatey_package.rb +++ b/lib/chef/resource/chocolatey_package.rb @@ -22,7 +22,7 @@ class Chef class Resource class ChocolateyPackage < Chef::Resource::Package resource_name :chocolatey_package - provides :chocolatey_package, os: "windows" + 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/dnf_package.rb b/lib/chef/resource/dnf_package.rb index 08d19ff6b9..13bdc5065e 100644 --- a/lib/chef/resource/dnf_package.rb +++ b/lib/chef/resource/dnf_package.rb @@ -27,16 +27,6 @@ class Chef resource_name :dnf_package - description "Use the dnf_package resource to install, upgrade, and remove packages"\ - " with DNF for Fedora platforms. The dnf_package resource is able to"\ - " resolve provides data for packages much like DNF can do when it is"\ - " run from the command line. This allows a variety of options for"\ - " installing packages, like minimum versions, virtual provides,"\ - " and library names." - introduced "12.18" - - allowed_actions :install, :upgrade, :remove, :purge, :reconfig, :lock, :unlock, :flush_cache - # all rhel variants >= 8 will use DNF provides :package, platform_family: "rhel", platform_version: ">= 8" @@ -50,6 +40,16 @@ class Chef provides :dnf_package + description "Use the dnf_package resource to install, upgrade, and remove packages"\ + " with DNF for Fedora platforms. The dnf_package resource is able to"\ + " resolve provides data for packages much like DNF can do when it is"\ + " run from the command line. This allows a variety of options for"\ + " installing packages, like minimum versions, virtual provides,"\ + " and library names." + introduced "12.18" + + allowed_actions :install, :upgrade, :remove, :purge, :reconfig, :lock, :unlock, :flush_cache + # Install a specific arch property :arch, [String, Array], coerce: proc { |x| [x].flatten } diff --git a/lib/chef/resource/dpkg_package.rb b/lib/chef/resource/dpkg_package.rb index 488af8e1c9..bdf761888e 100644 --- a/lib/chef/resource/dpkg_package.rb +++ b/lib/chef/resource/dpkg_package.rb @@ -22,7 +22,7 @@ class Chef class Resource class DpkgPackage < Chef::Resource::Package resource_name :dpkg_package - provides :dpkg_package, os: "linux" + 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"\ diff --git a/lib/chef/resource/dsc_resource.rb b/lib/chef/resource/dsc_resource.rb index 3f7fc17901..d7e866b092 100644 --- a/lib/chef/resource/dsc_resource.rb +++ b/lib/chef/resource/dsc_resource.rb @@ -20,7 +20,8 @@ require "chef/dsl/powershell" class Chef class Resource class DscResource < Chef::Resource - provides :dsc_resource, os: "windows" + resource_name :dsc_resource + provides :dsc_resource description "The dsc_resource resource allows any DSC resource to be used in a"\ " Chef recipe, as well as any custom resources that have been added"\ diff --git a/lib/chef/resource/dsc_script.rb b/lib/chef/resource/dsc_script.rb index f64780e2bc..d10113be56 100644 --- a/lib/chef/resource/dsc_script.rb +++ b/lib/chef/resource/dsc_script.rb @@ -25,7 +25,7 @@ class Chef include Chef::DSL::Powershell resource_name :dsc_script - provides :dsc_script, os: "windows" + provides :dsc_script description "Many DSC resources are comparable to built-in Chef resources. For"\ " example, both DSC and Chef have file, package, and service resources."\ diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb index f8baedd082..f7313cae40 100644 --- a/lib/chef/resource/execute.rb +++ b/lib/chef/resource/execute.rb @@ -18,11 +18,12 @@ # require "chef/resource" -require "chef/provider/execute" class Chef class Resource class Execute < Chef::Resource + resource_name :execute + provides :execute identity_attr :command diff --git a/lib/chef/resource/hostname.rb b/lib/chef/resource/hostname.rb index dfc7ee2ff0..a863b14f1d 100644 --- a/lib/chef/resource/hostname.rb +++ b/lib/chef/resource/hostname.rb @@ -3,8 +3,8 @@ class Chef # Sets the hostname and updates /etc/hosts on *nix systems # @since 14.0.0 class Hostname < Chef::Resource - provides :hostname resource_name :hostname + provides :hostname description "Sets the systems hostname, ensures that reboot will preserve the hostname, and re-runs the ohai plugin so the hostname will be available in subsequent cookbooks." introduced "14.0" diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb index fd9e3636b1..6c890f2149 100644 --- a/lib/chef/resource/http_request.rb +++ b/lib/chef/resource/http_request.rb @@ -18,11 +18,12 @@ # require "chef/resource" -require "chef/provider/http_request" class Chef class Resource class HttpRequest < Chef::Resource + 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"\ diff --git a/lib/chef/resource/ips_package.rb b/lib/chef/resource/ips_package.rb index 079cc27231..70e3bfee81 100644 --- a/lib/chef/resource/ips_package.rb +++ b/lib/chef/resource/ips_package.rb @@ -24,7 +24,7 @@ class Chef class IpsPackage < ::Chef::Resource::Package resource_name :ips_package provides :package, os: "solaris2" - provides :ips_package, os: "solaris2" + provides :ips_package 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/launchd.rb b/lib/chef/resource/launchd.rb index bc1b7d48e8..1addffe404 100644 --- a/lib/chef/resource/launchd.rb +++ b/lib/chef/resource/launchd.rb @@ -22,7 +22,7 @@ class Chef class Resource class Launchd < Chef::Resource resource_name :launchd - provides :launchd, os: "darwin" + provides :launchd description "Use the launchd resource to manage system-wide services (daemons) and per-user services (agents) on the macOS platform." introduced "12.8" diff --git a/lib/chef/resource/macosx_service.rb b/lib/chef/resource/macosx_service.rb index 9a88e3bbfc..8fa8fd7a36 100644 --- a/lib/chef/resource/macosx_service.rb +++ b/lib/chef/resource/macosx_service.rb @@ -22,7 +22,7 @@ class Chef class Resource class MacosxService < Chef::Resource::Service resource_name :macosx_service - provides :macosx_service, os: "darwin" + provides :macosx_service provides :service, os: "darwin" description "Use the macosx_service resource to manage services on the macOS platform." diff --git a/lib/chef/resource/msu_package.rb b/lib/chef/resource/msu_package.rb index fd3290f90b..85ab170ee0 100644 --- a/lib/chef/resource/msu_package.rb +++ b/lib/chef/resource/msu_package.rb @@ -25,7 +25,7 @@ class Chef include Chef::Mixin::Uris resource_name :msu_package - provides :msu_package, os: "windows" + provides :msu_package description "Use the msu_package resource to install Microsoft Update(MSU) packages on Microsoft Windows machines." introduced "12.17" diff --git a/lib/chef/resource/osx_profile.rb b/lib/chef/resource/osx_profile.rb index cf857cec6f..612ff637e4 100644 --- a/lib/chef/resource/osx_profile.rb +++ b/lib/chef/resource/osx_profile.rb @@ -21,8 +21,9 @@ require "chef/resource" class Chef class Resource class OsxProfile < Chef::Resource - provides :osx_profile, os: "darwin" - provides :osx_config_profile, os: "darwin" + resource_name :osx_profile + provides :osx_profile + provides :osx_config_profile description "Use the osx_profile resource to manage configuration profiles (.mobileconfig files)"\ " on the macOS platform. The osx_profile resource installs profiles by using"\ diff --git a/lib/chef/resource/pacman_package.rb b/lib/chef/resource/pacman_package.rb index be86498ca2..4661b6f07d 100644 --- a/lib/chef/resource/pacman_package.rb +++ b/lib/chef/resource/pacman_package.rb @@ -22,7 +22,7 @@ class Chef class Resource class PacmanPackage < Chef::Resource::Package resource_name :pacman_package - provides :pacman_package, os: "linux" + provides :pacman_package description "Use the pacman_package resource to manage packages (using pacman) on the Arch Linux platform." end diff --git a/lib/chef/resource/paludis_package.rb b/lib/chef/resource/paludis_package.rb index df9c274298..15378cd2e5 100644 --- a/lib/chef/resource/paludis_package.rb +++ b/lib/chef/resource/paludis_package.rb @@ -23,7 +23,7 @@ class Chef class Resource class PaludisPackage < Chef::Resource::Package resource_name :paludis_package - provides :paludis_package, os: "linux" + provides :paludis_package description "Use the paludis_package resource to manage packages for the Paludis platform." introduced "12.1" diff --git a/lib/chef/resource/powershell_package.rb b/lib/chef/resource/powershell_package.rb index fb1034a6e5..f5ff99fff8 100644 --- a/lib/chef/resource/powershell_package.rb +++ b/lib/chef/resource/powershell_package.rb @@ -27,7 +27,7 @@ class Chef include Chef::Mixin::Uris resource_name :powershell_package - provides :powershell_package, os: "windows" + provides :powershell_package introduced "12.16" diff --git a/lib/chef/resource/rpm_package.rb b/lib/chef/resource/rpm_package.rb index 503f9abfda..4d79ba98d1 100644 --- a/lib/chef/resource/rpm_package.rb +++ b/lib/chef/resource/rpm_package.rb @@ -17,13 +17,12 @@ # require "chef/resource/package" -require "chef/provider/package/rpm" class Chef class Resource class RpmPackage < Chef::Resource::Package resource_name :rpm_package - provides :rpm_package, os: %w{linux aix} + provides :rpm_package description "Use the rpm_package resource to manage packages for the RPM Package Manager platform." diff --git a/lib/chef/resource/script.rb b/lib/chef/resource/script.rb index a7191360ca..7cadb843e5 100644 --- a/lib/chef/resource/script.rb +++ b/lib/chef/resource/script.rb @@ -18,7 +18,6 @@ # require "chef/resource/execute" -require "chef/provider/script" class Chef class Resource @@ -27,6 +26,8 @@ class Chef # 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. class Script < Chef::Resource::Execute + resource_name :script + identity_attr :name def initialize(name, run_context = nil) diff --git a/lib/chef/resource/smartos_package.rb b/lib/chef/resource/smartos_package.rb index c509438689..d9ef55c50f 100644 --- a/lib/chef/resource/smartos_package.rb +++ b/lib/chef/resource/smartos_package.rb @@ -17,13 +17,13 @@ # require "chef/resource/package" -require "chef/provider/package/smartos" class Chef class Resource class SmartosPackage < Chef::Resource::Package resource_name :smartos_package - provides :package, os: "solaris2", platform_family: "smartos" + provides :smartos_package + provides :package, platform_family: "smartos" description "Use the smartos_package resource to manage packages for the SmartOS platform." end diff --git a/lib/chef/resource/solaris_package.rb b/lib/chef/resource/solaris_package.rb index 77232b0642..435a6ecc44 100644 --- a/lib/chef/resource/solaris_package.rb +++ b/lib/chef/resource/solaris_package.rb @@ -18,12 +18,12 @@ # require "chef/resource/package" -require "chef/provider/package/solaris" class Chef class Resource class SolarisPackage < Chef::Resource::Package 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/subversion.rb b/lib/chef/resource/subversion.rb index 5fa730a6cb..59f7cd73fd 100644 --- a/lib/chef/resource/subversion.rb +++ b/lib/chef/resource/subversion.rb @@ -22,11 +22,11 @@ require "chef/resource/scm" class Chef class Resource class Subversion < Chef::Resource::Scm - allowed_actions :force_export - description "Use the subversion resource to manage source control resources that"\ " exist in a Subversion repository." + allowed_actions :force_export + def initialize(name, run_context = nil) super @svn_arguments = "--no-auth-cache" diff --git a/lib/chef/resource/template.rb b/lib/chef/resource/template.rb index 4b5b82effb..59e8a76937 100644 --- a/lib/chef/resource/template.rb +++ b/lib/chef/resource/template.rb @@ -19,7 +19,6 @@ # require "chef/resource/file" -require "chef/provider/template" require "chef/mixin/securable" class Chef @@ -34,6 +33,9 @@ class Chef # chef-client. This resource includes actions and properties from the file resource. Template files managed by the # template resource follow the same file specificity rules as the remote_file and file resources. class Template < Chef::Resource::File + resource_name :template + provides :template + include Chef::Mixin::Securable attr_reader :inline_helper_blocks diff --git a/lib/chef/resource/windows_env.rb b/lib/chef/resource/windows_env.rb index b970a397aa..5cb3c2aca6 100644 --- a/lib/chef/resource/windows_env.rb +++ b/lib/chef/resource/windows_env.rb @@ -23,8 +23,8 @@ class Chef class Resource class WindowsEnv < Chef::Resource resource_name :windows_env - provides :windows_env, os: "windows" - provides :env, os: "windows" + provides :windows_env + provides :env description "Use the env resource to manage environment keys in Microsoft Windows."\ " After an environment key is set, Microsoft Windows must be restarted"\ diff --git a/lib/chef/resource/windows_task.rb b/lib/chef/resource/windows_task.rb index 6f6b38e662..4e77b3ea8d 100644 --- a/lib/chef/resource/windows_task.rb +++ b/lib/chef/resource/windows_task.rb @@ -22,7 +22,7 @@ class Chef class Resource class WindowsTask < Chef::Resource resource_name :windows_task - provides :windows_task, os: "windows" + provides :windows_task 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/yum_package.rb b/lib/chef/resource/yum_package.rb index 078725e306..c20068cb06 100644 --- a/lib/chef/resource/yum_package.rb +++ b/lib/chef/resource/yum_package.rb @@ -22,7 +22,7 @@ class Chef class Resource class YumPackage < Chef::Resource::Package resource_name :yum_package - provides :package, os: "linux", platform_family: %w{rhel fedora amazon} + provides :package, platform_family: %w{rhel fedora amazon} # XXX: the coercions here are due to the provider promiscuously updating the properties on the # new_resource which causes immutable modification exceptions when passed an immutable node array. diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb index edc409fab0..ce9154cb72 100644 --- a/spec/unit/provider/service/windows_spec.rb +++ b/spec/unit/provider/service/windows_spec.rb @@ -20,7 +20,7 @@ require "spec_helper" require "mixlib/shellout" -describe Chef::Provider::Service::Windows, "load_current_resource" do +describe Chef::Provider::Service::Windows, "load_current_resource", :windows_only do include_context "Win32" let(:chef_service_name) { "chef-client" } |