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

Chef Omnitruck installer defaults to EL6 for Amazon Linux 2023 #602

Open
jjperry opened this issue Nov 16, 2023 · 0 comments
Open

Chef Omnitruck installer defaults to EL6 for Amazon Linux 2023 #602

jjperry opened this issue Nov 16, 2023 · 0 comments

Comments

@jjperry
Copy link

jjperry commented Nov 16, 2023

A kitchen converge on Amazon Linux 2023, the installer installs an el6 Chef client.

Describe the problem

When using Kitchen with the omnitruck installer, the https://omnitruk.chef.io/install.sh defaults to EL6 for Amazon Linux 2023. This is causing library issues due to Amazon Linux 2023 is not EL6 binary compatible.

Software Version

CentOS 7 with Chef Workstation 23.5.1040
Chef Workstation version: 23.5.1040
Test Kitchen version: 3.5.0
Cookstyle version: 7.32.2
Chef Infra Client version: 18.2.7
Chef InSpec version: 5.21.29
Chef CLI version: 5.6.11
Chef Habitat version: 1.6.652

Replication Case

  1. Build an Amazon Linux 2023 EC2 instance.
  2. Login to new EC2
  3. Run sudo su - to become root
  4. Run wget https://omnitruk.chef.io/install.sh > /tmp/install.sh
  5. Run chmod /tmp/install.sh
  6. Run /tmp/install.sh

Stacktrace

Choosing EL6 by default for Amazon Linux 2023 Running the https://omnitruk.chef.io/install.sh on Amazon 2023 will default to EL6 based on the code block below. This appears to be coming from Chef mixlib-install: `https://github.com/chef/mixlib-install/blob/main/lib/mixlib/install/generator/bourne/scripts/platform_detection.sh#L64-L83`
elif test -f "/etc/system-release"; then  
  platform=`sed 's/^\(.\+\) release.\+/\1/' /etc/system-release | tr '[A-Z]' '[a-z]'`
  platform_version=`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/system-release | tr '[A-Z]' '[a-z]'`
  case $platform in amazon*) # sh compat method of checking for a substring
    . /etc/os-release
    platform_version=$VERSION_ID

    if test "$platform_version" = "2022"; then
      platform="amazon"
      platform_version="2022"
    elif test "$platform_version" = "2"; then
      platform="el"
      platform_version="7"
    else
      platform="el"

      # VERSION_ID will match YYYY.MM for Amazon Linux AMIs
      platform_version="6"
    fi
  esac

Possible Solution

Change the https://github.com/chef/mixlib-install/blob/main/lib/mixlib/install/generator/bourne/scripts/platform_detection.sh at line 71 to add Amazon Linux 2023 detection and change the original line 71 to an elif below the new code.

   if test "$platform_version" = "2023"; then
      platform="amazon"
      platform_version="2023"
   elif test "$platform_version" = "2022"; then
      platform="amazon"
      platform_version="2022"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant