-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(FACT-3114) Arch Linux: Implement os version facts
- Loading branch information
1 parent
88a4f07
commit 9ce3f14
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Archlinux | ||
module Os | ||
class Release | ||
FACT_NAME = 'os.release' | ||
ALIASES = %w[operatingsystemmajrelease operatingsystemrelease].freeze | ||
|
||
def call_the_resolver | ||
version = determine_release_version | ||
|
||
return Facter::ResolvedFact.new(FACT_NAME, nil) unless version | ||
|
||
[Facter::ResolvedFact.new(FACT_NAME, version), | ||
Facter::ResolvedFact.new(ALIASES.first, version['major'], :legacy), | ||
Facter::ResolvedFact.new(ALIASES.last, version['full'], :legacy)] | ||
end | ||
|
||
def determine_release_version | ||
version = Facter::Resolvers::Uname.resolve(:kernelrelease) | ||
|
||
Facter::Util::Facts.release_hash_from_string(version) | ||
end | ||
end | ||
end | ||
end | ||
end |