Method: Chef::CookbookUploader#initialize

Defined in:
lib/chef/cookbook_uploader.rb

#initialize(cookbooks, opts = {}) ⇒ CookbookUploader

Creates a new CookbookUploader.

Arguments:

  • cookbooks:

    A Chef::CookbookVersion or array of them describing the cookbook(s) to be uploaded

  • path:

    A String or Array of Strings representing the base paths to the cookbook repositories.

  • opts:

    (optional) An options Hash

Options:

  • :force indicates that the uploader should set the force option when

    uploading the cookbook. This allows frozen CookbookVersion
    documents on the server to be overwritten (otherwise a 409 is
    returned by the server)
    
  • :rest A Chef::ServerAPI object that you have configured the way you like it.

    If you don't provide this, one will be created using the values
    in Chef::Config.
    
  • :concurrency An integer that decided how many threads will be used to

    perform concurrent uploads
    

39
40
41
42
43
44
45
# File 'lib/chef/cookbook_uploader.rb', line 39

def initialize(cookbooks, opts = {})
  @opts = opts
  @cookbooks = Array(cookbooks)
  @rest = opts[:rest] || Chef::ServerAPI.new(Chef::Config[:chef_server_url], version_class: Chef::CookbookManifestVersions)
  @concurrency = opts[:concurrency] || 10
  @policy_mode = opts[:policy_mode] || false
end