5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/smart_proxy_chef_plugin/connection_helper.rb', line 5
def get_connection
connection = ::ChefAPI::Connection.new(
:endpoint => ChefPlugin::Plugin.settings.chef_server_url,
:client => ChefPlugin::Plugin.settings.chef_smartproxy_clientname,
:key => ChefPlugin::Plugin.settings.chef_smartproxy_privatekey,
)
connection.ssl_verify = ChefPlugin::Plugin.settings.chef_ssl_verify
self_signed = ChefPlugin::Plugin.settings.chef_ssl_pem_file
if !self_signed.nil? && !self_signed.empty?
connection.ssl_pem_file = self_signed
end
connection
rescue => e
logger.error "Unable to establish a connection to chef server because of #{e.message}"
raise e
end
|