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

Use Systemd for Amazon Linux 2 #5387

Merged
merged 1 commit into from
Feb 7, 2019
Merged

Use Systemd for Amazon Linux 2 #5387

merged 1 commit into from
Feb 7, 2019

Conversation

gunnaraasen
Copy link
Member

@gunnaraasen gunnaraasen commented Feb 6, 2019

Amazon Linux 2 uses systemd. This PR adds support for Amazon Linux 2 in the Telegraf post-install.sh and post-remove.sh scripts.

closes #5117

Required for all PRs:

# Run update-rc.d or fallback to chkconfig if not available
if which update-rc.d &>/dev/null; then
install_update_rcd
if [[ $VERSION_ID = "2" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect that when VERSION_ID=3 is released it will still be using systemd, so maybe we can have the systemd path be default and only do the other methods for VERSION_ID=1 (if there is such a variable)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll switch this around.

@gunnaraasen
Copy link
Member Author

gunnaraasen commented Feb 6, 2019

Unfortunately, VERSION_ID follows an xxxx.xx (e.g. 2018.03) format in Amazon Linux 1, which breaks a comparison like [[VERSION_ID -ge 2]]. Checking whether the name is "Amazon Linux AMI" instead of "Amazon Linux" appears to be the only non-complicated way to distinguish between Amazon Linux version 1 and later versions.

@danielnelson danielnelson added this to the 1.10.0 milestone Feb 6, 2019
@gunnaraasen gunnaraasen force-pushed the ga-azn-linux-2 branch 2 times, most recently from e85fde3 to a9c453f Compare February 6, 2019 23:27
@gunnaraasen
Copy link
Member Author

I cleaned up the logic a bit. This is ready to merge.

@@ -88,7 +88,10 @@ elif [[ -f /etc/debian_version ]]; then
fi
elif [[ -f /etc/os-release ]]; then
source /etc/os-release
if [[ $ID = "amzn" ]]; then
if [[ $NAME = "Amazon Linux" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quote "$NAME"

@danielnelson danielnelson merged commit 52bd698 into master Feb 7, 2019
@danielnelson danielnelson deleted the ga-azn-linux-2 branch February 7, 2019 00:17
trevorwhitney pushed a commit to trevorwhitney/telegraf that referenced this pull request Feb 14, 2019
@danielnelson danielnelson modified the milestones: 1.10.0, 1.9.5 Feb 19, 2019
danielnelson pushed a commit that referenced this pull request Feb 19, 2019
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
dupondje pushed a commit to dupondje/telegraf that referenced this pull request Apr 22, 2019
bitcharmer pushed a commit to bitcharmer/telegraf that referenced this pull request Oct 18, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Telegraf install logic does not support new Amazon Linux 2 operating system
2 participants