Implementation for local fetcher

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2019-12-19 14:31:30 -05:00
parent 82ae3b5fa1
commit f4a3cf9144
2 changed files with 14 additions and 1 deletions

View file

@ -62,7 +62,7 @@ module Inspec
begin
dep.resolved_source
rescue Inspec::FetcherFailure
Inspec::Log.debug("Failed to fetch #{dep.name}, a falling back to archives if possible")
Inspec::Log.debug("Failed to fetch #{dep.name}, falling back to archives if possible")
retry if fallback_to_archive_on_fetch_failure(dep)
end
end

View file

@ -100,6 +100,19 @@ module Inspec::Fetcher
end
end
def update_from_opts(opts)
changed = false
old_val = @archive_shasum
new_val = opts[:sha256]
unless old_val == new_val
@archive_shasum = new_val
changed = true
end
changed
end
def perform_shasum(target)
return @archive_shasum if @archive_shasum
raise(Inspec::FetcherFailure, "Profile dependency local path '#{target}' does not exist") unless File.exist?(target)