-
Notifications
You must be signed in to change notification settings - Fork 680
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
add systemd service for amazon linux 2 #2901
Conversation
Signed-off-by: Zakhar Kleyman <zakhar.kleyman@mongodb.com>
I see that the https://travis-ci.org/chef/inspec/builds/359998634 test for the original commit that was missing DCO was green but the current https://travis-ci.org/chef/inspec/builds/359999391 failed. The only difference between those 2 was the DCO message, I don't think that could have caused the test to fail. Can it be a flaky test? Let me know If you have any suggestions on how to approach this (re-run the test, fix something in the code, submit a new pr, etc). |
@zakhark Green on re-run. Possibly flaky! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @zakhark !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @zakhark for uncovering this!
lib/resources/service.rb
Outdated
@@ -162,7 +162,11 @@ def select_service_mgmt # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticCom | |||
elsif %w{aix}.include?(platform) | |||
SrcMstr.new(inspec) | |||
elsif %w{amazon}.include?(platform) | |||
Upstart.new(inspec, service_ctl) | |||
if os[:release].start_with?('2.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since 2.x will be the new default, I am curious if we should turn the logic the other way: use systemd as a default for amazon linux and just use upstart if the version string starts with 20\d\d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a very good point, I've updated the logic
Signed-off-by: Zakhar Kleyman <zakhar.kleyman@mongodb.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @zakhark !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @zakhark
Right now service Amazon Linux is treated as upstart_service while Amazon Linux 2 is systemd.
It causes issues like #2639
On the Amazon Linux 2 Candidate, os[:release] returns "2.0", so I'm using .start_with?('2.') here in case they'll use something 2.x in the future.
(Amazon Linux 1 returns something like "2016.09")
Signed-off-by: Zakhar Kleyman zakhar.kleyman@mongodb.com