class ChefCLI::Policyfile::CookbookLock
def assert_required_keys_valid!(lock_data)
def assert_required_keys_valid!(lock_data) missing_keys = REQUIRED_LOCK_DATA_KEYS.reject { |key| lock_data.key?(key) } unless missing_keys.empty? raise InvalidLockfile, "Lockfile cookbook_lock for #{name} missing required attributes `#{missing_keys.join("', `")}'" end version = lock_data["version"] unless version.is_a?(String) raise InvalidLockfile, "Lockfile cookbook_lock for #{name} `version' attribute must be a string (got: #{version})" end identifier = lock_data["identifier"] unless identifier.is_a?(String) raise InvalidLockfile, "Lockfile cookbook_lock for #{name} `identifier' attribute must be a string (got: #{identifier})" end cache_key = lock_data["cache_key"] unless cache_key.is_a?(String) || cache_key.nil? raise InvalidLockfile, "Lockfile cookbook_lock for #{name} `cache_key' attribute must be a string (got: #{cache_key})" end source_options = lock_data["source_options"] unless source_options.is_a?(Hash) raise InvalidLockfile, "Lockfile cookbook_lock for #{name} `source_options' attribute must be a Hash (JSON object) (got: #{source_options})" end end