Class: Berkshelf::API::CacheBuilder::Worker::ChefServer
- Defined in:
- lib/berkshelf/api/cache_builder/worker/chef_server.rb
Instance Attribute Summary collapse
- #url ⇒ String readonly
Attributes inherited from Base
Instance Method Summary collapse
-
#cookbooks ⇒ Array<RemoteCookbook>
The list of cookbooks this builder can find.
-
#initialize(options = {}) ⇒ ChefServer
constructor
A new instance of ChefServer.
- #metadata(remote) ⇒ Ridley::Chef::Cookbook::Metadata
- #to_s ⇒ String
Methods inherited from Base
Methods included from Mixin::Services
Methods included from Logging
Constructor Details
#initialize(options = {}) ⇒ ChefServer
Returns a new instance of ChefServer.
20 21 22 23 24 25 |
# File 'lib/berkshelf/api/cache_builder/worker/chef_server.rb', line 20 def initialize( = {}) @url = [:url] @connection = Ridley::Client.new_link(server_url: url, client_key: [:client_key], client_name: [:client_name], ssl: { verify: [:ssl_verify] }) super end |
Instance Attribute Details
#url ⇒ String (readonly)
10 11 12 |
# File 'lib/berkshelf/api/cache_builder/worker/chef_server.rb', line 10 def url @url end |
Instance Method Details
#cookbooks ⇒ Array<RemoteCookbook>
Returns The list of cookbooks this builder can find.
34 35 36 37 38 39 40 41 42 43 |
# 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) ⇒ Ridley::Chef::Cookbook::Metadata
48 49 50 51 |
# File 'lib/berkshelf/api/cache_builder/worker/chef_server.rb', line 48 def (remote) = connection.cookbook.find(remote.name, remote.version). Ridley::Chef::Cookbook::Metadata.from_hash() end |
#to_s ⇒ String
28 29 30 |
# File 'lib/berkshelf/api/cache_builder/worker/chef_server.rb', line 28 def to_s friendly_name(url) end |