Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(FACT-2732) OracleLinux 7 and Scientific Linux 7 OS facts incorrect in Facter 4.0.30 #2014

Merged
merged 1 commit into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
(FACT-2732) Add Oracle and Scientific Linux to os hierarchy.
  • Loading branch information
BogdanIrimie committed Aug 6, 2020
commit 9b664ac43b1c87f2eb6ff769a061745722d37cb1
4 changes: 3 additions & 1 deletion lib/facter/os_hierarchy.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"Rhel": [
"Fedora",
"Amzn",
"Centos"
"Centos",
"Ol",
"Scientific"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion lib/facter/resolvers/os_release_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def pad_version_id
def process_name
return unless @fact_list[:name]

@fact_list[:name] = if @fact_list[:name].downcase.start_with?('red')
@fact_list[:name] = if @fact_list[:name].downcase.start_with?('red', 'oracle')
@fact_list[:name].split(' ')[0..1].join
else
@fact_list[:name].split(' ')[0].strip
Expand Down
12 changes: 11 additions & 1 deletion spec/facter/resolvers/os_release_resolver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
end

context 'when on Debian' do
let(:os_release_content) { load_fixture('debian_os_release').readlines }
let(:os_release_content) { load_fixture('os_release_debian').readlines }

it 'returns os NAME' do
result = Facter::Resolvers::OsRelease.resolve(:name)
Expand Down Expand Up @@ -108,4 +108,14 @@
end
end
end

context 'when on Oracle Linux' do
let(:os_release_content) { load_fixture('os_release_oracle_linux').readlines }

it 'returns os NAME' do
result = Facter::Resolvers::OsRelease.resolve(:name)

expect(result).to eq('OracleLinux')
end
end
end
9 changes: 0 additions & 9 deletions spec/fixtures/debian_os_release

This file was deleted.

14 changes: 14 additions & 0 deletions spec/fixtures/os_release_oracle_linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
NAME="Oracle Linux Server"
VERSION="7.2"
ID="ol"
VERSION_ID="7.2"
PRETTY_NAME="Oracle Linux Server 7.2"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:2:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
ORACLE_BUGZILLA_PRODUCT_VERSION=7.2
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=7.2