diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-01-15 15:05:59 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-02-11 19:12:06 -0800 |
commit | 728717d1b5e489f82526b8390ab42846939392ee (patch) | |
tree | 770ffa29ce7464791352e2fd5864083b686f1226 /lib/chef/role.rb | |
parent | 3743da85e48f2fc57e48ed62c014c1070bb69f38 (diff) | |
download | chef-728717d1b5e489f82526b8390ab42846939392ee.tar.gz |
allow dep injecting chef_server_rest into objects
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 |