mirror of
https://github.com/inspec/inspec
synced 2025-02-16 22:18:38 +00:00
Improve apt.rb's read_debs
Make it better at handling whitespace in bracketed options Signed-off-by: Benoît Gastinne <Udyrfrykte@users.noreply.github.com>
This commit is contained in:
parent
80149958e8
commit
fe74f4fd5b
2 changed files with 6 additions and 5 deletions
|
@ -87,13 +87,13 @@ module Inspec::Resources
|
|||
active = raw_line == line
|
||||
|
||||
# formats:
|
||||
# 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 "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 [arch=amd64 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?("[")
|
||||
words = line.sub(/^(deb|deb-src)\s+\[.+?\]/, '\1').split
|
||||
type, url, distro, *components = words
|
||||
url = url.delete('"') if url
|
||||
|
||||
|
|
1
test/fixtures/cmd/etc-apt
vendored
1
test/fixtures/cmd/etc-apt
vendored
|
@ -7,4 +7,5 @@ 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-src [arch=amd64 trusted=yes] http://archive.ubuntu.com/ubuntu/ wily main restricted
|
||||
deb cdrom:[Ubuntu 15.10 _Wily Werewolf_ - Release amd64 (20151021)]/ wily main restricted
|
||||
|
|
Loading…
Add table
Reference in a new issue