module ChefPlugin::ConnectionHelper
Public Instance Methods
get_connection()
click to toggle source
# 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