class ChefDK::Policyfile::ArchivedCookbook

Public Class Methods

new(archived_lock, storage_config) click to toggle source
# File lib/chef-dk/policyfile/cookbook_locks.rb, line 433
def initialize(archived_lock, storage_config)
  @archived_lock = archived_lock
  @storage_config = storage_config
end

Public Instance Methods

build_from_lock_data(lock_data) click to toggle source
# File lib/chef-dk/policyfile/cookbook_locks.rb, line 438
def build_from_lock_data(lock_data)
  raise NotImplementedError, "ArchivedCookbook cannot be built from lock data, it can only wrap an existing lock object"
end
cookbook_path() click to toggle source

The cookbook is assumed to be stored in a Chef Zero compatible repo as created by `chef export`. Currently that only creates “compatibility mode” repos since Chef Zero doesn't yet support cookbook_artifact APIs. So the cookbook will be located in a path like:

cookbooks/nginx-111.222.333
# File lib/chef-dk/policyfile/cookbook_locks.rb, line 451
def cookbook_path
  File.join(relative_paths_root, "cookbook_artifacts", "#{name}-#{identifier}")
end
installed?() click to toggle source
# File lib/chef-dk/policyfile/cookbook_locks.rb, line 442
def installed?
  File.exist?(cookbook_path) && File.directory?(cookbook_path)
end
refresh!() click to toggle source

We trust that archived cookbooks haven't been modified, so just return true for refresh!

# File lib/chef-dk/policyfile/cookbook_locks.rb, line 463
def refresh!
  true
end
validate!() click to toggle source

We trust that archived cookbooks haven't been modified, so just return true for validate!

# File lib/chef-dk/policyfile/cookbook_locks.rb, line 457
def validate!
  true
end