Method: Inspec::CachedFetcher#assert_cache_sanity!

Defined in:
lib/inspec/cached_fetcher.rb

#assert_cache_sanity!Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/inspec/cached_fetcher.rb', line 50

def assert_cache_sanity!
  return unless target.respond_to?(:key?) && target.key?(:sha256)

  exception_message = <<~EOF
    The remote source #{fetcher} no longer has the requested content:

    Request Content Hash: #{target[:sha256]}
    Actual Content Hash: #{fetcher.resolved_source[:sha256]}

    For URL, supermarket, compliance, and other sources that do not
    provide versioned artifacts, this likely means that the remote source
    has changed since your lockfile was generated.
  EOF
  raise exception_message if fetcher.resolved_source[:sha256] != target[:sha256]
end