diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-01-22 11:35:24 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-02-11 19:12:07 -0800 |
commit | b5243fb3a5151d65f3caa689d01a573809c441f2 (patch) | |
tree | d141879e7e0a76bbc25e8f84d803a2180a72c491 /lib/chef/api_client | |
parent | c8beebb0cc703c29dc9fedff59ee7959a9be1bf7 (diff) | |
download | chef-b5243fb3a5151d65f3caa689d01a573809c441f2.tar.gz |
allow dep injecting the http client
Diffstat (limited to 'lib/chef/api_client')
-rw-r--r-- | lib/chef/api_client/registration.rb | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/chef/api_client/registration.rb b/lib/chef/api_client/registration.rb index 8a5885eff3..de5fc7ac3d 100644 --- a/lib/chef/api_client/registration.rb +++ b/lib/chef/api_client/registration.rb @@ -33,9 +33,10 @@ class Chef attr_reader :destination attr_reader :name - def initialize(name, destination) - @name = name - @destination = destination + def initialize(name, destination, http_api: nil) + @name = name + @destination = destination + @http_api = http_api @server_generated_private_key = nil end @@ -120,11 +121,10 @@ class Chef post_data end - def http_api - @http_api_as_validator ||= Chef::REST.new(Chef::Config[:chef_server_url], - Chef::Config[:validation_client_name], - Chef::Config[:validation_key]) + @http_api ||= Chef::REST.new(Chef::Config[:chef_server_url], + Chef::Config[:validation_client_name], + Chef::Config[:validation_key]) end # Whether or not to generate keys locally and post the public key to the @@ -161,5 +161,3 @@ class Chef end end end - - |