class Berkshelf::API::CacheBuilder::Worker::ChefServer
Attributes
connection[R]
url[R]
@return [String]
Public Class Methods
new(options = {})
click to toggle source
@option options [String] :url
the URL of the target Chef Server
@option options [String] :client_name
the name of the client for authenticating to the Chef Server
@option options [String] :client_key
a client key for authenticating to the Chef Server
@option options [Boolean] :ssl_verify
turn ssl verification off if you have an unsigned SSL certificate
Calls superclass method
Berkshelf::API::CacheBuilder::Worker::Base::new
# File lib/berkshelf/api/cache_builder/worker/chef_server.rb, line 20 def initialize(options = {}) @url = options[:url] @connection = Ridley::Client.new_link(server_url: url, client_key: options[:client_key], client_name: options[:client_name], ssl: { verify: options[:ssl_verify] }) super end
Public Instance Methods
cookbooks()
click to toggle source
@return [Array<RemoteCookbook>]
The list of cookbooks this builder can find
# File lib/berkshelf/api/cache_builder/worker/chef_server.rb, line 34 def cookbooks [].tap do |cookbook_versions| connection.cookbook.all.each do |cookbook, versions| versions.each do |version| cookbook_versions << RemoteCookbook.new(cookbook, version, self.class.worker_type, @connection.server_url, priority) end end end end
metadata(remote)
click to toggle source
@param [RemoteCookbook] remote
@return [Ridley::Chef::Cookbook::Metadata]
# File lib/berkshelf/api/cache_builder/worker/chef_server.rb, line 48 def metadata(remote) metadata_hash = connection.cookbook.find(remote.name, remote.version).metadata Ridley::Chef::Cookbook::Metadata.from_hash(metadata_hash) end
to_s()
click to toggle source
@return [String]
# File lib/berkshelf/api/cache_builder/worker/chef_server.rb, line 28 def to_s friendly_name(url) end
Private Instance Methods
finalize_callback()
click to toggle source
# File lib/berkshelf/api/cache_builder/worker/chef_server.rb, line 57 def finalize_callback connection.terminate if connection && connection.alive? end