summaryrefslogtreecommitdiff
path: root/lib/chef/resource
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/resource')
-rw-r--r--lib/chef/resource/action_class.rb (renamed from lib/chef/resource/action_provider.rb)16
-rw-r--r--lib/chef/resource/chef_gem.rb6
-rw-r--r--lib/chef/resource/execute.rb2
-rw-r--r--lib/chef/resource/file/verification.rb2
-rw-r--r--lib/chef/resource/lwrp_base.rb12
-rw-r--r--lib/chef/resource/script.rb2
-rw-r--r--lib/chef/resource/subversion.rb5
-rw-r--r--lib/chef/resource/windows_script.rb8
8 files changed, 38 insertions, 15 deletions
diff --git a/lib/chef/resource/action_provider.rb b/lib/chef/resource/action_class.rb
index d71b54ef4d..12211418e9 100644
--- a/lib/chef/resource/action_provider.rb
+++ b/lib/chef/resource/action_class.rb
@@ -20,7 +20,7 @@ require 'chef/exceptions'
class Chef
class Resource
- module ActionProvider
+ module ActionClass
#
# If load_current_value! is defined on the resource, use that.
#
@@ -63,6 +63,20 @@ class Chef
end
module ClassMethods
+ #
+ # The Chef::Resource class this ActionClass was declared against.
+ #
+ # @return [Class] The Chef::Resource class this ActionClass was declared against.
+ #
+ attr_accessor :resource_class
+
+ def to_s
+ "#{resource_class} action provider"
+ end
+
+ def inspect
+ to_s
+ end
end
end
end
diff --git a/lib/chef/resource/chef_gem.rb b/lib/chef/resource/chef_gem.rb
index 0c2fdfa819..7e9d21ebd2 100644
--- a/lib/chef/resource/chef_gem.rb
+++ b/lib/chef/resource/chef_gem.rb
@@ -50,9 +50,9 @@ class Chef
# Chef::Resource.run_action: Caveat: this skips Chef::Runner.run_action, where notifications are handled
# Action could be an array of symbols, but probably won't (think install + enable for a package)
if compile_time.nil?
- Chef::Log.deprecation "#{self} chef_gem compile_time installation is deprecated"
- Chef::Log.deprecation "#{self} Please set `compile_time false` on the resource to use the new behavior."
- Chef::Log.deprecation "#{self} or set `compile_time true` on the resource if compile_time behavior is required."
+ Chef.log_deprecation "#{self} chef_gem compile_time installation is deprecated"
+ Chef.log_deprecation "#{self} Please set `compile_time false` on the resource to use the new behavior."
+ Chef.log_deprecation "#{self} or set `compile_time true` on the resource if compile_time behavior is required."
end
if compile_time || compile_time.nil?
diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb
index ec669a75d3..11c4ae045c 100644
--- a/lib/chef/resource/execute.rb
+++ b/lib/chef/resource/execute.rb
@@ -102,7 +102,7 @@ class Chef
end
def path(arg=nil)
- Chef::Log.warn "'path' attribute of 'execute' is not used by any provider in Chef 11 and Chef 12. Use 'environment' attribute to configure 'PATH'. This attribute will be removed in Chef 13."
+ Chef::Log.warn "The 'path' attribute of 'execute' is not used by any provider in Chef 11 or Chef 12. Use 'environment' attribute to configure 'PATH'. This attribute will be removed in Chef 13."
set_or_return(
:path,
diff --git a/lib/chef/resource/file/verification.rb b/lib/chef/resource/file/verification.rb
index faf4791884..ba0bb08201 100644
--- a/lib/chef/resource/file/verification.rb
+++ b/lib/chef/resource/file/verification.rb
@@ -108,7 +108,7 @@ class Chef
def verify_command(path, opts)
# First implementation interpolated `file`; docs & RFC claim `path`
# is interpolated. Until `file` can be deprecated, interpolate both.
- Chef::Log.deprecation(
+ Chef.log_deprecation(
'%{file} is deprecated in verify command and will not be '\
'supported in Chef 13. Please use %{path} instead.'
) if @command.include?('%{file}')
diff --git a/lib/chef/resource/lwrp_base.rb b/lib/chef/resource/lwrp_base.rb
index 443e0ed819..a9a669f18c 100644
--- a/lib/chef/resource/lwrp_base.rb
+++ b/lib/chef/resource/lwrp_base.rb
@@ -1,8 +1,8 @@
#
-# Author:: Adam Jacob (<adam@opscode.com>)
-# Author:: Christopher Walters (<cw@opscode.com>)
-# Author:: Daniel DeLeo (<dan@opscode.com>)
-# Copyright:: Copyright (c) 2008-2012 Opscode, Inc.
+# Author:: Adam Jacob (<adam@chef.io>)
+# Author:: Christopher Walters (<cw@chef.io>)
+# Author:: Daniel DeLeo (<dan@chef.io>)
+# Copyright:: Copyright (c) 2008-2015 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -45,7 +45,7 @@ class Chef
def build_from_file(cookbook_name, filename, run_context)
if LWRPBase.loaded_lwrps[filename]
- Chef::Log.info("LWRP resource #{filename} from cookbook #{cookbook_name} has already been loaded! Skipping the reload.")
+ Chef::Log.info("Custom resource #{filename} from cookbook #{cookbook_name} has already been loaded! Skipping the reload.")
return loaded_lwrps[filename]
end
@@ -60,7 +60,7 @@ class Chef
# Make a useful string for the class (rather than <Class:312894723894>)
resource_class.instance_eval do
define_singleton_method(:to_s) do
- "LWRP resource #{resource_name} from cookbook #{cookbook_name}"
+ "Custom resource #{resource_name} from cookbook #{cookbook_name}"
end
define_singleton_method(:inspect) { to_s }
end
diff --git a/lib/chef/resource/script.rb b/lib/chef/resource/script.rb
index 30bed367cb..5081adf918 100644
--- a/lib/chef/resource/script.rb
+++ b/lib/chef/resource/script.rb
@@ -40,7 +40,7 @@ class Chef
unless arg.nil?
# Chef-13: change this to raise if the user is trying to set a value here
Chef::Log.warn "Specifying command attribute on a script resource is a coding error, use the 'code' attribute, or the execute resource"
- Chef::Log.warn "This attribute is deprecated and must be fixed or this code will fail on Chef-13"
+ Chef::Log.warn "This attribute is deprecated and must be fixed or this code will fail on Chef 13"
end
super
end
diff --git a/lib/chef/resource/subversion.rb b/lib/chef/resource/subversion.rb
index ae6a37caa2..a6f4cb4897 100644
--- a/lib/chef/resource/subversion.rb
+++ b/lib/chef/resource/subversion.rb
@@ -28,12 +28,17 @@ class Chef
super
@svn_arguments = '--no-auth-cache'
@svn_info_args = '--no-auth-cache'
+ @svn_binary = nil
end
# Override exception to strip password if any, so it won't appear in logs and different Chef notifications
def custom_exception_message(e)
"#{self} (#{defined_at}) had an error: #{e.class.name}: #{svn_password ? e.message.gsub(svn_password, "[hidden_password]") : e.message}"
end
+
+ def svn_binary(arg=nil)
+ set_or_return(:svn_binary, arg, :kind_of => [String])
+ end
end
end
end
diff --git a/lib/chef/resource/windows_script.rb b/lib/chef/resource/windows_script.rb
index 48e2b535a8..2bbd01d5aa 100644
--- a/lib/chef/resource/windows_script.rb
+++ b/lib/chef/resource/windows_script.rb
@@ -16,6 +16,7 @@
# limitations under the License.
#
+require 'chef/platform/query_helpers'
require 'chef/resource/script'
require 'chef/mixin/windows_architecture_helper'
@@ -51,9 +52,12 @@ class Chef
protected
def assert_architecture_compatible!(desired_architecture)
- if ! node_supports_windows_architecture?(node, desired_architecture)
+ if desired_architecture == :i386 && Chef::Platform.windows_nano_server?
raise Chef::Exceptions::Win32ArchitectureIncorrect,
- "cannot execute script with requested architecture '#{desired_architecture.to_s}' on a system with architecture '#{node_windows_architecture(node)}'"
+ "cannot execute script with requested architecture 'i386' on Windows Nano Server"
+ elsif ! node_supports_windows_architecture?(node, desired_architecture)
+ raise Chef::Exceptions::Win32ArchitectureIncorrect,
+ "cannot execute script with requested architecture '#{desired_architecture.to_s}' on a system with architecture '#{node_windows_architecture(node)}'"
end
end
end