Add archive_path helper to Tar and Url fetchers

Eventually I think we'll want this as part of the fetcher API generally.

Signed-off-by: Steven Danna <steve@chef.io>
This commit is contained in:
Steven Danna 2016-08-23 11:47:53 +01:00
parent a6ec345eac
commit 02d611e68c
No known key found for this signature in database
GPG key ID: 94DFB46E861A7DAE
3 changed files with 9 additions and 1 deletions

View file

@ -19,6 +19,10 @@ module Fetchers
new(target)
end
def archive_path
target
end
def initialize(target)
@target = target
@contents = {}

View file

@ -103,6 +103,10 @@ module Fetchers
@archive = self.class.download_archive(url, opts)
end
def archive_path
@archive.path
end
def url
@target
end

View file

@ -108,7 +108,7 @@ module Inspec
if fetcher.class == Fetchers::Local || @vendor_index.exists?(@name, source_url)
local_path
else
@vendor_index.add(@name, source_url, fetcher.archive.path)
@vendor_index.add(@name, source_url, fetcher.archive_path)
end
end