Skip to content

Commit

Permalink
Remove useless mechanism to retrieve OS minor version from RHEL and R…
Browse files Browse the repository at this point in the history
…ocky

This mechanism was used on CentOS 7, to retrieve the OS minor version from the kernel version
and use it to download the right version of the Lustre client.

This mechanism is not required for RHEL and Rocky because the minor version
automatically changes when updating the kernel. This is reflected in the `/etc/os-release` file too.

This change will permit us to automatically support new minor versions when they will be available,
without the need to update the internal mapping.

Signed-off-by: Enrico Usai <[email protected]>
  • Loading branch information
enrico-usai committed Nov 23, 2023
1 parent 513781f commit 03b2db0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,10 @@
end
end

def find_os_minor_version
os_minor_version = ''
kernel_patch_version = find_kernel_patch_version

# kernel patch versions under 193 are prior to RHEL 8.2
# kernel patch version number can be retrieved from https://access.redhat.com/articles/3078#RHEL8
os_minor_version = '2' if kernel_patch_version >= '193'
os_minor_version = '3' if kernel_patch_version >= '240'
os_minor_version = '4' if kernel_patch_version >= '305'
os_minor_version = '5' if kernel_patch_version >= '348'
os_minor_version = '6' if kernel_patch_version >= '372'
os_minor_version = '7' if kernel_patch_version >= '425'
os_minor_version = '8' if kernel_patch_version >= '477'
os_minor_version = '9' if kernel_patch_version >= '513'

os_minor_version
end

action_class do
def base_url
# https://docs.aws.amazon.com/fsx/latest/LustreGuide/install-lustre-client.html#lustre-client-rhel
"https://fsx-lustre-client-repo.s3.amazonaws.com/el/8.#{find_os_minor_version}/$basearch"
"https://fsx-lustre-client-repo.s3.amazonaws.com/el/#{node['platform_version']}/$basearch"
end

def public_key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,10 @@
end
end

def find_os_minor_version
os_minor_version = ''
kernel_patch_version = find_kernel_patch_version

# kernel patch versions under 193 are prior to RHEL 8.2
# kernel patch version number can be retrieved from https://access.redhat.com/articles/3078#RHEL8
os_minor_version = '2' if kernel_patch_version >= '193'
os_minor_version = '3' if kernel_patch_version >= '240'
os_minor_version = '4' if kernel_patch_version >= '305'
os_minor_version = '5' if kernel_patch_version >= '348'
os_minor_version = '6' if kernel_patch_version >= '372'
os_minor_version = '7' if kernel_patch_version >= '425'
os_minor_version = '8' if kernel_patch_version >= '477'
os_minor_version = '9' if kernel_patch_version >= '513'

os_minor_version
end

action_class do
def base_url
# https://docs.aws.amazon.com/fsx/latest/LustreGuide/install-lustre-client.html#lustre-client-rhel
"https://fsx-lustre-client-repo.s3.amazonaws.com/el/8.#{find_os_minor_version}/$basearch"
"https://fsx-lustre-client-repo.s3.amazonaws.com/el/#{node['platform_version']}/$basearch"
end

def public_key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def self.setup(chef_run)
platform: platform, version: '8',
step_into: ['lustre']
) do |node|
node.automatic['platform_version'] = "8.#{minor_version}"
node.override['cluster']['kernel_release'] = "4.18.0-#{kernel_patch}.9.1.el8"
end
Lustre.setup(runner)
Expand All @@ -226,26 +227,6 @@ def self.setup(chef_run)
end
end
end

context "kernel release does not match expected format" do
cached(:chef_run) do
runner = runner(
platform: platform, version: '8',
step_into: ['lustre']
) do |node|
node.automatic['platform_version'] = "8.2"
node.override['cluster']['kernel_release'] = 'unexpected.format'
end
Lustre.setup(runner)
end

it 'raises error' do
expect { chef_run }.to(raise_error do |error|
expect(error).to be_a(Exception)
expect(error.message).to include("Unable to retrieve the kernel patch version from unexpected.format.")
end)
end
end
end

for_oses([
Expand Down

0 comments on commit 03b2db0

Please sign in to comment.