diff --git a/Gemfile b/Gemfile index a919bf3827..a26a16e505 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'rake' gem 'dotenv', '~> 2.1' group :package do - gem 'ood_packaging', '~> 0.16.1' + gem 'ood_packaging', '~> 0.16.2' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index e667245416..c94ba19057 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,7 +96,7 @@ GEM oga (3.3) ast ruby-ll (~> 2.1) - ood_packaging (0.16.1) + ood_packaging (0.16.2) rake (~> 13.0.1) open_uri_redirections (0.2.1) parallel (1.21.0) @@ -177,7 +177,7 @@ DEPENDENCIES beaker-docker (~> 1.4.0) beaker-rspec dotenv (~> 2.1) - ood_packaging (~> 0.16.1) + ood_packaging (~> 0.16.2) rake rspec rubocop diff --git a/lib/tasks/rake_helper.rb b/lib/tasks/rake_helper.rb index eac2b56358..5c2fe00181 100644 --- a/lib/tasks/rake_helper.rb +++ b/lib/tasks/rake_helper.rb @@ -260,12 +260,6 @@ def os_release end end - def scl_apache? - return true if el? && os_release['VERSION_ID'] =~ /^7/ - - false - end - def el? return true if "#{os_release['ID']} #{os_release['ID_LIKE']}" =~ /(rhel|fedora)/ @@ -279,8 +273,6 @@ def debian? end def apache_daemon - return '/opt/rh/httpd24/root/usr/sbin/httpd-scl-wrapper' if scl_apache? - "/usr/sbin/#{apache_service}" end @@ -298,7 +290,6 @@ def apache_user def apache_service return 'apache2' if debian? - return 'httpd24-httpd' if scl_apache? 'httpd' end diff --git a/nginx_stage/etc/profile b/nginx_stage/etc/profile index bd9766b62b..c37cb19c95 100644 --- a/nginx_stage/etc/profile +++ b/nginx_stage/etc/profile @@ -1,16 +1,4 @@ -# For Software Collections 2.0 +# Read the environment from /opt/ood/ondemand/enable # -# 1. Read in environment variable SCL_PKGS which may be set in `sudo` call -# otherwise fallback to default software collection packages. -# -# 2. Check if Software Collections is installed, then source the defined -# package scripts. -# -SCL_PKGS=${SCL_PKGS:-"ondemand"} -SCL_SOURCE="$(command -v scl_source)" -DEB_SOURCE="/opt/ood/ondemand/enable" -if [[ "${SCL_SOURCE}" ]]; then - source "${SCL_SOURCE}" enable ${SCL_PKGS} -else - [[ -e "${DEB_SOURCE}" ]] && source "${DEB_SOURCE}" || : -fi +OOD_SOURCE="/opt/ood/ondemand/enable" +[[ -e "${OOD_SOURCE}" ]] && source "${OOD_SOURCE}" || : diff --git a/ood-portal-generator/etc/profile b/ood-portal-generator/etc/profile index d0c31641ac..c37cb19c95 100644 --- a/ood-portal-generator/etc/profile +++ b/ood-portal-generator/etc/profile @@ -1,16 +1,4 @@ -# For Software Collections 2.0 +# Read the environment from /opt/ood/ondemand/enable # -# 1. Read in environment variable SCL_PKGS which may be set in `sudo` call -# otherwise fallback to default software collection packages. -# -# 2. Check if Software Collections is installed, then source the defined -# package scripts. -# -SCL_PKGS=${SCL_PKGS:-"ondemand"} -SCL_SOURCE="$(command -v scl_source)" -DEB_SOURCE="/opt/ood/ondemand/enable" -if [[ "${SCL_SOURCE}" ]]; then - source "${SCL_SOURCE}" enable ${SCL_PKGS} -else - [[ -e "${DEB_SOURCE}" ]] && source "${DEB_SOURCE}" || : -fi \ No newline at end of file +OOD_SOURCE="/opt/ood/ondemand/enable" +[[ -e "${OOD_SOURCE}" ]] && source "${OOD_SOURCE}" || : diff --git a/ood-portal-generator/lib/ood_portal_generator.rb b/ood-portal-generator/lib/ood_portal_generator.rb index d2e28a303f..12dcdbb5bb 100644 --- a/ood-portal-generator/lib/ood_portal_generator.rb +++ b/ood-portal-generator/lib/ood_portal_generator.rb @@ -26,16 +26,6 @@ def os_release_file path end - def scl_apache? - return true if os_release_file.nil? - return false if debian? - - env = Dotenv.parse(os_release_file) - return true if "#{env['ID']} #{env['ID_LIKE']}" =~ /(rhel|fedora)/ && env['VERSION_ID'] =~ /^7/ - - false - end - def debian? return false if os_release_file.nil? diff --git a/ood-portal-generator/lib/ood_portal_generator/application.rb b/ood-portal-generator/lib/ood_portal_generator/application.rb index 4167d06f53..f31c9693bd 100644 --- a/ood-portal-generator/lib/ood_portal_generator/application.rb +++ b/ood-portal-generator/lib/ood_portal_generator/application.rb @@ -80,8 +80,6 @@ def apache path = if OodPortalGenerator.debian? '/etc/apache2/sites-available/ood-portal.conf' - elsif OodPortalGenerator.scl_apache? - '/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf' else '/etc/httpd/conf.d/ood-portal.conf' end @@ -95,8 +93,6 @@ def apache_bak def apache_services if OodPortalGenerator.debian? ['apache2'] - elsif OodPortalGenerator.scl_apache? - ['httpd24-httpd'] else ['httpd'] end diff --git a/ood-portal-generator/spec/application_spec.rb b/ood-portal-generator/spec/application_spec.rb index c20cde94c8..f415265e6a 100644 --- a/ood-portal-generator/spec/application_spec.rb +++ b/ood-portal-generator/spec/application_spec.rb @@ -477,26 +477,17 @@ def test_generate(input, output) end end - it 'should use SCL apache' do - allow(OodPortalGenerator).to receive(:scl_apache?).and_return(true) - allow(OodPortalGenerator).to receive(:debian?).and_return(false) - expect(described_class.apache).to eq('/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf') - end - - it 'should not use SCL apache' do - allow(OodPortalGenerator).to receive(:scl_apache?).and_return(false) + it 'should use EL apache' do allow(OodPortalGenerator).to receive(:debian?).and_return(false) expect(described_class.apache).to eq('/etc/httpd/conf.d/ood-portal.conf') end it 'should work for Debian systems' do - allow(OodPortalGenerator).to receive(:scl_apache?).and_return(false) allow(OodPortalGenerator).to receive(:debian?).and_return(true) expect(described_class.apache).to eq('/etc/apache2/sites-available/ood-portal.conf') end it 'handles prefix from env' do - allow(OodPortalGenerator).to receive(:scl_apache?).and_return(false) allow(OodPortalGenerator).to receive(:debian?).and_return(false) with_modified_env PREFIX: '/foo' do expect(described_class.apache).to eq('/foo/etc/httpd/conf.d/ood-portal.conf') @@ -507,14 +498,13 @@ def test_generate(input, output) describe 'save_checksum' do before(:each) do allow(File).to receive(:exist?).with('/dne.conf').and_return(true) - allow(OodPortalGenerator).to receive(:scl_apache?).and_return(true) allow(OodPortalGenerator).to receive(:debian?).and_return(false) end it 'saves checksum file' do allow(File).to receive(:readlines).with('/dne.conf').and_return(["# comment\n", "foo\n", " #comment\n"]) described_class.save_checksum('/dne.conf') - expect(File.read(sum_path.path)).to eq("b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c /opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf\n") + expect(File.read(sum_path.path)).to eq("b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c /etc/httpd/conf.d/ood-portal.conf\n") end end @@ -525,7 +515,7 @@ def test_generate(input, output) end it 'matches' do - allow(File).to receive(:readlines).with(sum_path.path).and_return(["b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c /opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf\n"]) + allow(File).to receive(:readlines).with(sum_path.path).and_return(["b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c /etc/httpd/conf.d/ood-portal.conf\n"]) allow(File).to receive(:readlines).with('/dne.conf').and_return(["# comment\n", "foo\n", " #comment\n"]) expect(described_class.checksum_matches?('/dne.conf')).to eq(true) end @@ -537,7 +527,7 @@ def test_generate(input, output) end it 'does not match' do - allow(File).to receive(:readlines).with(sum_path.path).and_return(["b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c /opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf\n"]) + allow(File).to receive(:readlines).with(sum_path.path).and_return(["b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c /etc/httpd/conf.d/ood-portal.conf\n"]) allow(File).to receive(:readlines).with('/dne.conf').and_return(["# comment\n", "bar\n", " #comment\n"]) expect(described_class.checksum_matches?('/dne.conf')).to eq(false) end @@ -546,7 +536,7 @@ def test_generate(input, output) describe 'checksum_exists?' do it 'returns true' do allow(File).to receive(:zero?).with(sum_path.path).and_return(false) - allow(File).to receive(:readlines).with(sum_path.path).and_return(["b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c /opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf\n"]) + allow(File).to receive(:readlines).with(sum_path.path).and_return(["b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c /etc/httpd/conf.d/ood-portal.conf\n"]) expect(described_class.checksum_exists?).to eq(true) end @@ -602,19 +592,12 @@ def test_generate(input, output) end describe 'apache_changed_output' do - it 'SCL apache' do - allow(OodPortalGenerator).to receive(:debian?).and_return(false) - allow(OodPortalGenerator).to receive(:scl_apache?).and_return(true) - expect(described_class.apache_changed_output.join("\n")).to match(%r{httpd24-httpd.service}) - end - it 'EL non-SCL apache' do + it 'EL apache' do allow(OodPortalGenerator).to receive(:debian?).and_return(false) - allow(OodPortalGenerator).to receive(:scl_apache?).and_return(false) expect(described_class.apache_changed_output.join("\n")).to match(%r{httpd.service}) end it 'Debian apache' do allow(OodPortalGenerator).to receive(:debian?).and_return(true) - allow(OodPortalGenerator).to receive(:scl_apache?).and_return(false) expect(described_class.apache_changed_output.join("\n")).to match(%r{apache2.service$}) end end diff --git a/ood-portal-generator/spec/ood_portal_generator_spec.rb b/ood-portal-generator/spec/ood_portal_generator_spec.rb index 96e57505f1..8674696ece 100644 --- a/ood-portal-generator/spec/ood_portal_generator_spec.rb +++ b/ood-portal-generator/spec/ood_portal_generator_spec.rb @@ -23,79 +23,6 @@ end end - describe 'scl_apache?' do - it 'returns true if /etc/os-release does not exist' do - allow(described_class).to receive(:os_release_file).and_return(nil) - expect(described_class.scl_apache?).to eq(true) - end - - it 'returns true if RHEL7' do - os_release = <<~EOS - ID="rhel" - ID_LIKE="fedora" - VERSION_ID="7.7" - EOS - File.write(os_release_file.path, os_release) - allow(described_class).to receive(:os_release_file).and_return(os_release_file.path) - expect(described_class.scl_apache?).to eq(true) - end - - it 'returns true if CentOS7' do - os_release = <<~EOS - ID="centos" - ID_LIKE="rhel fedora" - VERSION_ID="7" - EOS - File.write(os_release_file.path, os_release) - allow(described_class).to receive(:os_release_file).and_return(os_release_file.path) - expect(described_class.scl_apache?).to eq(true) - end - - it 'returns false if RHEL8' do - os_release = <<~EOS - ID="rhel" - ID_LIKE="fedora" - VERSION_ID="8.0" - EOS - File.write(os_release_file.path, os_release) - allow(described_class).to receive(:os_release_file).and_return(os_release_file.path) - expect(described_class.scl_apache?).to eq(false) - end - - it 'returns false if CentOS8' do - os_release = <<~EOS - ID="centos" - ID_LIKE="rhel fedora" - VERSION_ID="8" - EOS - File.write(os_release_file.path, os_release) - allow(described_class).to receive(:os_release_file).and_return(os_release_file.path) - expect(described_class.scl_apache?).to eq(false) - end - - it 'returns false if RHEL9' do - os_release = <<~EOS - ID="rhel" - ID_LIKE="fedora" - VERSION_ID="9.0" - EOS - File.write(os_release_file.path, os_release) - allow(described_class).to receive(:os_release_file).and_return(os_release_file.path) - expect(described_class.scl_apache?).to eq(false) - end - - it 'returns false for Ubuntu 20.04' do - os_release = <<~EOS - ID=ubuntu - ID_LIKE=debian - VERSION_ID="20.04" - EOS - File.write(os_release_file.path, os_release) - allow(described_class).to receive(:os_release_file).and_return(os_release_file.path) - expect(described_class.scl_apache?).to eq(false) - end - end - describe 'debian?' do it 'returns false if CentOS8' do os_release = <<~EOS @@ -134,4 +61,4 @@ expect(described_class.apache_group).to eq('www-data') end end -end \ No newline at end of file +end diff --git a/packaging/rpm/ondemand.spec b/packaging/rpm/ondemand.spec index 1f5e48dc5e..fce8b96115 100644 --- a/packaging/rpm/ondemand.spec +++ b/packaging/rpm/ondemand.spec @@ -5,7 +5,7 @@ %define git_tag_minus_v %(echo %{git_tag} | sed -r 's/^v//') %define major_version %(echo %{git_tag_minus_v} | cut -d. -f1) %define minor_version %(echo %{git_tag_minus_v} | cut -d. -f2) -%define runtime_version %{major_version}.%{minor_version}.1 +%define runtime_version %{major_version}.%{minor_version}.2 %define runtime_release 1 %define runtime_version_full %{runtime_version}-%{runtime_release}%{?dist} %define selinux_policy_ver %(rpm --qf "%%{version}" -q selinux-policy)