Merge pull request #5138 from jrbeilke/bug-apt-cdrom

skip apt-cdrom repos in apt resource when parsing lists
This commit is contained in:
Nick Schwaderer 2020-07-14 11:49:21 +01:00 committed by GitHub
commit 934aa8d49a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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