summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2014-04-23 19:22:21 -0700
committerJohn Keiser <jkeiser@opscode.com>2014-04-24 08:53:22 -0700
commita84653e5f57109e3ac153ef686c9230da19da21d (patch)
tree1e573c750649c05bc4e4aaf824d73d0fae2ac1be /lib
parent57b259ee20c6d3f7a6b19b47955d7f669b457b88 (diff)
downloadchef-a84653e5f57109e3ac153ef686c9230da19da21d.tar.gz
Make it possible to include Chef::Provider / Chef::Resource
without circular dependencies or missing deps
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/dsl/recipe.rb5
-rw-r--r--lib/chef/platform/provider_mapping.rb674
-rw-r--r--lib/chef/provider.rb1
-rw-r--r--lib/chef/provider/service/arch.rb1
-rw-r--r--lib/chef/provider/service/debian.rb2
-rw-r--r--lib/chef/provider/service/freebsd.rb3
-rw-r--r--lib/chef/provider/service/gentoo.rb2
-rw-r--r--lib/chef/provider/service/init.rb1
-rw-r--r--lib/chef/provider/service/insserv.rb2
-rw-r--r--lib/chef/provider/service/invokercd.rb2
-rw-r--r--lib/chef/provider/service/macosx.rb3
-rw-r--r--lib/chef/provider/service/redhat.rb1
-rw-r--r--lib/chef/provider/service/simple.rb1
-rw-r--r--lib/chef/provider/service/solaris.rb1
-rw-r--r--lib/chef/provider/service/systemd.rb2
-rw-r--r--lib/chef/provider/service/upstart.rb2
-rw-r--r--lib/chef/provider/user/solaris.rb2
-rw-r--r--lib/chef/resource.rb1
18 files changed, 353 insertions, 353 deletions
diff --git a/lib/chef/dsl/recipe.rb b/lib/chef/dsl/recipe.rb
index ebf19c7f23..6846703f09 100644
--- a/lib/chef/dsl/recipe.rb
+++ b/lib/chef/dsl/recipe.rb
@@ -17,7 +17,6 @@
# limitations under the License.
#
-require 'chef/resource'
require 'chef/resource_platform_map'
require 'chef/mixin/convert_to_class_name'
@@ -152,6 +151,10 @@ class Chef
end
end
+# We require this at the BOTTOM of this file to avoid circular requires (it is used
+# at runtime but not load time)
+require 'chef/resource'
+
# **DEPRECATED**
# This used to be part of chef/mixin/recipe_definition_dsl_core. Load the file to activate the deprecation code.
require 'chef/mixin/recipe_definition_dsl_core'
diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb
index a773da550e..bf1aec8616 100644
--- a/lib/chef/platform/provider_mapping.rb
+++ b/lib/chef/platform/provider_mapping.rb
@@ -23,14 +23,8 @@ require 'chef/version_constraint/platform'
# This file depends on nearly every provider in chef, but requiring them
# directly causes circular requires resulting in uninitialized constant errors.
+# Therefore, we do the includes inline rather than up top.
require 'chef/provider'
-require 'chef/provider/log'
-require 'chef/provider/user'
-require 'chef/provider/group'
-require 'chef/provider/mount'
-require 'chef/provider/service'
-require 'chef/provider/package'
-require 'chef/provider/ifconfig'
class Chef
@@ -40,343 +34,347 @@ class Chef
attr_writer :platforms
def platforms
- @platforms ||= {
- :mac_os_x => {
- :default => {
- :package => Chef::Provider::Package::Macports,
- :service => Chef::Provider::Service::Macosx,
- :user => Chef::Provider::User::Dscl,
- :group => Chef::Provider::Group::Dscl
- }
- },
- :mac_os_x_server => {
- :default => {
- :package => Chef::Provider::Package::Macports,
- :service => Chef::Provider::Service::Macosx,
- :user => Chef::Provider::User::Dscl,
- :group => Chef::Provider::Group::Dscl
- }
- },
- :freebsd => {
- :default => {
- :group => Chef::Provider::Group::Pw,
- :package => Chef::Provider::Package::Freebsd,
- :service => Chef::Provider::Service::Freebsd,
- :user => Chef::Provider::User::Pw,
- :cron => Chef::Provider::Cron
- }
- },
- :ubuntu => {
- :default => {
- :package => Chef::Provider::Package::Apt,
- :service => Chef::Provider::Service::Debian,
- :cron => Chef::Provider::Cron,
- :mdadm => Chef::Provider::Mdadm
+ @platforms ||= begin
+ require 'chef/providers'
+
+ {
+ :mac_os_x => {
+ :default => {
+ :package => Chef::Provider::Package::Macports,
+ :service => Chef::Provider::Service::Macosx,
+ :user => Chef::Provider::User::Dscl,
+ :group => Chef::Provider::Group::Dscl
+ }
},
- ">= 11.10" => {
- :ifconfig => Chef::Provider::Ifconfig::Debian
- }
- },
- :gcel => {
- :default => {
- :package => Chef::Provider::Package::Apt,
- :service => Chef::Provider::Service::Debian,
- :cron => Chef::Provider::Cron,
- :mdadm => Chef::Provider::Mdadm
- }
- },
- :linaro => {
- :default => {
- :package => Chef::Provider::Package::Apt,
- :service => Chef::Provider::Service::Debian,
- :cron => Chef::Provider::Cron,
- :mdadm => Chef::Provider::Mdadm
- }
- },
- :raspbian => {
- :default => {
- :package => Chef::Provider::Package::Apt,
- :service => Chef::Provider::Service::Debian,
- :cron => Chef::Provider::Cron,
- :mdadm => Chef::Provider::Mdadm
- }
- },
- :linuxmint => {
- :default => {
- :package => Chef::Provider::Package::Apt,
- :service => Chef::Provider::Service::Upstart,
- :cron => Chef::Provider::Cron,
- :mdadm => Chef::Provider::Mdadm
- }
- },
- :debian => {
- :default => {
- :package => Chef::Provider::Package::Apt,
- :service => Chef::Provider::Service::Debian,
- :cron => Chef::Provider::Cron,
- :mdadm => Chef::Provider::Mdadm
+ :mac_os_x_server => {
+ :default => {
+ :package => Chef::Provider::Package::Macports,
+ :service => Chef::Provider::Service::Macosx,
+ :user => Chef::Provider::User::Dscl,
+ :group => Chef::Provider::Group::Dscl
+ }
},
- ">= 6.0" => {
- :service => Chef::Provider::Service::Insserv
+ :freebsd => {
+ :default => {
+ :group => Chef::Provider::Group::Pw,
+ :package => Chef::Provider::Package::Freebsd,
+ :service => Chef::Provider::Service::Freebsd,
+ :user => Chef::Provider::User::Pw,
+ :cron => Chef::Provider::Cron
+ }
+ },
+ :ubuntu => {
+ :default => {
+ :package => Chef::Provider::Package::Apt,
+ :service => Chef::Provider::Service::Debian,
+ :cron => Chef::Provider::Cron,
+ :mdadm => Chef::Provider::Mdadm
+ },
+ ">= 11.10" => {
+ :ifconfig => Chef::Provider::Ifconfig::Debian
+ }
+ },
+ :gcel => {
+ :default => {
+ :package => Chef::Provider::Package::Apt,
+ :service => Chef::Provider::Service::Debian,
+ :cron => Chef::Provider::Cron,
+ :mdadm => Chef::Provider::Mdadm
+ }
+ },
+ :linaro => {
+ :default => {
+ :package => Chef::Provider::Package::Apt,
+ :service => Chef::Provider::Service::Debian,
+ :cron => Chef::Provider::Cron,
+ :mdadm => Chef::Provider::Mdadm
+ }
+ },
+ :raspbian => {
+ :default => {
+ :package => Chef::Provider::Package::Apt,
+ :service => Chef::Provider::Service::Debian,
+ :cron => Chef::Provider::Cron,
+ :mdadm => Chef::Provider::Mdadm
+ }
+ },
+ :linuxmint => {
+ :default => {
+ :package => Chef::Provider::Package::Apt,
+ :service => Chef::Provider::Service::Upstart,
+ :cron => Chef::Provider::Cron,
+ :mdadm => Chef::Provider::Mdadm
+ }
+ },
+ :debian => {
+ :default => {
+ :package => Chef::Provider::Package::Apt,
+ :service => Chef::Provider::Service::Debian,
+ :cron => Chef::Provider::Cron,
+ :mdadm => Chef::Provider::Mdadm
+ },
+ ">= 6.0" => {
+ :service => Chef::Provider::Service::Insserv
+ },
+ ">= 7.0" => {
+ :ifconfig => Chef::Provider::Ifconfig::Debian
+ }
+ },
+ :xenserver => {
+ :default => {
+ :service => Chef::Provider::Service::Redhat,
+ :cron => Chef::Provider::Cron,
+ :package => Chef::Provider::Package::Yum,
+ :mdadm => Chef::Provider::Mdadm
+ }
+ },
+ :xcp => {
+ :default => {
+ :service => Chef::Provider::Service::Redhat,
+ :cron => Chef::Provider::Cron,
+ :package => Chef::Provider::Package::Yum,
+ :mdadm => Chef::Provider::Mdadm
+ }
+ },
+ :centos => {
+ :default => {
+ :service => Chef::Provider::Service::Redhat,
+ :cron => Chef::Provider::Cron,
+ :package => Chef::Provider::Package::Yum,
+ :mdadm => Chef::Provider::Mdadm,
+ :ifconfig => Chef::Provider::Ifconfig::Redhat
+ }
+ },
+ :amazon => {
+ :default => {
+ :service => Chef::Provider::Service::Redhat,
+ :cron => Chef::Provider::Cron,
+ :package => Chef::Provider::Package::Yum,
+ :mdadm => Chef::Provider::Mdadm
+ }
+ },
+ :scientific => {
+ :default => {
+ :service => Chef::Provider::Service::Redhat,
+ :cron => Chef::Provider::Cron,
+ :package => Chef::Provider::Package::Yum,
+ :mdadm => Chef::Provider::Mdadm
+ }
+ },
+ :fedora => {
+ :default => {
+ :service => Chef::Provider::Service::Redhat,
+ :cron => Chef::Provider::Cron,
+ :package => Chef::Provider::Package::Yum,
+ :mdadm => Chef::Provider::Mdadm,
+ :ifconfig => Chef::Provider::Ifconfig::Redhat
+ }
+ },
+ :opensuse => {
+ :default => {
+ :service => Chef::Provider::Service::Redhat,
+ :cron => Chef::Provider::Cron,
+ :package => Chef::Provider::Package::Zypper,
+ :group => Chef::Provider::Group::Suse
+ },
+ # Only OpenSuSE 12.3+ should use the Usermod group provider:
+ ">= 12.3" => {
+ :group => Chef::Provider::Group::Usermod
+ }
+ },
+ :suse => {
+ :default => {
+ :service => Chef::Provider::Service::Redhat,
+ :cron => Chef::Provider::Cron,
+ :package => Chef::Provider::Package::Zypper,
+ :group => Chef::Provider::Group::Suse
+ }
+ },
+ :oracle => {
+ :default => {
+ :service => Chef::Provider::Service::Redhat,
+ :cron => Chef::Provider::Cron,
+ :package => Chef::Provider::Package::Yum,
+ :mdadm => Chef::Provider::Mdadm
+ }
+ },
+ :redhat => {
+ :default => {
+ :service => Chef::Provider::Service::Redhat,
+ :cron => Chef::Provider::Cron,
+ :package => Chef::Provider::Package::Yum,
+ :mdadm => Chef::Provider::Mdadm,
+ :ifconfig => Chef::Provider::Ifconfig::Redhat
+ }
+ },
+ :ibm_powerkvm => {
+ :default => {
+ :service => Chef::Provider::Service::Redhat,
+ :cron => Chef::Provider::Cron,
+ :package => Chef::Provider::Package::Yum,
+ :mdadm => Chef::Provider::Mdadm,
+ :ifconfig => Chef::Provider::Ifconfig::Redhat
+ }
+ },
+ :gentoo => {
+ :default => {
+ :package => Chef::Provider::Package::Portage,
+ :service => Chef::Provider::Service::Gentoo,
+ :cron => Chef::Provider::Cron,
+ :mdadm => Chef::Provider::Mdadm
+ }
+ },
+ :arch => {
+ :default => {
+ :package => Chef::Provider::Package::Pacman,
+ :service => Chef::Provider::Service::Systemd,
+ :cron => Chef::Provider::Cron,
+ :mdadm => Chef::Provider::Mdadm
+ }
+ },
+ :mswin => {
+ :default => {
+ :env => Chef::Provider::Env::Windows,
+ :service => Chef::Provider::Service::Windows,
+ :user => Chef::Provider::User::Windows,
+ :group => Chef::Provider::Group::Windows,
+ :mount => Chef::Provider::Mount::Windows,
+ :batch => Chef::Provider::Batch,
+ :powershell_script => Chef::Provider::PowershellScript
+ }
+ },
+ :mingw32 => {
+ :default => {
+ :env => Chef::Provider::Env::Windows,
+ :service => Chef::Provider::Service::Windows,
+ :user => Chef::Provider::User::Windows,
+ :group => Chef::Provider::Group::Windows,
+ :mount => Chef::Provider::Mount::Windows,
+ :batch => Chef::Provider::Batch,
+ :powershell_script => Chef::Provider::PowershellScript
+ }
+ },
+ :windows => {
+ :default => {
+ :env => Chef::Provider::Env::Windows,
+ :service => Chef::Provider::Service::Windows,
+ :user => Chef::Provider::User::Windows,
+ :group => Chef::Provider::Group::Windows,
+ :mount => Chef::Provider::Mount::Windows,
+ :batch => Chef::Provider::Batch,
+ :powershell_script => Chef::Provider::PowershellScript
+ }
+ },
+ :solaris => {},
+ :openindiana => {
+ :default => {
+ :service => Chef::Provider::Service::Solaris,
+ :package => Chef::Provider::Package::Ips,
+ :cron => Chef::Provider::Cron::Solaris,
+ :group => Chef::Provider::Group::Usermod
+ }
+ },
+ :opensolaris => {
+ :default => {
+ :service => Chef::Provider::Service::Solaris,
+ :package => Chef::Provider::Package::Ips,
+ :cron => Chef::Provider::Cron::Solaris,
+ :group => Chef::Provider::Group::Usermod
+ }
+ },
+ :nexentacore => {
+ :default => {
+ :service => Chef::Provider::Service::Solaris,
+ :package => Chef::Provider::Package::Solaris,
+ :cron => Chef::Provider::Cron::Solaris,
+ :group => Chef::Provider::Group::Usermod
+ }
+ },
+ :omnios => {
+ :default => {
+ :service => Chef::Provider::Service::Solaris,
+ :package => Chef::Provider::Package::Ips,
+ :cron => Chef::Provider::Cron::Solaris,
+ :group => Chef::Provider::Group::Usermod,
+ :user => Chef::Provider::User::Solaris,
+ }
+ },
+ :solaris2 => {
+ :default => {
+ :service => Chef::Provider::Service::Solaris,
+ :package => Chef::Provider::Package::Ips,
+ :cron => Chef::Provider::Cron::Solaris,
+ :group => Chef::Provider::Group::Usermod,
+ :user => Chef::Provider::User::Solaris,
+ },
+ "< 5.11" => {
+ :service => Chef::Provider::Service::Solaris,
+ :package => Chef::Provider::Package::Solaris,
+ :cron => Chef::Provider::Cron::Solaris,
+ :group => Chef::Provider::Group::Usermod,
+ :user => Chef::Provider::User::Solaris,
+ }
+ },
+ :smartos => {
+ :default => {
+ :service => Chef::Provider::Service::Solaris,
+ :package => Chef::Provider::Package::SmartOS,
+ :cron => Chef::Provider::Cron::Solaris,
+ :group => Chef::Provider::Group::Usermod
+ }
+ },
+ :netbsd => {
+ :default => {
+ :service => Chef::Provider::Service::Freebsd,
+ :group => Chef::Provider::Group::Groupmod
+ }
+ },
+ :openbsd => {
+ :default => {
+ :group => Chef::Provider::Group::Usermod
+ }
+ },
+ :hpux => {
+ :default => {
+ :group => Chef::Provider::Group::Usermod
+ }
+ },
+ :aix => {
+ :default => {
+ :group => Chef::Provider::Group::Aix,
+ :mount => Chef::Provider::Mount::Aix,
+ :ifconfig => Chef::Provider::Ifconfig::Aix,
+ :cron => Chef::Provider::Cron::Aix,
+ :package => Chef::Provider::Package::Aix
+ }
},
- ">= 7.0" => {
- :ifconfig => Chef::Provider::Ifconfig::Debian
- }
- },
- :xenserver => {
- :default => {
- :service => Chef::Provider::Service::Redhat,
- :cron => Chef::Provider::Cron,
- :package => Chef::Provider::Package::Yum,
- :mdadm => Chef::Provider::Mdadm
- }
- },
- :xcp => {
- :default => {
- :service => Chef::Provider::Service::Redhat,
- :cron => Chef::Provider::Cron,
- :package => Chef::Provider::Package::Yum,
- :mdadm => Chef::Provider::Mdadm
- }
- },
- :centos => {
- :default => {
- :service => Chef::Provider::Service::Redhat,
- :cron => Chef::Provider::Cron,
- :package => Chef::Provider::Package::Yum,
- :mdadm => Chef::Provider::Mdadm,
- :ifconfig => Chef::Provider::Ifconfig::Redhat
- }
- },
- :amazon => {
- :default => {
- :service => Chef::Provider::Service::Redhat,
- :cron => Chef::Provider::Cron,
- :package => Chef::Provider::Package::Yum,
- :mdadm => Chef::Provider::Mdadm
- }
- },
- :scientific => {
- :default => {
- :service => Chef::Provider::Service::Redhat,
- :cron => Chef::Provider::Cron,
- :package => Chef::Provider::Package::Yum,
- :mdadm => Chef::Provider::Mdadm
- }
- },
- :fedora => {
- :default => {
- :service => Chef::Provider::Service::Redhat,
- :cron => Chef::Provider::Cron,
- :package => Chef::Provider::Package::Yum,
- :mdadm => Chef::Provider::Mdadm,
- :ifconfig => Chef::Provider::Ifconfig::Redhat
- }
- },
- :opensuse => {
- :default => {
- :service => Chef::Provider::Service::Redhat,
- :cron => Chef::Provider::Cron,
- :package => Chef::Provider::Package::Zypper,
- :group => Chef::Provider::Group::Suse
- },
- # Only OpenSuSE 12.3+ should use the Usermod group provider:
- ">= 12.3" => {
- :group => Chef::Provider::Group::Usermod
- }
- },
- :suse => {
- :default => {
- :service => Chef::Provider::Service::Redhat,
- :cron => Chef::Provider::Cron,
- :package => Chef::Provider::Package::Zypper,
- :group => Chef::Provider::Group::Suse
- }
- },
- :oracle => {
- :default => {
- :service => Chef::Provider::Service::Redhat,
- :cron => Chef::Provider::Cron,
- :package => Chef::Provider::Package::Yum,
- :mdadm => Chef::Provider::Mdadm
- }
- },
- :redhat => {
- :default => {
- :service => Chef::Provider::Service::Redhat,
- :cron => Chef::Provider::Cron,
- :package => Chef::Provider::Package::Yum,
- :mdadm => Chef::Provider::Mdadm,
- :ifconfig => Chef::Provider::Ifconfig::Redhat
- }
- },
- :ibm_powerkvm => {
- :default => {
- :service => Chef::Provider::Service::Redhat,
- :cron => Chef::Provider::Cron,
- :package => Chef::Provider::Package::Yum,
- :mdadm => Chef::Provider::Mdadm,
- :ifconfig => Chef::Provider::Ifconfig::Redhat
- }
- },
- :gentoo => {
- :default => {
- :package => Chef::Provider::Package::Portage,
- :service => Chef::Provider::Service::Gentoo,
- :cron => Chef::Provider::Cron,
- :mdadm => Chef::Provider::Mdadm
- }
- },
- :arch => {
- :default => {
- :package => Chef::Provider::Package::Pacman,
- :service => Chef::Provider::Service::Systemd,
- :cron => Chef::Provider::Cron,
- :mdadm => Chef::Provider::Mdadm
- }
- },
- :mswin => {
- :default => {
- :env => Chef::Provider::Env::Windows,
- :service => Chef::Provider::Service::Windows,
- :user => Chef::Provider::User::Windows,
- :group => Chef::Provider::Group::Windows,
- :mount => Chef::Provider::Mount::Windows,
- :batch => Chef::Provider::Batch,
- :powershell_script => Chef::Provider::PowershellScript
- }
- },
- :mingw32 => {
- :default => {
- :env => Chef::Provider::Env::Windows,
- :service => Chef::Provider::Service::Windows,
- :user => Chef::Provider::User::Windows,
- :group => Chef::Provider::Group::Windows,
- :mount => Chef::Provider::Mount::Windows,
- :batch => Chef::Provider::Batch,
- :powershell_script => Chef::Provider::PowershellScript
- }
- },
- :windows => {
- :default => {
- :env => Chef::Provider::Env::Windows,
- :service => Chef::Provider::Service::Windows,
- :user => Chef::Provider::User::Windows,
- :group => Chef::Provider::Group::Windows,
- :mount => Chef::Provider::Mount::Windows,
- :batch => Chef::Provider::Batch,
- :powershell_script => Chef::Provider::PowershellScript
- }
- },
- :solaris => {},
- :openindiana => {
- :default => {
- :service => Chef::Provider::Service::Solaris,
- :package => Chef::Provider::Package::Ips,
- :cron => Chef::Provider::Cron::Solaris,
- :group => Chef::Provider::Group::Usermod
- }
- },
- :opensolaris => {
- :default => {
- :service => Chef::Provider::Service::Solaris,
- :package => Chef::Provider::Package::Ips,
- :cron => Chef::Provider::Cron::Solaris,
- :group => Chef::Provider::Group::Usermod
- }
- },
- :nexentacore => {
- :default => {
- :service => Chef::Provider::Service::Solaris,
- :package => Chef::Provider::Package::Solaris,
- :cron => Chef::Provider::Cron::Solaris,
- :group => Chef::Provider::Group::Usermod
- }
- },
- :omnios => {
- :default => {
- :service => Chef::Provider::Service::Solaris,
- :package => Chef::Provider::Package::Ips,
- :cron => Chef::Provider::Cron::Solaris,
- :group => Chef::Provider::Group::Usermod,
- :user => Chef::Provider::User::Solaris,
- }
- },
- :solaris2 => {
- :default => {
- :service => Chef::Provider::Service::Solaris,
- :package => Chef::Provider::Package::Ips,
- :cron => Chef::Provider::Cron::Solaris,
- :group => Chef::Provider::Group::Usermod,
- :user => Chef::Provider::User::Solaris,
- },
- "< 5.11" => {
- :service => Chef::Provider::Service::Solaris,
- :package => Chef::Provider::Package::Solaris,
- :cron => Chef::Provider::Cron::Solaris,
- :group => Chef::Provider::Group::Usermod,
- :user => Chef::Provider::User::Solaris,
- }
- },
- :smartos => {
- :default => {
- :service => Chef::Provider::Service::Solaris,
- :package => Chef::Provider::Package::SmartOS,
- :cron => Chef::Provider::Cron::Solaris,
- :group => Chef::Provider::Group::Usermod
- }
- },
- :netbsd => {
- :default => {
- :service => Chef::Provider::Service::Freebsd,
- :group => Chef::Provider::Group::Groupmod
- }
- },
- :openbsd => {
- :default => {
- :group => Chef::Provider::Group::Usermod
- }
- },
- :hpux => {
- :default => {
- :group => Chef::Provider::Group::Usermod
- }
- },
- :aix => {
:default => {
- :group => Chef::Provider::Group::Aix,
- :mount => Chef::Provider::Mount::Aix,
- :ifconfig => Chef::Provider::Ifconfig::Aix,
- :cron => Chef::Provider::Cron::Aix,
- :package => Chef::Provider::Package::Aix
+ :file => Chef::Provider::File,
+ :directory => Chef::Provider::Directory,
+ :link => Chef::Provider::Link,
+ :template => Chef::Provider::Template,
+ :remote_directory => Chef::Provider::RemoteDirectory,
+ :execute => Chef::Provider::Execute,
+ :mount => Chef::Provider::Mount::Mount,
+ :script => Chef::Provider::Script,
+ :service => Chef::Provider::Service::Init,
+ :perl => Chef::Provider::Script,
+ :python => Chef::Provider::Script,
+ :ruby => Chef::Provider::Script,
+ :bash => Chef::Provider::Script,
+ :csh => Chef::Provider::Script,
+ :user => Chef::Provider::User::Useradd,
+ :group => Chef::Provider::Group::Gpasswd,
+ :http_request => Chef::Provider::HttpRequest,
+ :route => Chef::Provider::Route,
+ :ifconfig => Chef::Provider::Ifconfig,
+ :ruby_block => Chef::Provider::RubyBlock,
+ :whyrun_safe_ruby_block => Chef::Provider::WhyrunSafeRubyBlock,
+ :erl_call => Chef::Provider::ErlCall,
+ :log => Chef::Provider::Log::ChefLog
}
- },
- :default => {
- :file => Chef::Provider::File,
- :directory => Chef::Provider::Directory,
- :link => Chef::Provider::Link,
- :template => Chef::Provider::Template,
- :remote_directory => Chef::Provider::RemoteDirectory,
- :execute => Chef::Provider::Execute,
- :mount => Chef::Provider::Mount::Mount,
- :script => Chef::Provider::Script,
- :service => Chef::Provider::Service::Init,
- :perl => Chef::Provider::Script,
- :python => Chef::Provider::Script,
- :ruby => Chef::Provider::Script,
- :bash => Chef::Provider::Script,
- :csh => Chef::Provider::Script,
- :user => Chef::Provider::User::Useradd,
- :group => Chef::Provider::Group::Gpasswd,
- :http_request => Chef::Provider::HttpRequest,
- :route => Chef::Provider::Route,
- :ifconfig => Chef::Provider::Ifconfig,
- :ruby_block => Chef::Provider::RubyBlock,
- :whyrun_safe_ruby_block => Chef::Provider::WhyrunSafeRubyBlock,
- :erl_call => Chef::Provider::ErlCall,
- :log => Chef::Provider::Log::ChefLog
}
- }
+ end
end
include Chef::Mixin::ParamsValidate
diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb
index 152a067f03..90b6ead716 100644
--- a/lib/chef/provider.rb
+++ b/lib/chef/provider.rb
@@ -22,6 +22,7 @@ require 'chef/mixin/convert_to_class_name'
require 'chef/dsl/recipe'
require 'chef/mixin/enforce_ownership_and_permissions'
require 'chef/mixin/why_run'
+
class Chef
class Provider
include Chef::DSL::Recipe
diff --git a/lib/chef/provider/service/arch.rb b/lib/chef/provider/service/arch.rb
index 8c8216c37f..9be5fb6fe3 100644
--- a/lib/chef/provider/service/arch.rb
+++ b/lib/chef/provider/service/arch.rb
@@ -17,7 +17,6 @@
#
require 'chef/provider/service/init'
-require 'chef/mixin/command'
class Chef::Provider::Service::Arch < Chef::Provider::Service::Init
diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb
index 2c3dda55c4..06fe7fc480 100644
--- a/lib/chef/provider/service/debian.rb
+++ b/lib/chef/provider/service/debian.rb
@@ -16,9 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service'
require 'chef/provider/service/init'
-require 'chef/mixin/command'
class Chef
class Provider
diff --git a/lib/chef/provider/service/freebsd.rb b/lib/chef/provider/service/freebsd.rb
index cb0f6b0fc4..7da29851c2 100644
--- a/lib/chef/provider/service/freebsd.rb
+++ b/lib/chef/provider/service/freebsd.rb
@@ -17,7 +17,8 @@
#
require 'chef/mixin/shell_out'
-require 'chef/provider/service'
+require 'chef/resource/service'
+require 'chef/provider/service/init'
require 'chef/mixin/command'
class Chef
diff --git a/lib/chef/provider/service/gentoo.rb b/lib/chef/provider/service/gentoo.rb
index ba4edc5807..1559c7893f 100644
--- a/lib/chef/provider/service/gentoo.rb
+++ b/lib/chef/provider/service/gentoo.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/provider/service'
+require 'chef/provider/service/init'
require 'chef/mixin/command'
class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init
diff --git a/lib/chef/provider/service/init.rb b/lib/chef/provider/service/init.rb
index 63ba8fa6ab..64f4074d8b 100644
--- a/lib/chef/provider/service/init.rb
+++ b/lib/chef/provider/service/init.rb
@@ -17,7 +17,6 @@
#
require 'chef/mixin/shell_out'
-require 'chef/provider/service'
require 'chef/provider/service/simple'
require 'chef/mixin/command'
diff --git a/lib/chef/provider/service/insserv.rb b/lib/chef/provider/service/insserv.rb
index cb9c28e17e..35767ee7b9 100644
--- a/lib/chef/provider/service/insserv.rb
+++ b/lib/chef/provider/service/insserv.rb
@@ -16,9 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service'
require 'chef/provider/service/init'
-require 'chef/mixin/command'
class Chef
class Provider
diff --git a/lib/chef/provider/service/invokercd.rb b/lib/chef/provider/service/invokercd.rb
index ee2719d75a..e6afa7272a 100644
--- a/lib/chef/provider/service/invokercd.rb
+++ b/lib/chef/provider/service/invokercd.rb
@@ -16,9 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service'
require 'chef/provider/service/init'
-require 'chef/mixin/command'
class Chef
class Provider
diff --git a/lib/chef/provider/service/macosx.rb b/lib/chef/provider/service/macosx.rb
index 8a8eb62263..2642a7e204 100644
--- a/lib/chef/provider/service/macosx.rb
+++ b/lib/chef/provider/service/macosx.rb
@@ -16,8 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/service'
require 'rexml/document'
+require 'chef/resource/service'
+require 'chef/provider/service/simple'
class Chef
class Provider
diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb
index 06be9f3207..5275bcac29 100644
--- a/lib/chef/provider/service/redhat.rb
+++ b/lib/chef/provider/service/redhat.rb
@@ -16,7 +16,6 @@
# limitations under the License.
#
-require 'chef/provider/service'
require 'chef/provider/service/init'
require 'chef/mixin/shell_out'
diff --git a/lib/chef/provider/service/simple.rb b/lib/chef/provider/service/simple.rb
index 288b5f5456..3b3e539d40 100644
--- a/lib/chef/provider/service/simple.rb
+++ b/lib/chef/provider/service/simple.rb
@@ -18,6 +18,7 @@
require 'chef/mixin/shell_out'
require 'chef/provider/service'
+require 'chef/resource/service'
require 'chef/mixin/command'
class Chef
diff --git a/lib/chef/provider/service/solaris.rb b/lib/chef/provider/service/solaris.rb
index 7f06ac561b..05a91eb756 100644
--- a/lib/chef/provider/service/solaris.rb
+++ b/lib/chef/provider/service/solaris.rb
@@ -18,6 +18,7 @@
require 'chef/mixin/shell_out'
require 'chef/provider/service'
+require 'chef/resource/service'
require 'chef/mixin/command'
class Chef
diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb
index 89077c5feb..0871178c83 100644
--- a/lib/chef/provider/service/systemd.rb
+++ b/lib/chef/provider/service/systemd.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service'
+require 'chef/resource/service'
require 'chef/provider/service/simple'
require 'chef/mixin/command'
diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb
index 67ca649b6d..98780e4b72 100644
--- a/lib/chef/provider/service/upstart.rb
+++ b/lib/chef/provider/service/upstart.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service'
+require 'chef/resource/service'
require 'chef/provider/service/simple'
require 'chef/mixin/command'
require 'chef/util/file_edit'
diff --git a/lib/chef/provider/user/solaris.rb b/lib/chef/provider/user/solaris.rb
index 0658981908..df491ac697 100644
--- a/lib/chef/provider/user/solaris.rb
+++ b/lib/chef/provider/user/solaris.rb
@@ -16,6 +16,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+require 'chef/provider/user/useradd'
+
class Chef
class Provider
class User
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index 7d96b26b4b..9370f34d56 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -29,6 +29,7 @@ require 'chef/resource/conditional_action_not_nothing'
require 'chef/resource_collection'
require 'chef/resource_platform_map'
require 'chef/node'
+require 'chef/platform'
require 'chef/mixin/deprecation'