using fake version 0.0.0 in case no source version available from a dep profile

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
This commit is contained in:
Nikita Mathur 2022-06-23 19:57:36 +05:30
parent 1166489a93
commit b2e3bb342b

View file

@ -25,7 +25,7 @@ module Inspec
def self.from_array(dependencies, cwd, cache, backend)
dep_list = {}
dependencies.each do |d|
key_name = (d.source_version ? "#{d.name}-#{d.source_version}" : d.name) rescue d.name
key_name = (d.source_version ? "#{d.name}-#{d.source_version}" : "#{d.name}-0.0.0") rescue "#{d.name}-0.0.0"
dep_list[key_name] = d
end
new(cwd, cache, dep_list, backend)
@ -40,7 +40,7 @@ module Inspec
def self.flatten_dep_tree(dep_tree)
dep_list = {}
dep_tree.each do |d|
key_name = (d.source_version ? "#{d.name}-#{d.source_version}" : d.name) rescue d.name
key_name = (d.source_version ? "#{d.name}-#{d.source_version}" : "#{d.name}-0.0.0") rescue "#{d.name}-0.0.0"
dep_list[key_name] = d
dep_list.merge!(flatten_dep_tree(d.dependencies))
end