From f4a3cf9144f028c0d026bccf70ee81fb834d57ea Mon Sep 17 00:00:00 2001 From: Clinton Wolfe Date: Thu, 19 Dec 2019 14:31:30 -0500 Subject: [PATCH] Implementation for local fetcher Signed-off-by: Clinton Wolfe --- lib/inspec/dependencies/resolver.rb | 2 +- lib/inspec/fetcher/local.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/inspec/dependencies/resolver.rb b/lib/inspec/dependencies/resolver.rb index 8f8256df6..e722af564 100644 --- a/lib/inspec/dependencies/resolver.rb +++ b/lib/inspec/dependencies/resolver.rb @@ -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 diff --git a/lib/inspec/fetcher/local.rb b/lib/inspec/fetcher/local.rb index 35efb5a81..b9fc142e7 100644 --- a/lib/inspec/fetcher/local.rb +++ b/lib/inspec/fetcher/local.rb @@ -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)