Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/facter/facts/solaris/os/name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class Name

def call_the_resolver
value = Facter::Resolvers::Uname.resolve(:kernelname)
fact_value = value == 'SunOS' ? 'Solaris' : value
version = Facter::Resolvers::Uname.resolve(:kernelversion)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is duplicate

Suggested change
version = Facter::Resolvers::Uname.resolve(:kernelversion)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's not a duplicate - :kernelversion and :kernelname is not the same

fact_value = value == 'SunOS' ? (version =~ /^omnios-/ ? 'OmniOS' : 'Solaris') : value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fact_value = value == 'SunOS' ? (version =~ /^omnios-/ ? 'OmniOS' : 'Solaris') : value
fact_value = case value
when 'SunOS'
'Solaris'
when /^omnios-/
'OmniOS'
else
value
end

Also could you add unit a test?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ptrrkssn could you take a look at ^ You may want to rebase too.


[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
end
Expand Down
3 changes: 2 additions & 1 deletion lib/facter/resolvers/solaris/os_release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class OsRelease < BaseResolver
init_resolver

OS_VERSION_REGEX_PATTERNS = ['Solaris \d+ \d+/\d+ s(\d+)[sx]?_u(\d+)wos_',
'Solaris (\d+)[.](\d+)', 'Solaris (\d+)'].freeze
'Solaris (\d+)[.](\d+)', 'Solaris (\d+)',
'OmniOS v(\d+) (r\d+)'].freeze

class << self
private
Expand Down