lib/ohai/plugins/linux/platform.rb
#
# Determines the platform version for Cumulus Linux systems
#
# @returns [String] cumulus Linux version from /etc/cumulus/etc.replace/os-release
#
Determines the platform version for Cumulus Linux systems
Determines the platform version for Cumulus Linux systems
def cumulus_version
    release_contents = File.read("/etc/cumulus/etc.replace/os-release")
    release_contents.match(/VERSION_ID=(.*)/)[1]
  rescue NoMethodError, Errno::ENOENT, Errno::EACCES 
    Ohai::Log.warn("Detected Cumulus Linux, but /etc/cumulus/etc/replace/os-release could not be parsed to determine platform_version")
    nil
  end
def cumulus_version release_contents = File . read ( "/etc/cumulus/etc.replace/os-release" ) release_contents . match ( / VERSION_ID=(.*) / ) [ 1 ] rescue NoMethodError , Errno :: ENOENT , Errno :: EACCES Ohai :: Log . warn ( "Detected Cumulus Linux, but /etc/cumulus/etc/replace/os-release could not be parsed to determine platform_version" ) nil end
Determines the platform version for Cumulus Linux systems
Determines the platform version for Cumulus Linux systems
# rescue regex failure, file missing, or permission denied
[String] cumulus Linux version from /etc/cumulus/etc.replace/os-release
[ String ] cumulus Linux version from / etc / cumulus / etc . replace / os - release