Skip to content

Commit

Permalink
Added a new matcher for amazon linux 2 (#380)
Browse files Browse the repository at this point in the history
Signed-off-by: Artyom Tkachenko <offtema@gmail.com>
  • Loading branch information
artyomtkachenko authored and jquick committed Nov 27, 2018
1 parent 440a68c commit 698621a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/train/platforms/detect/helpers/os_linux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def redhatish_version(conf)
case conf
when /rawhide/i
/((\d+) \(Rawhide\))/i.match(conf)[1].downcase
when /Amazon Linux AMI/i
/release ([\d\.]+)/.match(conf)[1]
when /Amazon Linux/i
/([\d\.]+)/.match(conf)[1]
when /derived from .*linux|amazon/i
/Linux ((\d+|\.)+)/i.match(conf)[1]
else
Expand Down
8 changes: 8 additions & 0 deletions test/unit/platforms/detect/os_linux_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ class OsDetectLinuxTester
it 'normal linux' do
detector.redhatish_version('derived from Ubuntu Linux 11').must_equal('11')
end

it 'amazon linux 2 new release naming schema' do
detector.redhatish_version('Amazon Linux release 2 (Karoo)').must_equal('2')
end

it 'amazon linux 2 old release naming schema' do
detector.redhatish_version('Amazon Linux 2').must_equal('2')
end
end

describe 'lsb parse' do
Expand Down

0 comments on commit 698621a

Please sign in to comment.