Sha256: 13173d5c59aee4f3503cc9db75fa618ecaf0b61e0b6ff442fc29a653de47f93c

Contents?: true

Size: 1.25 KB

Versions: 12

Compression:

Stored size: 1.25 KB

Contents

# Fact: operatingsystemmajrelease
#
# Purpose: Returns the major release of the operating system.
#
# Resolution:
#   Splits down the operatingsystemrelease fact at decimal point for
#   osfamily RedHat derivatives and Debian.
#   Uses operatingsystemrelease to the first non decimal character for
#   operatingsystem Solaris
#
# This should be the same as lsbmajdistrelease, but on minimal systems there
# are too many dependencies to use LSB
#
# List of operatingsystems at time of writing:
#"Alpine" "Amazon" "Archlinux" "Ascendos" "Bluewhite64" "CentOS" "CloudLinux" 
#"Debian" "Fedora" "Gentoo" "Mandrake" "Mandriva" "MeeGo" "OEL" "OpenSuSE" 
#"OracleLinux" "OVS" "PSBM" "RedHat" "Scientific" "Slackware" "Slamd64" "SLC"
#"SLED" "SLES" "SuSE" "Ubuntu" "VMWareESX"

Facter.add(:operatingsystemmajrelease) do
  confine :operatingsystem => [
    :Amazon,
    :CentOS,
    :CloudLinux,
    :Debian,
    :Fedora,
    :OEL,
    :OracleLinux,
    :OVS,
    :RedHat,
    :Scientific,
    :SLC
  ]
  setcode do
    Facter.value('operatingsystemrelease').split('.').first
  end
end

Facter.add(:operatingsystemmajrelease) do
  confine :operatingsystem => :solaris
  setcode do
    if match = Facter.value(:operatingsystemrelease).match(/^(\d+)/)
      match.captures[0]
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
facter-2.0.2 lib/facter/operatingsystemmajrelease.rb
facter-2.0.2-x86-mingw32 lib/facter/operatingsystemmajrelease.rb
facter-2.0.2-universal-darwin lib/facter/operatingsystemmajrelease.rb
facter-2.0.1 lib/facter/operatingsystemmajrelease.rb
facter-2.0.1-x86-mingw32 lib/facter/operatingsystemmajrelease.rb
facter-2.0.1-universal-darwin lib/facter/operatingsystemmajrelease.rb
facter-2.0.1.rc4 lib/facter/operatingsystemmajrelease.rb
facter-2.0.1.rc4-x86-mingw32 lib/facter/operatingsystemmajrelease.rb
facter-2.0.1.rc4-universal-darwin lib/facter/operatingsystemmajrelease.rb
facter-2.0.1.rc3 lib/facter/operatingsystemmajrelease.rb
facter-2.0.1.rc3-x86-mingw32 lib/facter/operatingsystemmajrelease.rb
facter-2.0.1.rc3-universal-darwin lib/facter/operatingsystemmajrelease.rb