skip apt-cdrom repos in apt resource when parsing lists

Signed-off-by: Jon Beilke <Jonathan.Beilke@windlogics.com>
This commit is contained in:
Jon Beilke 2020-07-08 14:19:09 -05:00
parent 4c99130bb2
commit bedef776a6
2 changed files with 3 additions and 0 deletions

View file

@ -90,12 +90,14 @@ module Inspec::Resources
# deb "http://archive.ubuntu.com/ubuntu/" wily main restricted ...
# deb http://archive.ubuntu.com/ubuntu/ wily main restricted ...
# deb [trusted=yes] http://archive.ubuntu.com/ubuntu/ wily main restricted ...
# deb cdrom:[Ubuntu 15.10 _Wily Werewolf_ - Release amd64 (20151021)]/ wily main restricted ...
words = line.split
words.delete_at 1 if words[1] && words[1].start_with?("[")
type, url, distro, *components = words
url = url.delete('"') if url
next if words[1] && words[1].start_with?("cdrom:") # skip unsupported apt-cdrom repos
next if components.empty?
next unless URI::HTTP === URI.parse(url)
next unless %w{deb deb-src}.include? type

View file

@ -7,3 +7,4 @@ deb http://archive.ubuntu.com/ubuntu/ wily main restricted
deb "http://archive.ubuntu.com/ubuntu/" wily main restricted
deb [arch=amd64] "http://archive.ubuntu.com/ubuntu/" wily main restricted
deb-src http://archive.ubuntu.com/ubuntu/ wily main restricted
deb cdrom:[Ubuntu 15.10 _Wily Werewolf_ - Release amd64 (20151021)]/ wily main restricted