Deprecation: Amazon linux moved to the Amazon platform_family (OHAI-7)

[edit on GitHub]

In Ohai/Chef releases prior to Chef Client 13, Amazon Linux was identified as platform_family 'rhel'. In Ohai/Chef Client 13 and later, Amazon Linux will be identified as the platform_family 'amazon'. When Amazon Linux was created it closely mirrored the structure and package naming of RHEL 5, and with the release of RHEL 6 Amazon Linux moved to closely resemble RHEL 6. With the release of RHEL 7 Red Hat switched to the systemd init system, however Amazon Linux has not yet decided to make that same switch. In addition to the init system differences, Amazon Linux has added many critical packages with their own unique naming conventions. This makes it very hard for users to write cookbooks for RHEL that will work on Amazon Linux systems out of the box. In order to simplify multi-platform cookbook code and to make it more clear when cookbooks actually support Amazon Linux, we’ve created the ‘amazon platform family and removed Amazon Linux from the rhel platform family.

Remediation

If you have a cookbook that relies on platform_family 'rhel' to support Red Hat based distributions as well as Amazon Linux, you’ll need to modify your code to specifically check for the 'amazon' platform family.

Existing code only checking for the rhel platform family:

if platform_family?('rhel')
  service 'foo' do
    action :start
  end
end

Updated code to check for both rhel and amazon platform families:

if platform_family?('rhel', 'amazon')
  service 'foo' do
    action :start
  end
end

© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/deprecations_ohai_amazon_linux/