From 2478e842dbd1823275259c7b59b67094b27434a5 Mon Sep 17 00:00:00 2001 From: Saurabh Pandit Date: Thu, 3 Oct 2024 13:54:18 +0530 Subject: [PATCH] (CAT-2051): Fixed SUSEConnect command so that java installation succeeds on SLES-15 --- manifests/init.pp | 9 ++++----- spec/classes/java_spec.rb | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 78ba209e..31750303 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -110,13 +110,12 @@ default => '--jre' } - # Enable legacy repo to install net-tools-deprecated package - # If SUSE OS major version is >= 15 and minor version is > 3 - if ($facts['os']['family'] in ['SLES', 'SUSE']) and (versioncmp($facts['os']['release']['major'], '15') >= 0 and versioncmp($facts['os']['release']['minor'], '3') == 1) { + # If the OS is SLES >= 15.3, enable the legacy repo to install net-tools-deprecated package + if ($facts['os']['family'] in ['SLES', 'SUSE']) and (versioncmp($facts['os']['release']['full'], '15.3') >= 0) { exec { 'Enable legacy repos': path => '/bin:/usr/bin/:/sbin:/usr/sbin', - command => 'SUSEConnect --product sle-module-legacy/15.5/x86_64', - unless => 'SUSEConnect --status-text | grep sle-module-legacy/15.5/x86_64', + command => "SUSEConnect --product sle-module-legacy/${facts['os']['release']['full']}/x86_64", + unless => "SUSEConnect --status-text | grep sle-module-legacy/${facts['os']['release']['full']}/x86_64", } } diff --git a/spec/classes/java_spec.rb b/spec/classes/java_spec.rb index 9908af9c..90efa9f5 100644 --- a/spec/classes/java_spec.rb +++ b/spec/classes/java_spec.rb @@ -95,7 +95,7 @@ end context 'when selecting default for OpenSUSE 12.3' do - let(:facts) { { os: { family: 'Suse', name: 'OpenSUSE', release: { major: '12.3' }, architecture: 'x86_64' } } } + let(:facts) { { os: { family: 'Suse', name: 'OpenSUSE', release: { full: '12.3', major: '12', minor: '3' }, architecture: 'x86_64' } } } it { is_expected.to contain_package('java').with_name('java-1_7_0-openjdk-devel') } it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/') }