diff options
author | Claire McQuin <claire@getchef.com> | 2014-12-18 19:14:33 -0800 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-12-18 19:14:33 -0800 |
commit | c84f600dbd2ce5c55aa83f22ff78f149aecbbbd9 (patch) | |
tree | 11c699b0b74a531e79d44337803c062fb3e59ace /lib/chef/search | |
parent | f08e31446bef0270510f12243858f37eb8e06797 (diff) | |
download | chef-c84f600dbd2ce5c55aa83f22ff78f149aecbbbd9.tar.gz |
Add optional config parameter.
Diffstat (limited to 'lib/chef/search')
-rw-r--r-- | lib/chef/search/query.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/chef/search/query.rb b/lib/chef/search/query.rb index 23763ca59f..1d0e4ee122 100644 --- a/lib/chef/search/query.rb +++ b/lib/chef/search/query.rb @@ -27,10 +27,16 @@ class Chef class Search class Query - attr_accessor :rest + attr_accessor :config, :rest + private :config - def initialize(url=nil) - @rest = Chef::REST.new(url || Chef::Config[:chef_server_url]) + def initialize(url=nil, config:Chef::Config) + @config = config + @url = url + end + + def rest + @rest ||= Chef::REST.new(@url || @config[:chef_server_url]) end # Backwards compatability for cookbooks. |