Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make AMI optional in Amazon Linux OS detection #385

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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