chef 0.9.2 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chef/resource.rb +10 -4
- data/lib/chef/version.rb +1 -1
- metadata +2 -2
data/lib/chef/resource.rb
CHANGED
@@ -24,14 +24,17 @@ require 'chef/mixin/convert_to_class_name'
|
|
24
24
|
require 'chef/resource_collection'
|
25
25
|
require 'chef/node'
|
26
26
|
|
27
|
+
require 'chef/mixin/deprecation'
|
28
|
+
|
27
29
|
class Chef
|
28
30
|
class Resource
|
29
31
|
HIDDEN_IVARS = [:@allowed_actions, :@resource_name, :@source_line, :@run_context, :@name]
|
30
|
-
|
32
|
+
|
31
33
|
include Chef::Mixin::CheckHelper
|
32
34
|
include Chef::Mixin::ParamsValidate
|
33
35
|
include Chef::Mixin::Language
|
34
36
|
include Chef::Mixin::ConvertToClassName
|
37
|
+
include Chef::Mixin::Deprecation
|
35
38
|
|
36
39
|
attr_accessor :params, :provider, :updated, :allowed_actions, :run_context, :cookbook_name, :recipe_name, :enclosing_provider
|
37
40
|
attr_accessor :source_line
|
@@ -60,6 +63,8 @@ class Chef
|
|
60
63
|
@notifies_immediate = Array.new
|
61
64
|
@notifies_delayed = Array.new
|
62
65
|
@source_line = nil
|
66
|
+
|
67
|
+
@node = run_context ? deprecated_ivar(run_context.node, :node, :warn) : nil
|
63
68
|
end
|
64
69
|
|
65
70
|
def node
|
@@ -237,9 +242,10 @@ class Chef
|
|
237
242
|
def to_hash
|
238
243
|
instance_vars = Hash.new
|
239
244
|
self.instance_variables.each do |iv|
|
240
|
-
iv = iv.to_s
|
241
|
-
next if iv == "@run_context"
|
242
|
-
|
245
|
+
#iv = iv.to_s
|
246
|
+
#next if iv == "@run_context"
|
247
|
+
key = iv.to_s.sub(/^@/,'').to_sym
|
248
|
+
instance_vars[key] = self.instance_variable_get(iv) unless (key == :run_context) || (key == :node)
|
243
249
|
end
|
244
250
|
instance_vars
|
245
251
|
end
|
data/lib/chef/version.rb
CHANGED