summaryrefslogtreecommitdiff
path: root/lib/chef/node.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/node.rb')
-rw-r--r--lib/chef/node.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/node.rb b/lib/chef/node.rb
index 6055f0e1e9..f9f6416f14 100644
--- a/lib/chef/node.rb
+++ b/lib/chef/node.rb
@@ -47,6 +47,8 @@ class Chef
attr_accessor :recipe_list, :run_state, :override_runlist
+ attr_accessor :chef_server_rest
+
# RunContext will set itself as run_context via this setter when
# initialized. This is needed so DSL::IncludeAttribute (in particular,
# #include_recipe) can access the run_context to determine if an attributes
@@ -62,7 +64,8 @@ class Chef
include Chef::Mixin::ParamsValidate
# Create a new Chef::Node object.
- def initialize
+ def initialize(chef_server_rest: nil)
+ @chef_server_rest = chef_server_rest
@name = nil
@chef_environment = '_default'
@@ -80,7 +83,7 @@ class Chef
end
def chef_server_rest
- Chef::REST.new(Chef::Config[:chef_server_url])
+ @chef_server_rest ||= Chef::REST.new(Chef::Config[:chef_server_url])
end
# Set the name of this Node, or return the current name.