Class: ChefDK::Policyfile::ArchivedCookbook
- Inherits:
-
CookbookLock
- Object
- CookbookLock
- ChefDK::Policyfile::ArchivedCookbook
- Extended by:
- Forwardable
- Defined in:
- lib/chef-dk/policyfile/cookbook_locks.rb
Constant Summary
Constants inherited from CookbookLock
CookbookLock::REQUIRED_LOCK_DATA_KEYS
Instance Attribute Summary
Attributes inherited from CookbookLock
#dotted_decimal_identifier, #identifier, #name, #source_options, #storage_config, #version
Instance Method Summary collapse
- #build_from_lock_data(lock_data) ⇒ Object
-
#cookbook_path ⇒ Object
The cookbook is assumed to be stored in a Chef Zero compatible repo as created by ‘chef export`.
-
#initialize(archived_lock, storage_config) ⇒ ArchivedCookbook
constructor
A new instance of ArchivedCookbook.
- #installed? ⇒ Boolean
-
#refresh! ⇒ Object
We trust that archived cookbooks haven’t been modified, so just return true for #refresh!.
-
#validate! ⇒ Object
We trust that archived cookbooks haven’t been modified, so just return true for #validate!.
Methods inherited from CookbookLock
#chefignore, #cookbook_loader, #cookbook_location_spec, #cookbook_version, #dependencies, #gather_profile_data, #identifier_updated?, #identifiers, #install_locked, #lock_data, #symbolize_source_options_keys, #to_lock, #updated?, #version_updated?
Methods included from StorageConfigDelegation
#cache_path, #policyfile_expanded_path, #policyfile_filename, #policyfile_lock_expanded_path, #relative_paths_root
Constructor Details
#initialize(archived_lock, storage_config) ⇒ ArchivedCookbook
Returns a new instance of ArchivedCookbook.
430 431 432 433 |
# File 'lib/chef-dk/policyfile/cookbook_locks.rb', line 430 def initialize(archived_lock, storage_config) @archived_lock = archived_lock @storage_config = storage_config end |
Instance Method Details
#build_from_lock_data(lock_data) ⇒ Object
435 436 437 |
# File 'lib/chef-dk/policyfile/cookbook_locks.rb', line 435 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 ⇒ Object
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
448 449 450 |
# File 'lib/chef-dk/policyfile/cookbook_locks.rb', line 448 def cookbook_path File.join(relative_paths_root, "cookbook_artifacts", "#{name}-#{identifier}") end |
#installed? ⇒ Boolean
439 440 441 |
# File 'lib/chef-dk/policyfile/cookbook_locks.rb', line 439 def installed? File.exist?(cookbook_path) && File.directory?(cookbook_path) end |
#refresh! ⇒ Object
We trust that archived cookbooks haven’t been modified, so just return true for #refresh!
460 461 462 |
# File 'lib/chef-dk/policyfile/cookbook_locks.rb', line 460 def refresh! true end |
#validate! ⇒ Object
We trust that archived cookbooks haven’t been modified, so just return true for #validate!
454 455 456 |
# File 'lib/chef-dk/policyfile/cookbook_locks.rb', line 454 def validate! true end |