diff options
author | Adam Edwards <adamed@opscode.com> | 2014-03-18 22:30:46 -0700 |
---|---|---|
committer | Adam Edwards <adamed@opscode.com> | 2014-03-29 00:21:01 -0700 |
commit | 636ac12b8c75c4e610b955dc1b41a8efb582fd94 (patch) | |
tree | f52517b015f7e1ea0cdb96567620911691eeeae4 | |
parent | 7519f3461c885f742bf6efa30f75eaf88d5fc2e2 (diff) | |
download | chef-636ac12b8c75c4e610b955dc1b41a8efb582fd94.tar.gz |
Refactor to move inheritance to script and derived resources
-rw-r--r-- | lib/chef/resource.rb | 8 | ||||
-rw-r--r-- | lib/chef/resource/execute.rb | 13 | ||||
-rw-r--r-- | lib/chef/resource/script.rb | 10 |
3 files changed, 15 insertions, 16 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index c98c4842c2..5db03ccf02 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -121,7 +121,7 @@ F end FORBIDDEN_IVARS = [:@run_context, :@node, :@not_if, :@only_if, :@enclosing_provider] - HIDDEN_IVARS = [:@allowed_actions, :@resource_name, :@source_line, :@run_context, :@name, :@node, :@not_if, :@only_if, :@guard_inherited_attributes, :@elapsed_time, :@enclosing_provider] + HIDDEN_IVARS = [:@allowed_actions, :@resource_name, :@source_line, :@run_context, :@name, :@node, :@not_if, :@only_if, :@elapsed_time, :@enclosing_provider] include Chef::DSL::DataQuery include Chef::Mixin::ParamsValidate @@ -251,7 +251,6 @@ F @not_if = [] @only_if = [] @guard_interpreter = :default - @guard_inherited_attributes = [] @source_line = nil @elapsed_time = 0 @@ -819,11 +818,6 @@ F resource = resource_for_platform(short_name, platform, version) resource end - protected - - def append_guard_inherited_attributes(inherited_attributes) - @guard_inherited_attributes.concat(inherited_attributes) - end private diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb index 8715871cfc..c51e534dec 100644 --- a/lib/chef/resource/execute.rb +++ b/lib/chef/resource/execute.rb @@ -41,15 +41,6 @@ class Chef @user = nil @allowed_actions.push(:run) @umask = nil - append_guard_inherited_attributes( - [ - :cwd, - :environment, - :group, - :path, - :user, - :umask - ]) end def umask(arg=nil) @@ -134,7 +125,11 @@ class Chef ) end + protected + def append_guard_inherited_attributes(inherited_attributes) + @guard_inherited_attributes.concat(inherited_attributes) + end end end diff --git a/lib/chef/resource/script.rb b/lib/chef/resource/script.rb index 8cc9c6f0c5..7d56d1d0c6 100644 --- a/lib/chef/resource/script.rb +++ b/lib/chef/resource/script.rb @@ -32,6 +32,16 @@ class Chef @code = nil @interpreter = nil @flags = nil + @guard_inherited_attributes = [] + append_guard_inherited_attributes( + [ + :cwd, + :environment, + :group, + :path, + :user, + :umask + ]) end def code(arg=nil) |