diff options
Diffstat (limited to 'lib/chef/role.rb')
-rw-r--r-- | lib/chef/role.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/role.rb b/lib/chef/role.rb index 4b4669f4b5..4e4b2aaf80 100644 --- a/lib/chef/role.rb +++ b/lib/chef/role.rb @@ -32,17 +32,20 @@ class Chef include Chef::Mixin::FromFile include Chef::Mixin::ParamsValidate + attr_accessor :chef_server_rest + # Create a new Chef::Role object. - def initialize + def initialize(chef_server_rest: nil) @name = '' @description = '' @default_attributes = Mash.new @override_attributes = Mash.new @env_run_lists = {"_default" => Chef::RunList.new} + @chef_server_rest = chef_server_rest 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 def self.chef_server_rest |