lib/inspec/resources/yum.rb in inspec-4.18.0 vs lib/inspec/resources/yum.rb in inspec-4.18.24

- old
+ new

@@ -57,20 +57,23 @@ in_repo = false @content.each_line do |line| # detect repo start in_repo = true if line =~ /^\s*Repo-id\s*:\s*(.*)\b/ # detect repo end - if line == "\n" && in_repo + if (line == "\n" || line =~ /\s*Total packages:/) && in_repo in_repo = false @cache.push(repo) repo = {} end # parse repo content if in_repo == true val = /^\s*([^:]*?)\s*:\s*(.*?)\s*$/.match(line) repo[repo_key(strip(val[1]))] = strip(val[2]) end end + + @cache.push(repo) if in_repo + @cache end def repos repositories.map { |repo| repo["id"] }