Class: PuppetMetadata::OperatingSystem
- Inherits:
-
Object
- Object
- PuppetMetadata::OperatingSystem
- Defined in:
- lib/puppet_metadata/operatingsystem.rb
Overview
An abstraction layer over operating systems. Mostly to determine End Of Life dates.
Constant Summary collapse
- EOL_DATES =
The EOL dates for the various operating systems
{ # https://wiki.almalinux.org/release-notes/ 'AlmaLinux' => { '9' => '2032-05-31', '8' => '2029-05-31', }, 'Amazon' => { # Amazon Linux AMI # https://aws.amazon.com/amazon-linux-ami/ '2018.03' => '2023-12-31', '2017.09' => '2023-12-31', '2017.03' => '2023-12-31', '2016.09' => '2023-12-31', '2016.03' => '2023-12-31', '2015.09' => '2023-12-31', '2015.03' => '2023-12-31', '2014.09' => '2023-12-31', '2014.03' => '2023-12-31', '2013.09' => '2023-12-31', '2013.03' => '2023-12-31', '2012.09' => '2023-12-31', '2012.03' => '2023-12-31', '2011.09' => '2023-12-31', '2010.11' => '2023-12-31', # Amazon Linux 2 # https://aws.amazon.com/amazon-linux-2/faqs/ '2.0' => '2026-06-30', # Amazon Linux 2023 # https://docs.aws.amazon.com/linux/al2023/ug/release-cadence.html '2023' => '2027-06-30', }, # https://endoflife.software/operating-systems/linux/centos # https://endoflife.date/centos-stream 'CentOS' => { '9' => '2027-05-31', '8' => '2024-05-31', '7' => '2024-06-30', '6' => '2020-11-30', '5' => '2017-03-31', '4' => '2012-02-29', '3' => '2010-10-30', }, # https://wiki.debian.org/DebianReleases 'Debian' => { # EOL is extended life cycle, not standard support # https://github.com/voxpupuli/voxpupuli.github.io/pull/386 '13' => '2030-08-09', '12' => '2028-06-30', '11' => '2026-08-31', '10' => '2022-09-10', '9' => '2020-07-06', '8' => '2018-06-17', '7' => '2016-04-26', '6' => '2015-05-31', '5' => '2012-02-06', '4' => '2010-02-15', '3.1' => '2008-03-31', '3.0' => '2006-06-30', '2.2' => '2003-06-30', '2.1' => '2000-09-30', }, # https://endoflife.date/oraclelinux 'OracleLinux' => { '9' => '2032-06-30', '8' => '2029-07-01', '7' => '2024-12-31', }, # https://docs.fedoraproject.org/en-US/releases/eol/ 'Fedora' => { '41' => nil, '40' => '2025-05-13', '39' => '2024-11-26', '38' => '2024-05-21', '37' => '2023-12-05', '36' => '2023-05-16', '35' => '2022-12-13', '34' => '2022-06-07', '33' => '2021-11-30', '32' => '2021-05-25', '31' => '2020-11-24', '30' => '2020-05-26', '29' => '2019-11-26', '28' => '2019-05-28', '27' => '2018-11-30', '26' => '2018-05-29', '25' => '2017-12-12', '24' => '2017-08-08', '23' => '2016-12-20', '22' => '2016-07-19', '21' => '2015-12-01', '20' => '2015-06-23', '19' => '2015-01-06', '18' => '2014-01-14', '17' => '2013-07-30', '16' => '2013-02-12', '15' => '2012-06-26', '14' => '2011-12-08', '13' => '2011-06-24', '12' => '2010-12-02', '11' => '2010-06-25', '10' => '2009-12-18', '9' => '2009-07-10', '8' => '2009-01-07', '7' => '2008-06-13', '6' => '2007-12-07', '5' => '2007-07-02', '4' => '2006-08-07', '3' => '2006-01-16', '2' => '2005-04-11', '1' => '2004-09-20', }, # https://endoflife.software/operating-systems/unix-like-bsd/freebsd 'FreeBSD' => { '13' => '2026-01-31', '12' => '2024-06-30', '11' => '2021-09-30', '10' => '2018-10-31', '9' => '2016-12-31', '8' => '2015-08-01', '7' => '2013-02-28', '6' => '2010-11-30', '5' => '2008-05-31', '4' => '2007-01-31', }, # https://endoflife.software/operating-systems/linux/red-hat-enterprise-linux-rhel 'RedHat' => { # TODO: EOL is standard support, not the extended life cycle '8' => '2029-05-31', '7' => '2024-06-30', '6' => '2020-11-30', '5' => '2017-03-31', '4' => '2012-02-29', '3' => '2010-10-31', }, # https://wiki.rockylinux.org/rocky/version/ 'Rocky' => { '9' => '2032-05-31', '8' => '2029-05-31', }, # https://scientificlinux.org/category/uncategorized/scientific-linux-end-of-life/ 'Scientific' => { '8' => '2024-06-30', # This is not really a Scientific release, but I have seen it in module metadata .. '7' => '2024-06-30', '6' => '2020-11-30', '5' => '2017-03-31', '4' => '2012-02-29', '3' => '2010-10-30', }, # https://www.suse.com/lifecycle/#product-suse-linux-enterprise-server # General support end dates, not LTSS 'SLES' => { '15' => '2031-07-31', '12' => '2024-10-31', '11' => '2019-03-31', '10' => '2013-07-31', }, # https://endoflife.software/operating-systems/linux/ubuntu 'Ubuntu' => { '24.04' => '2029-04-30', '22.04' => '2027-04-15', '21.10' => '2022-07-15', '20.10' => '2021-07-15', '20.04' => '2025-04-15', '19.10' => '2020-07-15', '19.04' => '2020-01-15', '18.10' => '2019-07-15', '18.04' => '2023-05-31', '17.10' => '2018-07-15', '17.04' => '2018-01-15', '16.10' => '2017-07-20', '16.04' => '2021-04-15', '15.10' => '2016-07-28', '15.04' => '2016-02-04', '14.10' => '2015-07-23', '14.04' => '2019-04-15', '13.10' => '2014-07-17', '13.04' => '2014-01-27', '12.04' => '2017-04-28', '11.10' => '2013-05-09', '11.04' => '2012-10-28', '10.10' => '2012-04-10', '10.04' => '2015-04-30', '9.10' => '2011-04-30', '9.04' => '2010-10-23', '8.10' => '2010-04-30', '8.04' => '2013-05-09', '7.10' => '2009-04-18', '7.04' => '2008-10-19', '6.10' => '2008-04-26', '6.06' => '2011-06-01', '5.10' => '2007-04-13', '5.04' => '2006-10-31', '4.10' => '2006-04-30', }, }.freeze
Class Method Summary collapse
-
.eol?(operatingsystem, release, at = nil) ⇒ Boolean
Return whether the given operating system release is EOL at the given date.
-
.eol_date(operatingsystem, release) ⇒ optional, Date
Return the EOL date for the given operating system release.
-
.latest_release(operatingsystem) ⇒ optional, String
Return the latest known release for a given operating system.
-
.os_release_puppet_version(operatingsystem, release) ⇒ Optional[Integer]
Return the Puppet major version in an OS release, if any.
-
.supported_releases(operatingsystem) ⇒ Array
Return an array of all Operating System versions that aren’t EoL.
Class Method Details
.eol?(operatingsystem, release, at = nil) ⇒ Boolean
Return whether the given operating system release is EOL at the given date
240 241 242 243 |
# File 'lib/puppet_metadata/operatingsystem.rb', line 240 def eol?(, release, at = nil) date = eol_date(, release) date && date < (at || Date.today) end |
.eol_date(operatingsystem, release) ⇒ optional, Date
Return the EOL date for the given operating system release
220 221 222 223 224 225 226 227 228 |
# File 'lib/puppet_metadata/operatingsystem.rb', line 220 def eol_date(, release) releases = EOL_DATES[] return unless releases date = releases[release] return unless date Date.parse(date) end |
.latest_release(operatingsystem) ⇒ optional, String
Return the latest known release for a given operating system
250 251 252 253 |
# File 'lib/puppet_metadata/operatingsystem.rb', line 250 def latest_release() releases = EOL_DATES[] releases&.keys&.max_by { |release| Gem::Version.new(release) } end |
.os_release_puppet_version(operatingsystem, release) ⇒ Optional[Integer]
Return the Puppet major version in an OS release, if any
Only tracks releases without an AIO build, since that’s preferred.
275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/puppet_metadata/operatingsystem.rb', line 275 def os_release_puppet_version(, release) case when 'Fedora' case release when '39', '40' 8 when '37', '38' 7 end end end |
.supported_releases(operatingsystem) ⇒ Array
Return an array of all Operating System versions that aren’t EoL
258 259 260 261 262 263 |
# File 'lib/puppet_metadata/operatingsystem.rb', line 258 def supported_releases() releases = EOL_DATES[] today = Date.today releases.select { |_release, eol_date| !eol_date || Date.parse(eol_date) > today }.keys .sort_by { |release| Gem::Version.new(release) } end |