Class: Facts::Sles::Os::Release

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/facts/sles/os/release.rb

Constant Summary collapse

FACT_NAME =
'os.release'
ALIASES =
%w[operatingsystemmajrelease operatingsystemrelease].freeze

Instance Method Summary collapse

Instance Method Details

#build_fact_list(version) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/facter/facts/sles/os/release.rb', line 19

def build_fact_list(version)
  {
    full: version,
    major: version.split('.').first,
    minor: version.split('.').last
  }
end

#call_the_resolverObject



10
11
12
13
14
15
16
17
# File 'lib/facter/facts/sles/os/release.rb', line 10

def call_the_resolver
  version = Facter::Resolvers::OsRelease.resolve(:version_id)
  fact_value = build_fact_list(version)

  [Facter::ResolvedFact.new(FACT_NAME, fact_value),
   Facter::ResolvedFact.new(ALIASES.first, fact_value[:major], :legacy),
   Facter::ResolvedFact.new(ALIASES.last, fact_value[:full], :legacy)]
end