Module: ChefCLI::Policyfile::LockFetcherMixin

Included in:
LocalLockFetcher, RemoteLockFetcher
Defined in:
lib/chef-cli/policyfile/lock_fetcher_mixin.rb

Instance Method Summary collapse

Instance Method Details

#validate_revision_id(included_id, source_options) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/chef-cli/policyfile/lock_fetcher_mixin.rb', line 23

def validate_revision_id(included_id, source_options)
  expected_id = source_options[:policy_revision_id]
  if expected_id
    if included_id.eql?(expected_id) # are they the same?
      nil
    elsif included_id[0, 10].eql?(expected_id) # did they use the 10 char substring
      nil
    else
      raise ChefCLI::InvalidLockfile, "Expected policy_revision_id '#{expected_id}' does not match included_policy '#{included_id}'."
    end
  end
end